CLOSE processing for tape files runs along the same lines as that described above for disk files. However, for tape files, labels have to be written and the tape positioned. For output files, DMS automatically writes the standard EOF labels as specified in the LABEL operand in the FILE/FCB macro or in the LABEL-TYPE operand in the ADD-FILE-LINK command. The tape is then positioned as specified by the user in the CLOSE macro.
If user labels (UTL) are to be written, the program must contain the necessary LABEND routine for this. However, DMS does not branch to this LABEND routine if several files are closed at the same time (CLOSE ALL).
Just as for OPEN processing, the way the labels are processed when a file is closed depends on the LABEL operand in the FILE macro or in the FCB, or on the LABEL-TYPE operand in the ADD-FILE-LINK command, and on the OPEN mode of the file.
If a file is closed with LEAVE specified in the CLOSE macro, the tape remains positioned at the logical end-of-file. If the following file is opened with the same file link name, the tape is repositioned to the start of the tape due to the implicit device release and the tape rewind operation initiated by the FILE macro with the LINK specification or by the ADD-FILE-LINK command with the LINK-NAME specification. The user can suppress tape rewinding by creating a TFT entry for a dummy file with a different file link name before the start of processing or by using different file link names when processing the files.
Closing input files
Label processing
For input files (OPEN INPUT), label processing is not necessary, since no file attributes are changed. The tape is simply positioned as specified in the CLOSE macro.
BYPASS handling
Input files can be positioned with the aid of the BYPASS operand of the FILE macro or the BYPASS-LABEL-CHECK operand of the ADD-FILE-LINK command. However, the user must remember that the use of the BYPASS operand affects how the tape is positioned at the end of CLOSE processing: the LEAVE operand must be specified; otherwise, the tape is rewound to the beginning. If the DISCON operand is specified, the tape is unloaded after it has been rewound.
Processing of tapes without EOF/EOV labels
A user job which processes a tape with standard labels, but without correct EOF/EOV labels, is normally returned a label error (EXLST exit LABERR) when a tape mark is detected. As in exceptional cases (non-Fujitsu) tapes have standard labels but no EOF/EOV labels, BS2000 supports the processing of such tapes The files can be processed with the SAM access method if, for example, the Assembler program contains routines for error handling (LABERR error).
Processing of tape files with standard labels and without EOF/EOV labels is possible only under the following conditions:
The file must be opened correctly, i.e. the tape must not be positioned, at OPEN time, to a file which follows a file without EOF labels.
The file must not be opened with OPEN REVERSE or EXTEND.
Closing output files
When an output file is closed, it is generally necessary to write labels as specified in the LABEL operand of the FILE macro or in the FCB or as specified in the LABEL-TYPE operand of the ADD-FILE-LINK command.
File with standard labels:
LABEL=(STD,n) or LABEL-TYPE=*STD(DIN-REVISION-NUMBER)
DMS automatically writes tape marks and – except in the case of BTAM files opened in SINOUT mode – the labels EOF1 through EOF3; labels EOF4 through EOF9 are not written under BS2000. With BTAM files which were opened in SINOUT mode, no trailer labels can be written because there was no label processing at the time of opening (OPEN) and therefore no information is available on the creation of trailer labels. If the file is to have user trailer labels (UTL), the program must have a LABEND routine to write them. As the BLIM function and BLOCK-LIMIT function in the ADD-FILE-LINK command are not effective, no checkpoint file is created. The tape is positioned as specified in the CLOSE macro.
If DESTOC=YES was specified in the FILE macro, or if DESTROY-OLD-CONTENTS=*YES was specified in the ADD-FILE-LINK command, or if the catalog entry contains DESTROY=YES, the remainder of the tape is erased.
File with nonstandard labels:
LABEL=NSTD or LABEL-TYPE=*NON-STD
Nonstandard labels must be created by a LABEND routine in the user program. Before calling this label routine, DMS writes a tape mark. If TPMARK=YES was specified in the FILE macro or TAPE-MARK-WRITE=*YES in the ADD-FILE-LINK command, DMS writes a double tape mark. If TPMARK=NO was specified in the TFT entry and in the file control block, DMS writes only one tape mark. The tape is then positioned as specified in the CLOSE macro. If DESTOC=YES was specified in the FILE macro, or if DESTROY-OLD-CONTENTS=*YES was specified in the ADD-FILE-LINK command, or if the catalog entry contains DESTROY=YES, the remainder of the tape is erased.
File without labels:
LABEL=NO or LABEL-TYPE=*NO
DMS writes a double tape mark to indicate end-of-file and end-of-volume. If DESTOC=YES was specified in the FILE macro, or if DESTROY-OLD-CONTENTS=*YES was specified in the ADD-FILE-LINK command, or if the catalog entry contains DESTROY=YES, the remainder of the tape is erased.