BS2000 provides the CREATE-FILE command for creating files. A task file table entry with further file attributes is created by means of the ADD-FILE-LINK command. The complete format for this command and a detailed description are provided in “Commands” manual [3] and “Introductory Guide to DMS” [4].
Catalog entry
When file attributes are defined with the CREATE-FILE command it must be ensured that the primary memory allocation is sufficient.
This is particularly true in the case of files in which the block size exceeds the primary allocation which the operating system assumes by default. The block size is calculated from the specification in the COBOL program (see “COBOL2000 Reference Manual” [1]). If the COBOL program yields a block length of (STD, n), the PRIMARY-ALLOCATION in the SPACE operand of the CREATE-FILE command should be at least
2n for sequential files.
2n+2 for indexed and relative files.
Task file table (TFT)
Whenever a ADD-FILE-LINK command with the operand
LINK-NAME=linkname
is issued for a file, the DMS creates an entry for the file under this link name in the task file table (TFT) and stores all file attributes explicitly defined in the ADD-FILE-LINK command under this entry.
Each of these entries is retained in the TFT until it is
removed by a REMOVE-FILE-LINK command for the assigned file link name, or deleted together with the TFT at the end of the task, or
overwritten by a new ADD-FILE-LINK command for the same file link name.
Information on the current contents of the TFT can be obtained by using the SHOW-FILE-LINK command.
When a COBOL program attempts to open a file, the DMS first checks whether the TFT contains the link name that was defined for the file at compilation (see section "Assignment of cataloged files"). If such an entry is found, the program takes over file attributes from
the TFT entry under this link name,
the file attributes that were explicitly or implicitly specified in the program, and
the catalog entry of the associated file.
The specifications from the TFT entry (i.e. file attributes explicitly defined in the ADD-FILE-LINK command) overwrite file specifications from the COBOL program. The catalog entry is referred to only for file attributes that are defined neither in the program nor in the TFT entry or those that were specified as null operands in the ADD-FILE-LINK command.
This approach could lead to conflicts during file access, especially when file attributes specified in the ADD-FILE-LINK command are not compatible with the (explicitly or implicitly) defined characteristics in the COBOL program or in the catalog entry of the assigned file. This is especially applicable in the following situations:
Conflicting entries on the open mode
COBOL program
ADD-FILE-LINK command
OPEN INPUT...[REVERSED]
OPEN-MODE=OUTPUT or OPEN-MODE=EXTEND
OPEN OUTPUT
OPEN-MODE=INPUT or OPEN-MODE=REVERSE
OPEN EXTEND
OPEN-MODE=INPUT or OPEN-MODE=REVERSE
Conflicting entries on the organization type of the file
COBOL program
ADD-FILE-LINK command
ASSIGN clause
ORGANIZATION clauseACCESS-METHOD operand
Conflicting entries on the record format
COBOL program
ADD-FILE-LINK command
RECORD clause
RECORDING MODE clauseRECORD-FORMAT operand
Conflicting entries on the record length
COBOL program
ADD-FILE-LINK command
RECORD clause
record description entryRECORD-SIZE operand
Conflicting entries on the record key
COBOL program
ADD-FILE-LINK command
RECORD KEY clause
record description entryKEY-POSITION operand
KEY-LENGTH operandConflicting entries on the disk format or file format
Catalog entry
ADD-FILE-LINK command
BLK-CONTR =
BUF-LEN =BLOCK-CONTROL-INFO operand
BUFFER-LENGTH operand
Example 9-4
Creating and displaying a TFT entry
(shown in BS2000/OSD V5.0)
/ADD-FILE-LINK INOUTFIL,ISAM.UPDATE, - (1) / BUFFER-LENGTH=*BY-CATALOG, | SUPPORT=*DISK(SHARED-UPDATE=*YES) (1) /SHOW-FILE-LINK INOUTFIL,INFORMATION=*ALL ——————————————————————— (2)
LINK-NAME ————————— FILE-NAME ————————————————————————————————————————————— INOUTFIL :N:$F2190202.ISAM.UPDATE ———————————————————— STATUS ——————————————————————————————————————————————— STATE = INACTIVE ORIGIN = FILE ———————————————————— PROTECTION ——————————————————————————————————————————— RET-PER = *BY-PROG PROT-LEV = *BY-PROG BYPASS = *BY-PROG DESTROY = *BY-CAT ———————————————————— FILE-CONTROL-BLOCK - GENERAL ATTRIBUTES —————————————— ACC-METH = *BY-PROG OPEN-MODE = *BY-PROG REC-FORM = *BY-PROG REC-SIZE = *BY-PROG BUF-LEN = *BY-CAT BLK-CONTR = *BY-PROG F-CL-MSG = STD CLOSE-MODE = *BY-PROG ———————————————————— FILE-CONTROL-BLOCK - DISK FILE ATTRIBUTES ———————————— SHARED-UPD = YES WR-CHECK = *BY-PROG IO(PERF) = *BY-PROG IO(USAGE) = *BY-PROG LOCK-ENV = *BY-PROG ———————————————————— FILE-CONTROL-BLOCK - TAPE FILE ATTRIBUTES ———————————— LABEL = *BY-PROG (DIN-R-NUM = *BY-PROG, TAPE-MARK = *BY-PROG) CODE = *BY-PROG EBCDIC-TR = *BY-PROG F-SEQ = *BY-PROG CP-AT-BLIM = *BY-PROG CP-AT-FEOV = *BY-PROG BLOCK-LIM = *BY-PROG REST-USAGE = *BY-PROG BLOCK-OFF = *BY-PROG TAPE-WRITE = *BY-PROG STREAM = *BY-PROG | ———————————————————— FILE-CONTROL-BLOCK - ISAM FILE ATTRIBUTES ———————————— KEY-POS = *BY-PROG KEY-LEN = *BY-PROG POOL-LINK = *BY-PROG LOGIC-FLAG = *BY-PROG VAL-FLAG = *BY-PROG PROPA-VAL = *BY-PROG DUP-KEY = *BY-PROG PAD-FACT = *BY-PROG READ-I-ADV = *BY-PROG WR-IMMED = *BY-PROG ———————————————————— VOLUME ——————————————————————————————————————————————— DEV-TYPE = *NONE T-SET-NAME = *NONE VSN/DEV = PUBN03/D3480
(1) | The ADD-FILE-LINK command assigns the link name INOUTFIL to the file ISAM.UPDATE and defines
The DMS creates a TFT entry under the name INOUTFIL and stores these specifications in it. |
(2) | The SHOW-FILE-LINK command outputs the contents of the TFT entry for INOUTFIL with the operand values. Note that the values
are derived from the specifications in the ADD-FILE-LINK command. The remaining operands were not explicitly defined and thus have the default values *BY-PROG or *NONE. |