Variable-length and fixed-length files

Variable-length files might use a length prefix, which means they contain a prefix that identifies the length of the record in the file. Each record contains a field that gives the length of the record. If the record contains a length, that length must be a prefix for each record and it must be a 16-bit binary number that includes the length of the 2-byte length prefix. Use the fileformat=record keyword and value to identify files with length prefixes.

Variable-length files might use either a separator or a delimiter to indicate the end of a record, instead of using a length prefix. All of the bytes up to, but not including, the delimiter are considered part of the record. For compatibility with other systems, the default record separator for the line2afp command is X'0A'.

InfoPrint Manager reads the first six bytes and tests for all ASCII characters (code points from X'00' to X'7F') to determine if a file is encoded in ASCII or EBCDIC. If no non-ASCII characters are found, the line-data transform program assumes that the file uses the ASCII newline character, X'0A'. Otherwise, the transform assumes the file uses the EBCDIC newline character, X'25'. Because an input file can misguide the line-data transform, a set of rules has been established to determine how the transform processes the file.

Data Type Newline Character
All EBCDIC EBCDIC X'25'
All EBCDIC ASCII X'0D0A' or X'0A' (see Notes)
All ASCII EBCDIC X'25' (see Notes)
All ASCII ASCII X'0D0A' or X'0A'
Note: These combinations are possible only if a file contains a prefix with a string that indicates a different code set than actually exists.
  • For EBCDIC data with ASCII newlines, use X'0320202020200A' as the first seven bytes of the file.
  • For ASCII data with EBCDIC newlines, use X'03404040404025' as the first seven bytes of the file.