File transfer

ACIF processes print records. A record is a sequence of contiguous characters, usually representing a printed line or a MO:DCA (AFP data stream) structured field.

ACIF needs to know the following information to print it:
  • The length of each print record
  • What kind of carriage control is used
Structured fields are similar to print commands. Each record has a defined boundary or length. Some files contain information in each record that describes the record's length; these are called variable-length files. Other files require an external definition of length; these are called fixed-length files.
  • Variable-length files
    • Variable-length files may use a length prefix that provides the length of a record in the file. For variable-length files that contain records with a length prefix, each record in the file contains a two-byte length prefix that provides the length of the record. The length prefix is a 16-bit binary number. The value of the length prefix does not include the two-byte length prefix. Use the FILEFORMAT=RECORD control statement to identify a file that contains records with length prefixes.
    • Variable-length files may use a separator or 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 to be part of the record. In UNIX, the delimiter is X'0A' (In Windows, the delimiter is X'0D0A'). If the file uses EBCDIC encoding, the delimiter is X'25'. Use the FILEFORMAT=STREAM control statement to designate files that use delimiters to indicate record boundaries.
    • ACIF reads the first six bytes and tests for all ASCII charactersCode 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, ACIF assumes the file uses the ASCII newline character, X'0A'. Otherwise, ACIF assumes the file uses the EBCDIC newline character, X'25'. Because an input file can misguide ACIF, either intentionally or by accident, a set of rules has been established to determine how ACIF will interpret how a file will be processed. The following table lists the possible combinations.
      Table 1. Data type and Newline character combinations
      Data Type Newline Character
      All EBCDIC EBCDIC X'25'
      All EBCDIC ASCII X'0A'
      All ASCII EBCDIC X'25'
      All ASCII ASCII X'0A'
      Important: 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'. For ASCII data with EBCDIC newlines, use X'03C1C1C1C1C125'.
  • Fixed-length files
    • Fixed-length files contain records that are all the same length. No other separators or prefixes or self-identifying information exists that indicates the record length. You must know the record length and use the FILEFORMAT=RECORD,nnn control statement, where nnn represents the length of each record.

For variable- and fixed-length files that use length prefixes, MO:DCA structured fields are treated as a special case. All such structured fields are self-identifying and contain their own length. They need not contain a length prefix to be correctly interpreted but will be processed correctly if there is a length prefix.