Requesting undefined format

Format-U records have undefined or unspecified characteristics. With format U, you can process blocks that do not meet format-F or format-V specifications.

About this task

When you use format-U files, each block of storage is one logical record. A read of a format-U file returns the entire block as a record. A write to a format-U file writes a record out as a block. The compiler determines the recording mode to be U only if you code RECORDING MODE U.

It is recommended that you not use format U to update or extend a file that was written with a different record format. If you use format U to update a file that was written with a different format, the RECFM value in the data-set label could be changed or the data set could contain records written in different formats.

The record length is determined in your program based on how you use the RECORD clause:

  • If you use the RECORD CONTAINS integer clause (format-1 RECORD clause), the record length is the integer value regardless of the lengths of the level-01 record description entries associated with the file. The integer size indicates the number of bytes in a record regardless of the USAGE of its data items.
  • If you use the RECORD IS VARYING clause (format-3 RECORD clause), the record length is determined based on whether you code integer-1 and integer-2.

    If you code integer-1 and integer-2 (RECORD IS VARYING FROM integer-1 TO integer-2), the maximum record length is the integer-2 value regardless of the lengths of the level-01 record description entries associated with the file. The integer sizes indicate the minimum and maximum record lengths in numbers of bytes regardless of the USAGE of the data items in the record.

    If you omit integer-1 and integer-2, the maximum record length is determined to be the size of the largest level-01 record description entry associated with the file.

  • If you use the RECORD CONTAINS integer-1 TO integer-2 clause (format-2 RECORD clause), with integer-1 and integer-2 matching the minimum length and the maximum length in bytes of the level-01 record description entries associated with the file, the maximum record length is the integer-2 value.
  • If you omit the RECORD clause, the maximum record length is determined to be the size of the largest level-01 record description entry associated with the file.

Format-U files and READ INTO: When you specify a READ INTO statement for a format-U file, the compiler generates a MOVE statement that uses the size of the record that it just read for that file. If the record just read does not correspond to the level-01 record description, you might not get the result that you expect. All other rules of the MOVE statement apply.