Overwriting a file set
A tape can be overwritten only if its retention period has elapsed and write access is permitted.
If the user wishes to overwrite a file, DMS positions the tape in accordance with the file sequence number. File protection attributes such as passwords, etc. are evaluated only for cataloged files.
If the file specified in the FILE/FCB macro or ADD-FILE-LINK command is cataloged, the file sequence number in the FSEQ or FILE-SEQUENCE operand must match that in the catalog entry. If the file is not yet cataloged, DMS positions the tape on the basis of the FSEQ/FILE-SEQUENCE specification and the file can then be overwritten without checking the file name.
If the file is not cataloged and the FSEQ/FILE-SEQUENCE specification is 1 greater than the highest existing file sequence number in the file set, the file set is extended by one file.
Extending a file set
In order to extend a file set by one file, the user must specify either FSEQ=NEW in the FILE/FCB macro, or FILE-SEQUENCE=NEW in the ADD-FILE-LINK command, or a number which is 1 greater than the last file sequence number in the file set. The file must not be cataloged before this is done.
If FSEQ=NEW/FILE-SEQUENCE=*NEW is specified, DMS positions the tape to the end of the file set. If this lies within the volume set specified in the FILE macro or ADD-FILE-LINK command, the new file is written to the tape with a file sequence number which is 1 greater than that of the current last file in the set.
If SECLEV=OPR is specified in the FILE/FCB macro, the security level of the new file must be less than or equal to that of the preceding file. The same applies if the operand OVERWRITE-PROTECTION=*YES is specified in the ADD-FILE-LINK command.
Adding several files to a file set (program interface)
If the user is certain that all of the files will fit on one tape, he/she can use the following sequence of commands and program statements:
FILE AAA,VOLUME=000001,FSEQ=1,DEVICE=TAPE,LINK=OUTP1 OPEN OUT1,OUTPUT . . CLOSE OUT1,LEAVE FILE BBB,VOLUME=000001,FSEQ=NEW,DEVICE=TAPE,LINK=OUTP2 OPEN OUT2,OUTPUT . . CLOSE OUT2,LEAVE FILE CCC,VOLUME=000001,FSEQ=NEW,DEVICE=TAPE,LINK=OUTP3 OPEN OUT3,OUTPUT . . CLOSE OUT3,LEAVE . . OUT1 FCB LINK=OUTP1... OUT2 FCB LINK=OUTP2... OUT3 FCB LINK=OUTP3...
If the size of a file in the file set (e.g. the first file) cannot be predicted, the user could extend the volume sets in the FILE macros for files AAA, BBB and CCC as follows:
VOLUME=(000001,000002)
If file AAA extends onto the second tape, DMS requests the first tape again when it creates files BBB and CCC in order to determine the end of the file set. If file AAA is so large that file BBB does not fit on the second tape, DMS requests a further free tape. After this, however, OPEN processing for file CCC will result in an error because the file set ends on a tape which was not specified in the FILE macro and is thus not part of the volume set.
However, the user can use the TSET operand of the FILE macro to temporarily link the file and volume sets. In the TSET operand, the user enters the name of a “tape set”, i.e. a temporary volume list which is maintained in the TST (tape set table). A TST entry is a table in which the VSNs of the tapes requested for a job are stored – linked via a TSET name.
In the following example, the file set AAA, BBB and CCC is again created.
START LDBASE 10 USING *,10 . FILE AAA,LINK=OUTP1,VOLUME=000001,DEVICE=TAPE,FSEQ=1,TSET=SET1 OPEN OUT1,OUTPUT . . CLOSE OUT1,LEAVE FILE BBB,LINK=OUTP2,DEVICE=TAPE,FSEQ=NEW,TSET=SET1,VOLUME=000002 OPEN OUT2,OUTPUT . . CLOSE OUT2,LEAVE FILE CCC,LINK=OUTP2,DEVICE=TAPE,FSEQ=NEW,TSET=SET1 OPEN OUT2,OUTPUT . . CLOSE OUT2,LEAVE . . OUT1 FCB LINK=OUTP1... OUT2 FCB LINK=OUTP2... OUT3 FCB LINK=OUTP3...
All files refer to the same TST entry and the files and the TST entry are linked via the TFT (task file table), which is created by means of a LINK operand for each file. DMS automatically organizes the structure of the file set on the common volume set.
The TST entry is set up if the LINK operand is specified in the FILE macro and, at the same time, a new TST name is specified in the TSET operand. If the TSET specification is repeated in further FILE macros for other files, no new TST entry is created. Instead, the corresponding TFT entry simply receives a pointer to the TST entry and the file counter in the TST entry is incremented.
When tapes are swapped, DMS updates a pointer in the TST entry which points to the VSN of the tape containing the (current) end of the file set. It is thus unnecessary to search through the whole volume set for the end of the file set when a new file is added, and this reduces the number of tape swaps.
Several TSTs can be created in one job.
Example 1
Requesting a specific tape as the first tape of a volume set:
FILE AAA,LINK=OUTP,DEVICE=TAPE,VOLUME=000001,FSEQ=1,TSET=T
Example 2
Requesting any free tape:
FILE AAA,LINK=OUTP,DEVICE=TAPE,FSEQ=1,TSET=T[,VOLUME=PRIVATE]
Example 3
A file set is created as follows:
FILE A,LINK=A,DEVICE=TAPE,VOLUME=(VOL1,VOL2),FSEQ=1,TSET=SET1
The file set is now to be extended:
FILE C,LINK=C,DEVICE=TAPE,FSEQ=NEW,TSET=SET1,VOL=VOL3
Adding several files to a file set (command interface)
If certain that all of the files in a set will fit on one tape, the user can execute the following sequence of commands and program statements:
Command | Program |
---|---|
CREATE-FILE FILE-NAME=A,SUPPORT=TAPE( | Create output file A |
ADD-FILE-LINK LINK-NAME=A,FILE-NAME=A, | Open output file A
Close file A |
CREATE-FILE FILE-NAME=B,SUPPORT=TAPE( | Create output file B |
/ADD-FILE-LINK LINK-NAME=B,FILE-NAME=B, | Open output file B
Close file B |
CREATE-FILE FILE-NAME=C,SUPPORT=TAPE( | Create output file C |
ADD-FILE-LINK LINK-NAME=C,FILE-NAME=C, | Open output file C
Close file C |
If the size of a file in the file set cannot be predicted, the user could extend the volume sets in the CREATE-FILE command for files A, B and C as follows:
VOLUME=(000001,000002)
If file A extends onto the second tape, DMS requests the first tape again when it creates files B and C, in order to determine the end of the file set. If file A is so large that file B does not fit on the second tape, DMS requests a further scratch tape. After this, however, OPEN processing for file C will result in an error, because the file set ends on a tape which was not specified in the CREATE-FILE command and is thus not part of the volume set.
However, the user can link the file and volume sets temporarily by using the TAPE-SET-NAME operand of the ADD-FILE-LINK command. The user enters the name of a “tape set”, i.e. a temporary volume list which is maintained in the TST (tape set table), via the TAPE-SET-NAME operand. The TST is a table in which the VSNs of the tapes requested for a job are stored – linked via a TSET name.
In the following example, the file set A, B and C is again created.
Command | Program |
---|---|
CREATE-TAPE-SET TAPE-SET-NAME=SET1, VOLUME=000001 | Set up tape set SET1 |
CREATE-FILE FILE-NAME=A,SUPPORT=TAPE(DEVICE-TYPE=xyz) | Create output file A |
ADD-FILE-LINK LINK-NAME=A,FILE-NAME=A, | Open output file A
Close file A |
CREATE-FILE FILE-NAME=B,SUPPORT=TAPE(DEVICE-TYPE=xyz) | Create output file B |
ADD-FILE-LINK LINK-NAME=B,FILE-NAME=B, | Create output file B
Close file B |
CREATE-FILE FILE-NAME=C,SUPPORT=TAPE(DEVICE-TYPE=xyz) | Create output file C |
ADD-FILE-LINK LINK-NAME=C,FILE-NAME=A, | Open output file C
Close file C |
When a file is closed, the tape must be positioned to the end of the file.
All the files refer to the same TST entry and the files and the TST entry are linked via the TFT (Task File Table), which is created by means of a LINK-NAME operand for each file. DMS automatically organizes the structure of the file set on the common volume set.
The TST entry is constructed with the CREATE-TAPE-SET/EXTEND-TAPE-SET
commands. If the TAPE-SET-NAME specification is repeated in ADD-FILE-LINK
commands, no new TST entry is created. Instead, the corresponding TFT entry receives a pointer to the TST entry and the file counter in the TST entry is incremented.
When tapes are swapped, DMS updates a pointer in the TST entry which points to the VSN of the tape which contains the (current) end of the file set. It is thus unnecessary to search through the whole volume set for the end of the file set when a new file is added, and this reduces the number of tape swaps.
Example: creating a file set
By means of the following commands, the user requests a specific tape as the first tape of the volume set:
/CREATE-TAPE-SET TAPE-SET-NAME=T,VOLUME=000001 /CREATE-FILE FILE-NAME=A,SUPPORT=TAPE(DEVICE-TYPE=xyz) /ADD-FILE-LINK LINK-NAME=A,FILE-NAME=A,SUPPORT=*TAPE(VOLUME-LIST= *TAPE-SET(TAPE-SET-NAME=T),FILE-SEQUENCE=1
The user requests any scratch tape with the following command:
/CREATE-FILE FILE-NAME=A,SUPPORT=TAPE(VOLUME=*ANY,DEVICE-TYPE=xyz)
The file set can be extended by the commands:
/CREATE-FILE FILE-NAME=B,SUPPORT=TAPE(DEVICE-TYPE=xyz) /ADD-FILE-LINK LINK-NAME=B,FILE-NAME=B,SUPPORT=*TAPE(VOLUME-LIST= *TAPE-SET(TAPE-SET-NAME=T),FILE-SEQUENCE=*NEW
Example: extending a file set
A file set was created as follows:
/CREATE-TAPE-SET TAPE-SET-NAME=SET1, VOLUME=(000001,000002) /CREATE-FILE FILE-NAME=A,SUPPORT=TAPE(DEVICE-TYPE=xyz) /ADD-FILE-LINK LINK-NAME=A,FILE-NAME=A,SUPPORT=*TAPE(VOLUME-LIST=TAPE-SET (TAPE-SET-NAME=SET1),FILE-SEQUENCE=1)
The file set is now to be extended:
/CREATE-TAPE-SET TAPE-SET-NAME=SET2, VOLUME=000003 /CREATE-FILE FILE-NAME=C,SUPPORT=TAPE(DEVICE-TYPE=xyz) /ADD-FILE-LINK LINK-NAME=C,FILE-NAME=C,SUPPORT=*TAPE(VOLUME-LIST=TAPE-SET (TAPE-SET-NAME=SET2),FILE-SEQUENCE=*NEW)