Skip to main content

Reading Macintosh line sequential file

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

The records are x'0d" delimited in a Macintosh's line sequential file, and the file handler only recognizes x'0a' (used in Unix) or x'0d0a' (used in Windows) as a valid record delimiter. The file cannot therefore be defined and read as line sequential in COBOL.

Resolution:

One would assume that LSRECDELIM (file handler configuration option) would be the solution, but that option only accepts either x'0a' or x'0d0a'.  The alternatives are using  byte-stream I/O routines to convert the file to x'0d0a' record delimiters, using third-party software to convert the file, or reading the entire file as as a single record and extracting each record delimited by x'0d'.

Note:

1. There has been an enhancement request that was raised to support x'0d' as a valid parameter to LSRECDELIM option (RPI #1053920)

2. x'0d' = CR = Carriage Return character

3. x'0a' = LF = Line Feed character

4. x'0d0a' = CR/LF = Carriage Return & Line Feed characters

Old KB# 7011