The processing of output files with standard labels is requested by means of the operand LABEL=(STD,n) of the FILE macro or the operand LABEL-TYPE=*STD(DIN-REVISION-NUMBER=n) of the ADD-FILE-LINK command.
As for input files, DMS skips to step 5 to process the file header labels if the VOL1 label of the tape has already been checked ("Files with standard labels").
Checking volume header labels
1. Is the first record on the tape a volume header label VOL1?
DMS checks the first four characters for the character string “VOL1”. If it does not find this string, the first record is not a VOL1 label, i.e. not a standard label. DMS issues message DMS0DA2
on the console, and the operator must react to this message.
2. Has the user requested a specific tape or a work tape?
The user can (e.g. by means of DEVICE=WORK in the FILE macro or DEVICE-TYPE= WORK in the CREATE-FILE command) request a work tape, which the operator must allocate. The operator must also allocate a tape if the volume list which the user has defined for the file via the FILE macro (VOLUME operand) or via the VOLUME operand in the CREATE-FILE command contains no further tapes. In both cases, DMS issues message DMS0DFB
on the console, and the operator must check the MOUNT operation again.
3. If the user has requested a specific tape: has the correct tape been allocated?
DMS checks whether the VSN in the VOL1 label matches the VSN which the user specified in the FILE macro (VOLUME=vsn) or in the CREATE-FILE command (VOLUME operand). If these two VSNs do not match, DMS issues message DMS0DA1
on the console. Now the operator must decide how processing is to be continued.
4. Is access permitted only for the tape owner? If so: are the tape owner and the user ID the same?
DMS evaluates the contents of the VOL1 fields “access indicator” and “owner identifier”. If the user is not authorized to access the tape, DMS sends him/her message DMS0DD7
. The user can now terminate his/her program or have label checking retried.
When a tape is initialized, the owner identifier is normally left empty or the computer center is entered as the tape owner and the tape is marked as shareable.
5. Is the next record to be read a HDR1 label?
After the VOL1 label check, DMS positions the tape as specified in the FSEQ operand of the FILE macro or in the FCB, or as specified in the FILE-SEQUENCE operand in the ADD-FILE-LINK command.
If DMS does not find a HDR1 label at this position, is starts the “measures to prevent implicit overwriting” (see step 9, "Files with standard labels"). If DMS finds a HDR1 label, it reads the HDR2 label and, if an existing file is to be overwritten, also the HDR3 label. If the tape is to be written afresh from the start, the next step is updating of the volume header labels (see "Files with standard labels").
6. May the requesting job (over)write the file?
DMS evaluates the access indicator (in the HDR1 label) and – if a HDR3 label has already been read – the owner identifier and checks whether the job is authorized to access the file. If this is not the case, DMS sends message DSM0DD7
to the user.
7. May the file be overwritten?
DMS checks the expiration date and the access type in the HDR1 and HDR3 labels. If a retention period is defined (expiration date in HDR1 > current date) or if the access type in HDR3 indicates that the file is “read-only” (corresponding to ACCESS=READ), message DMS0DA3
is sent to the user. If authorized, the user can ignore this message and proceed with file processing. Otherwise, he can have his program terminated with an error routine, have the contents of the label displayed, or have label checking retried, possibly with a different tape (for foreign files).
If the file may be overwritten, the password fields in the HDR3 label are not checked.
8. Do the fields “file section number” and “file sequence number” in the HDR1 label contain valid values?
If an existing multivolume file is to be overwritten, the file section number in the HDR1 label must match the file section number specified in the FILE macro (VSEQ=) or in the ADD-FILE-LINK command (VOL-SEQUENCE-NUMBER operand). For the tape on which the file begins, VSEQ or VOL-SEQUENCE-NUMBER, as appropriate, must be 1. If VSEQ or VOL-SEQUENCE-NUMBER does not contain a valid value, OPEN processing is aborted unless FSEQ=0/FSEQ=1 or FILE-SEQUENCE=0/FILE-SEQUENCE=1 is also specified (explicitly or implicitly), i.e. if the new output file is not the first file of a file set.
9. Measures to prevent implicit overwriting
If “overwrite protection” (OPR) was specified in the SECLEV operand of the FILE macro or in the FCB, or with the OVERWRITE-PROTECTION=*YES operand of the ADD-FILE-LINK command, and if the current file is to be written as an element of a file set after an existing file (FSEQ=n, where n > 1), DMS compares the protection attributes “expiration date” and “access type” defined for the new file with those of the preceding file (FSEQ=n-1). It is taking the values from the appropriate fields of the labels EOF1 and EOF3. If the preceding file has no EOF3 label, ACCESS=WRITE is implied, i.e. write access is permitted. The tape is rejected if a retention period is defined for both the new and the preceding file and the expiration date for the new file is greater. The tape is also rejected if ACCESS=READ (only read access permitted) is defined for the new file but the preceding file (FSEQ=n-1) has ACCESS=WRITE (read and write access permitted).
Updating volume header labels
If a tape is to be written from the beginning (first file of a file set or processing of a continuation tape), and if the tape owner and the file owner are identical, the fields “access type” and “exchange level” of the VOL1 label are updated. The latter field indicates which labels are supported by default in accordance with the DIN 66029 exchange levels.
If the user program includes an OPENV routine for writing user volume labels (UVL), DMS then branches to this routine. If no OPENV exit is defined in the EXLST macro, no UVL labels are written. In register 0, DMS provides the address of an 80-byte area in which the labels can be created sequentially. The OPENV routine is terminated by means of the LBRET macro.
Writing/updating file header labels
The file protection attributes defined in the catalog entry are written into the HDR labels of the new file, together with the file set information specified in the FILE macro or ADD-FILE-LINK command: file set identifier of the first file, file section number (VSEQ/VOL-SEQUENCE-NUMBER) and file sequence number (FSEQ/FILE-SEQUENCE).
If the user program includes an LABGN routine for writing user header labels (UHL), DMS then branches to this routine. If no LABGN exit is defined in the EXLST macro, no UHL labels are written. When DMS branches to the LABGN routine, it provides, in register 0, the address of an 80-byte area in which the labels can be created sequentially. The LABGN routine is terminated by means of the LBRET macro.
Writing a tape mark
By default, DMS writes a tape mark after the file header labels.