1. CLOSE

The CLOSE statement terminates file processing. If the FILE STATUS clause is described in the file-control entry, the CLOSE statement is executed, and the file status key is updated to the corresponding value.

  • Format 1

    REEL, UNIT, and NO REWIND phrases are not available for VSAM files.

    figure pd close format1 sequential
    CLOSE Statement Format 1
  • Format 2

    figure pd close format2 indexed and relative
    CLOSE Statement Format 2
  • Format 3

    figure pd close format3 line sequential
    CLOSE Statement Format 3

The following items are specified in the statement.

  • file-name-1

    • The file name used in the OPEN statement must be specified. The organization and access mode for each file does not need to be the same to specify multiple files.

    • Sort and merge files cannot be used.

  • REEL, UNIT

    • The attributes of the device where the files are stored.

  • WITH NO REWIND, FOR REMOVAL

    • Only apply to tape files. If these are set for a device to which they cannot apply, the CLOSE statement will still execute successfully, and the file status will be set to a value which indicates that the device is not a tape file.