I/O operations on a save file

Review these considerations which apply to input and output operations on a save file.

  • Records are always read and written sequentially. The records read from a save file contain sequence and parity information that is validated when the records are written into another save file. This information ensures that the records are processed in sequence and have not been changed.

    You cannot write a record that has changed since it was retrieved from another save file. You cannot write a record that is not the next record in sequence. If you attempt either of these, an escape message is sent to report the error.

  • A read of records from the save file can be done only if the entire file has been written.
  • The force-end-of-data (FEOD) function is valid for both input and output.

    For an input file, FEOD signals end-of-file to the program that does the operation.

    To ensure buffered output records are not lost after an FEOD operation completes, they are written to the file. For an output file, buffered output records are not lost even if the job or system fails.

File-dependent attributes for a save file

  • The following file-dependent attributes apply when the save file is open:
    • For input operations, the first record returned for a read operation is the one specified by the parameter POSITION when the file is opened. After the first record is read, all remaining records are returned sequentially to the end of the file.
    • For output operations, new records can be added to the end of records already in the file (specified using the EXTEND parameter). Each save file record contains sequencing information used by the system to ensure that a record is not skipped or written more than once.
    • If no record length is specified in the high-level language program that opens the file, a length of 528 bytes is assumed. If the program specifies a record length value, it must be 528 bytes.
  • No file-dependent parameters (such as format name) can be specified for read or write operations with a save file. Any file-dependent parameters specified are ignored.