The CLOSE macro creates output data set labels and allows you to position volumes. The fields of the data control block (DCB) and DCBE are restored to the condition that existed before the OPEN macro was issued, and the data set is disconnected from the processing program. You can specify final volume positioning or disposition for the current volume to override the positioning implied by the DISP parameter of the DD statement. Any number of dcb address parameters and associated options can be specified in the CLOSE macro.
After a CLOSE has been issued for several data sets, a return code of 4 indicates that at least one of the data sets, VSAM or non-VSAM, was not closed successfully.
A FREEPOOL macro should normally follow a CLOSE macro (without TYPE=T) to regain the buffer pool storage space if OPEN or GETPOOL built the buffer pool. This also allows a new buffer pool to be built if the DCB is reopened with different record size attributes. However, if you requested via the DCBE that OPEN obtain QSAM buffers above the line, CLOSE frees the buffer pool obtained by OPEN. Therefore, in this case, a FREEPOOL macro is not required following the CLOSE macro.
Associated data sets for an IBM® 3525 Card Punch can be closed in any sequence, but, if one data set is closed, I/O operations cannot be initiated for any of its associated data sets. Additional information about closing associated data sets is contained in z/OS DFSMS Using Data Sets.
A special parameter, TYPE=T, temporary close, is provided for processing with BSAM.
The CLOSE macro does not support more than a total of 255 spooled, SUBSYS or compressed format data sets, for one invocation.
If you use a "reserved" relative generation number character as the first character of a member name, the stow will not occur, you must issue your own stow.
Extended format data sets: If you request release of unused space for extended format data sets, CLOSE releases space on each stripe if possible. After the space is released, the size of some stripes may differ slightly from others. Depending on the unit used for allocation, the difference will be at most one track or cylinder.
When a compressed format data set is written using BSAM or QSAM, the CLOSE macro ensures that all data has been synchronized to DASD.
PDS and PDSE data sets: If the PDS or PDSE is open for OUTPUT, OUTIN or INOUT, and a member name was specified in the JCL (or JFCB with OPEN TYPE=J), and the last operation was either a WRITE (BSAM) or a PUT (QSAM), and the application has not issued its own STOW, then CLOSE will issue a STOW. However, if the first character of the member name is '+' (X'4E'), '-' (X'60'), or (X'Fx'), CLOSE will not issue STOW. This is because these characters identify the generation data set (GDS) within a generation data group (GDG), and the access method uses the first character of the member name field in the JFCB to distinguish between a GDS identifier and a member name.
PDSEs: After PDSE members are written or updated using BSAM or QSAM, the CLOSE macro synchronizes member data to DASD.
UNIX files: When a file is written using BSAM or QSAM, the CLOSE macro ensures that all data has been synchronized to the file.
SMF records: CLOSE does not write SMF type 14/15 records for UNIX files. DFSMS relies on z/OS UNIX to write appropriate SMF records when requested by the system programmer.
The CLOSE macro may be issued in 24- or 31-bit addressing mode. When issued in 31-bit addressing mode, all addresses must be valid 31-bit addresses.
The standard form of the CLOSE macro is as follows (the list and execute forms are shown following the description of the standard form):
[label] |
CLOSE |
(dcb address[,[ |
---|
Requirement: If the register format is used, then the register must be enclosed within parentheses. For example, CLOSE ((2)).
DISP Parameter | Action |
---|---|
PASS | Forward space to the end of data set on the current volume. |
DELETE | Rewind the current volume. |
KEEP, CATLG, or UNCATLG | The volume is rewound and unloaded, if necessary. |
If FREE=CLOSE is coded in the DD statement associated with this data set, coding the DISP option in the CLOSE macro results in the data set being freed when the data set is closed, rather than at the time the job step is terminated.
When the option subparameter is omitted, DISP is assumed. For TYPE=T, this is processed as LEAVE during execution. The LEAVE and REREAD options are used only for magnetic tape or CLOSE TYPE=T.
TYPE=T causes the system control program to process labels, modify some of the fields in the system control blocks for that data set, and reposition the volume (or current volume for multivolume data sets) in much the same way that the normal CLOSE macro does.
When you code TYPE=T, you can specify that the volume either be positioned at the end of data (the LEAVE option) or be repositioned at the beginning of data (the REREAD option). Magnetic tape or DASD volumes are repositioned either immediately before the first data record or immediately after the last data record. The presence of tape labels has no effect on repositioning.
For PDSEs and partitioned data sets, CLOSE TYPE=T does no operation except when reading the PDSE or partitioned data set directory sequentially. If you code CLOSE TYPE=T with the REREAD option, the data set is repositioned to the beginning of the directory.
If you code the RLSE keyword with the SPACE parameter on the DD statement that describes the output data set, it is ignored by temporary close (CLOSE TYPE=T). If the last operation occurring before the normal CLOSE (without TYPE=T) and after the temporary close was a write, then any unused space is released.
For extended format data sets open for output, CLOSE TYPE=T updates the data set label for each stripe to correctly reflect the used space on each volume.
While an extended format data set is open for output, the data set labels do not correctly reflect the used space in the data set. An open to an input or update DCB (while the output DCB is still open for output) will not reflect the correct data set size of an extended format data set. You may choose to issue a CLOSE LEAVE,TYPE=T on the output DCB to cause subsequent OPENs for input/update to reflect the correct amount of used space. CLOSE TYPE=T is ignored for a FIFO and character special UNIX file.
The caller of the standard form of the macro with the short form of the parameter list must reside below the 16MB line, but the caller can be executing in 31-bit mode. All access method control blocks (ACBs) and DCBs are below the 16MB line.
The long form parameter list can reside above or below the 16MB line. Although the access method control block (ACB) or DCB address is contained in a 4-byte field, the DCB must be below the 16MB line. Except for VSAM or Virtual Telecommunications Access Method (VTAM®) ACBs, all ACBs must also be below the 16MB line. Therefore, the leading byte of the ACB or DCB address must contain zeros. If the byte contains something other than zeros, an IEC290I message is issued and the data set is not closed.
For additional information and coding restrictions, see z/OS DFSMS Using Data Sets.