What information does DMS need when opening a file?
Which file is to be opened?
Does the calling job fulfill the conditions imposed by the protection attributes of the file (e.g. passwords)? Please refer to chapter "File and data protection"
With which access method is the file to be processed? How is the file organized (block size, record length, etc.)?
Is the file to be opened as an input file or an output file? If it is to be an output file, is it to be replaced or extended?
In which part of the address space are the data buffers to be created: in user memory (class 6) or in system memory (class 5)?
How are the records to be passed to the job and received from the job? Is the address at which the logical record begins in the buffer to be passed (locate mode) or is the record to be passed in a user area (move mode)?
May other jobs access this file at the same time (shared update processing)?
If the file exists or is to be created on private volumes, which private volumes are required?
At which address is processing to be continued in the program in the case of an error or other event to which the program must react?
Where does DMS find the necessary information?
In the TFT entry which contains the same file link name as the file control block of the program (FCB; the TFT entry is created by using the LINK-NAME operand in the ADD-FILE-LINK command or the LINK operand in the FILE macro). The TFT is the central administration table of DMS.
In the file control block (FCB), i.e. the file declaration in the program (if no appropriate specification can be found in the TFT or if no TFT is available). If no TFT is present, the file name must be entered in the file control block (FILE operand of the FCB macro).
In the catalog entry for the file.
In the password table of the job. The password can be specified in the PASS operand of the FCB macro or in the ADD-PASSWORD command.
The OPEN mode is specified in the OPEN macro (which has priority over the information in the TFT and the FCB).
The following applies to information which is available from more than one source:
Specifications for the OPEN mode in the OPEN call have precedence over information in the TFT and FCB (there is no catalog entry for OPEN mode).
Specifications in the TFT override the specifications in the file control block and the catalog entry.
Specifications in the file control block (FCB) override those in the catalog entry.
If the null operand was used in the FILE or FCB macro or the operand value *BY-CATALOG was defined for an operand in the ADD-FILE-LINK command, the corresponding values from the catalog entry are used.
Fields which are transferred from the TFT entry to the FCB:
- BLIM
- BLKSIZE
*)
- BLKCTRL
*)
- BUFOFF
*)
- CHAINIO
- CHKPT
- CLOSE
- CLOSMSG
- CODE
- DUPEKY
- FCBTYPE
*)
- FILEFSEQ
*)
- IOPERF
*)
- IOUSAGE
*)
- KEYLEN
*)
- KEYPOS
*)
- LABEL
- LARGE_FILE
- LINK
- LOCKENV
- LOGLEN
*)
- POOLLNK
- OPEN
- OVERLAP
- PAD
- RECFORM
*)
- RECSIZE
*)
- RETPD
- SECLEV
- SHARUPD
- TAPEWR
- TPMARK
- TRANS
- VALLEN
*)
- VALPROP
*)
- WRCHK
- WROUT
DMS always takes the information about the retention period for an existing file directly from the catalog entry or from the HDR1 label.
If the specifications in the TFT (FILE macro, ADD-FILE-LINK command) and the FCB conflict with the contents of the catalog entry, DMS aborts the open operation with an error code.
FCB (file control block)
The file control block describes the file and/or the file attributes in a user program. An FCB can be created or modified at the following stages:
Before opening the file: by means of the FCB macro when the program is written: this macro reserves storage space for the file control block and optionally supplies it with information.
During the program run and prior to opening the file: by directly supplying the fields of the FCB with current values. Support for this is provided by the IDFCB and IDFCBE macros, which generate a DSECT for the FCB.
When the file is being opened, the user has the option of checking, and possibly modifying the file control block after certain processing steps performed by the OPEN routine (EXLST macro, operands OPENX and OPENZ).
As long as a file remains open, the file control block contains all the information describing the current status of the file. This information is of significance to the user if an error occurs and has to be analyzed in the program (see the EXIT operand of the FCB macro and the EXLST macro). The file control block then contains a DMS error code and an identifier for the error exit.
Information sources for DMS