CLOSE Options

<close options>

──┬─ * ─────────────────┬──────────────────────────────────────────────┤
  ├─ CRUNCH ────────────┤
  ├─ LOCK ──────────────┤
  ├─ PURGE ─────────────┤
  ├─ REEL ──────────────┤
  ├─ REWIND ────────────┤
  ├─ DOWNSIZEAREA ──────┤
  ├─ DOWNSIZEAREALOCK ──┤
  └─<port close option>─┘

If the asterisk (*) is used and the file is a tape file, the I/O unit remains under program control, and the tape is not rewound. This construct is used to create multifile reels.

When the asterisk is used on multifile input tapes and the value of the LABEL file attribute is STANDARD, the CLOSE statement closes the file as follows:

  • If the value of the DIRECTION file attribute is FORWARD, the tape is positioned forward to a point just following the ending label of the file.

  • If the value of the DIRECTION file attribute is REVERSE, the tape is positioned to a point just in front of the beginning label for the file.

  • If the end-of-file branch of a READ statement or WRITE statement has been taken, the CLOSE statement does not position the file.

The close action performed on a single-file reel is the same as that performed on a multifile reel. The next I/O operation performed on the file must be done in the direction opposite to that of the prior I/O operations; otherwise, an end-of-file error is returned.

When the asterisk is used and the LABEL file attribute does not have the value STANDARD, the tape is spaced beyond the tape mark (on input), or a tape mark is written going forward (on output). The essential difference is that if LABEL is OMITTEDEOF, labels are not spaced over, but if LABEL is STANDARD, labels are spaced over.

The CRUNCH option is meaningful only for disk files. It causes the unused portion of the last row of disk space, beyond the end-of-file indicator, to be returned to the system. The file cannot be expanded but can be written inside of the end-of-file limit.

If the LOCK option is used, the file is closed. If the file is a tape file, it is unloaded from the tape drive. If the file is a disk file, it is kept as a permanent file on disk. The file buffer areas are returned to the system.

The DOWNSIZEAREA and DOWNSIZEAREALOCK options are meaningful only for disk files. If the file uses a small portion of the first area only, both options cause the area size of the file to be reduced and the remaining portion to be returned to the system. Otherwise, the DOWNSIZEAREA option is like the REWIND option, and the DOWNSIZEAREALOCK option is like the LOCK option. The DOWNSIZEAREA and DOWNSIZEAREALOCK options do not return as much space as the CRUNCH option, but they do enable the file to be extended.

If the PURGE option is used, the file is closed, purged, and released to the system. If the file is a permanent disk file, it is removed from the disk directory, and the disk space is returned to the system.

If the REEL option is used, the file must be a multireel tape file. The current reel is closed, and the next reel is opened. This option is provided primarily for use with direct tape files, for which the system does not automatically perform reel switching.

If the REWIND option is used, the file is closed. If the file is a tape file, it is rewound. For disk files, the record pointer is reset to the first record of the file. The file buffer areas are returned to the system, and the I/O unit (or disk file) remains under program control.

A CLOSE statement that leaves the file under program control is referred to as a close with retention. For example, a CLOSE statement that designates the REWIND option is a close with retention. For more information, refer to the I/O Subsystem Programming Guide.