The CLOSE Statement (Report Writer)

The CLOSE statement terminates the processing of reel/units and files with optional rewind and/or lock or removal where applicable.

General Format


*

Syntax Rules

  1. The files referenced in the CLOSE statement need not all have the same organization or access.

General Rules

Except where otherwise stated in the general rules below, the terms "reel" and "unit" are equivalent and completely interchangeable in the CLOSE statement. Treatment of sequential mass storage files is logically equivalent to the treatment of a file on tape or analogous sequential media. Treatment of a file contained in a multiple file tape environment is logically equivalent to the treatment of a sequential single-reel/unit file if the file is wholly contained on one reel.

  1. A CLOSE statement can only be executed for a file in an open mode.
  2. For the purpose of showing the effect of various types of CLOSE statements as applied to various storage media, all report files are divided into the following categories:
    1. Non-reel/unit. A file whose output medium is such that the concepts of rewind and reels/units have no meaning.
    2. Sequential single-reel/unit. A sequential file that is entirely contained on one reel/unit.
    3. Sequential multi-reel/unit. A sequential file that is contained on more than one reel/unit.
  3. The results of executing each type of CLOSE for each category of file are summarized in the table below.
    Table 1. Relationship of Categories of Files and the Formats of the CLOSE Statements
    CLOSE Statement Format File Category
    Non-Reel/Unit Sequential Single-Reel/Unit Sequential Multi-Reel/Unit
    CLOSE C C,G A,C,G
    CLOSE WITH LOCK C,E C,E,G A,C,E,G
    CLOSE WITH NO REWIND C,H B,C A,B,C
    CLOSE WITH REEL/UNIT F F,G F,G
    CLOSE REEL/UNIT FOR REMOVAL F D,F,G D,F,G

    The definitions of the symbols in the table are given below.

    • A. Effect on Previous Reels/Units for an Output Report File

      All reels/units in the report file prior to the current reel/unit are closed except those reels/units controlled by a prior CLOSE REEL/UNIT statement.

    • B. No Rewind of Current Reel

      The reel/unit is left in its current position.

    • C. Close Output Report File

      If label records are specified for the report file, the labels are processed according to the implementor's standard label convention. The behavior of the CLOSE statement when label records are specified but not present, or when records are not specified but are present, is undefined. Closing operations specified by the implementor are executed. If label records are not specified for the report file, label processing does not take place but other closing operations specified by the implementor are executed.

    • D. Reel/Unit Removal

      The current reel or unit is rewound, when applicable, and the reel or unit is logically removed from the run unit; however, the reel or unit can be accessed again, in its proper order of reels or units in the report file, if a CLOSE statement without the REEL or UNIT phrase is subsequently executed for this report file followed by the execution of an OPEN statement for the report file.

    • E. File Lock

      The report file is locked and cannot be opened again during this execution of this run unit.

    • F. Close Reel/Unit

      Output Report File (Reel/Unit Media):

      The following operations take place:

      1. The standard ending reel/unit label procedure is executed.
      2. A reel/unit swap. The current volume pointer is updated to point to the new reel/unit.
      3. The standard beginning reel/unit label procedure is executed.
      4. The next executed write operation that references that file directs the next logical data record to the next reel/unit of the file.

      Output Report File (Non-Reel/Unit Media):

      Execution of this statement is considered successful. The file remains in the open mode, and no action takes place except as specified in general rule 4.

    • G. Rewind

      The current reel or analogous device is positioned at its physical beginning.

    • H. Optional Phrases Ignored

      The CLOSE statement is executed as if none of the optional phrases is present.

  4. The execution of the CLOSE statement causes the value of the I/O status associated with file-name-1 to be updated.
  5. All reports associated with a report file that have been initiated must be ended with the execution of a TERMINATE statement before a CLOSE statement is executed for that report file.
  6. Following the successful execution of a CLOSE statement without the REEL or UNIT phrase, the report file is removed from the open mode, and the report file is no longer associated with the file connector.
  7. If more than one file-name-1 is specified in a CLOSE statement, the result of executing this CLOSE statement is the same as if a separate CLOSE statement had been written for each file-name-1 in the same order as specified in the CLOSE statement.