Requesting spanned format
Spanned records are in format S. A spanned record is a QSAM logical record that can be contained in one or more physical blocks.
You can code
RECORDING MODE S for spanned records
in QSAM files that
are assigned to magnetic tape or to direct access devices.
request spanned records for files in the z/OS® UNIX file system.
You can omit the
RECORDING MODE clause.
The compiler determines the
recording mode to be
S if the maximum record length (in bytes) plus
4 is greater than the block size set in the
BLOCK CONTAINS clause.
For files with format S in your program, the compiler determines
the maximum record length with the same rules as are used for
format V. The length is based on your usage of the
When creating files that contain format-S records and a record is larger than the remaining space in a block, COBOL writes a segment of the record to fill the block. The rest of the record is stored in the next block or blocks depending on its length. COBOL supports QSAM spanned records up to 32,760 bytes in length.
When retrieving files that have format-S records, a program can retrieve only complete records.
Benefits of format-S files: You can efficiently use external storage and still organize your files with logical record lengths by defining files with format-S records:
- You can set block lengths to efficiently use track capacities on direct access devices.
- You are not required to adjust the logical record lengths to device-dependent physical block lengths. One logical record can span two or more physical blocks.
- You have greater flexibility when you want to transfer logical records between direct access storage types.
You will, however, have additional overhead in processing format-S files.
Format-S files and READ INTO:
When you specify a
READ INTO statement for a format-S
file, the compiler
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.
Requesting fixed-length format
Requesting variable-length format
Requesting undefined format
Establishing record formats