Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Access via the file link name

If a program is to process files, DMS must be able to establish a connection between the program and the file(s). This is done either by means of a file name which is specified in the program or via a file link name within the program, which must then be assigned to an actual file before the file is opened. Access via a file name specified in a program is carried out as described on "Access via the path name". However, this method has certain drawbacks: the program loses flexibility, and the source code has to be modified if the file name is changed. Output files created in this manner must be renamed or recataloged to prevent them from being overwritten the next time the program is run. If input files are specified in this manner, the program can process only the specified file(s) unless they are repeatedly recataloged. Furthermore, the programmer needs to know the actual file name when he writes the program, a problem that is made worse by the fact that a program is often written for different users and/or different applications.

A file and a program should therefore be linked flexibly with the aid of an internal name within the program, the file link name. A file is assigned a file link name (= link name) by means of an entry in the job-specific task file table (TFT); this entry is created by means of the FILE macro (LINK operand) or the ADD-FILE-LINK command (LINK-NAME operand). This assignment can be canceled (RELTFT macro or REMOVE-FILE-LINK command) or changed (FILE/CHNGE macros or the CHANGE-FILE-LINK/ADD-FILE-LINK commands) at any time, provided the TFT entry is inactive.

TFT entries can be protected against deletion by means of the LOCK-FILE-LINK command; this will cause any REMOVE-FILE-LINK command or RELTFT macro to be suspended for these entries. Locked TFT entries can be unlocked again by means of the DROPTFT macro or the UNLOCK-FILE-LINK command. Any REMOVE-FILE-LINK command or RELTFT macro for this entry which has been suspended is now processed, i.e. the TFT entry will be deleted as specified in the command/macro and the associated private volumes will be released.

The fields in the TFT entry describe the file and processing attributes for the file currently being processed. All fields whose associated operands are specified in the macro or command which creates or uses the TFT entry are supplied with data.

When the file is opened, specifications in the TFT entry override the corresponding fields in the file control block created by means of the FCB macro. Fields in the TFT entry which contain the value “*BY-CAT” or “*BY-CATALOG” (so-called “NULL operands”, see below) are treated specially.

All attributes which are neither specified in the TFT entry nor declared in the file control block are set to default values by DMS.

Figure 4: Compiling file attributes

The user can display the structure and the contents of the TFT entries at any time by means of the RDTFT macro or the SHOW-FILE-LINK command. The default function of the macro and the command tells the user which TFT entries were created for the current job. However, the user can also request information about specific TFT entries.

TFT entries are stored in the order in which they were created by the macros and/or commands and are searched sequentially whenever the table is accessed. Entries which are no longer needed should therefore be deleted, as the number of TFT entries affects system performance.

Software products such as utility routines, file editors, etc. often use their own file link names; these are described in the appropriate manuals.

Null operands

When processing existing files, the user can use the null operand function. This function ensures that the file control block contains the correct information at OPEN time. Many of the operands in the FILE/ FCB macros and the ADD-FILE-LINK command which describe file attributes may be specified as null operands in the macro (i.e. with a null string as the operand value) or in the command (by means of the operand value “*BY-CATALOG”). The corresponding field of the TFT entry then contains the value “BY-CAT”. When the file is opened, DMS transfers the corresponding values from the catalog entry to the file control block.

If a command or macro specifies specific file attributes for an existing file, the new entries must be compatible with those in the catalog. Compatibility between the FCB and the catalog does not mean that the corresponding values must be the same. For example, it is possible for SAM/ISAM files to be processed using the UPAM access method (access method specified in the FCB is PAM).

Example 1: File link name – sorting with the SORT utility routine

The contents of the file DATEN.UNSORT are to be sorted with the SORT utility and the output file is to be called DATEN.SORT. This file is then to be printed by the program DRUCK as an edited listing with the name LISTE. By default, the SORT utility uses the file link names SORTIN and SORTOUT, while the program DRUCK uses the file link names LISTEIN and LISTAUS.

/show-file-attributes daten.unsort  ———————————————————————————————————  (1) 
%      12 :2OS2:$USER1.DATEN.UNSORT
%:2OS2: PUBLIC:      1 FILE  RES=       12 FRE=        7 REL=       6 PAGES
/add-file-link link-name=sortin,file-name=daten.unsort ————————————————  (2) 
/add-file-link link-name=sortout,file-name=daten.sort —————————————————  (3) 
/show-file-link   —————————————————————————————————————————————————————  (4) 
%
%-- LINK-NAME --------- FILE-NAME -------------------------------------------
%   SORTIN              :2OS2:$USER1.DATEN.UNSORT
%   SORTOUT             :2OS2:$USER1.DATEN.SORT
/start-sort  ——————————————————————————————————————————————————————————  (5) 
%  BLS0523 ELEMENT 'SRT80', VERSION '079', TYPE 'L' FROM LIBRARY 
':1OSH:$TSOS.SYSLNK.SORT.080' IN PROCESS
%  BLS0524 LLM 'SRT80', VERSION '08.0A00' OF '2015-02-03 13:07:17' LOADED
%  BLS0551 COPYRIGHT (C) 2014 FUJITSU TECHNOLOGY SOLUTIONS GMBH. ALL RIGHTS 
RESERVED
%  SRT1001  2017-03-03/18:19:43/000000.00 SORT/MERGE STARTED, VERSION 
08.0A00/BS2000V20.0
%  SRT1130  PLEASE ENTER SORT STATEMENTS
*sort fields=(10,5,a,ch)
*record length=100
*end
%  SRT1222  WARNING: RECORD SIZE OF INPUT FILE NOT EQUAL TO <LENGTH1>. 
            <LENGTH1> WILL BE IGNORED
%  SRT1016  SORT/MERGE INPUT RECORDS:...........................101 (FROM 01)
%  SRT1030  SORT/MERGE OUTPUT RECORDS:.............................101
%  SRT1002  09:49:11/000000.16 SORT/MERGE COMPLETED 
/show-file-link ———————————————————————————————————————————————————-————  (6) 
%
%-- LINK-NAME --------- FILE-NAME -------------------------------------------
%   SORTOUT             :2OS2:$USER1.DATEN.SORT
/change-file-link link-name=sortout,new-name=listein ——————————————-————  (7) 
/add-file-link link-name=listaus,file-name=liste   —————————————————————  (8) 
/show-file-link   ——————————————————————————————————————————————————————  (9) 
%
%-- LINK-NAME --------- FILE-NAME -------------------------------------------
%   LISTAUS             :2OS2:$USER1.LISTE
%   LISTEIN             :2OS2:$USER1.DATEN.SORT
/start-prog from-file=druck ——————————————————————————————————————————— (10) 
%  BLS0517 MODULE 'DRUCK' LOADED
:
: *** Create output list in DRUCK program *** 
:
*** PROGRAM DRUCK TERMINATED ***
/remove-file-link link-name=listein ——————————————————————————————————— (11) 
/remove-file-link link-name=listaus ——————————————————————————————————— (12) 
/show-file-link ——————————————————————————————————————————————————————— (13) 
%  DMS05E1 TASK FILE TABLE (TFT) NOT AVAILABLE OR SPECIFIED FILE NOT IN 
           'TFT'. OPERATION NOT PROCESSED 

(1)    

The file “DATEN.UNSORT” contains data .

(2)

Link the input file to the SORT utility routine.

(3)

Link the output file to the SORT utility routine.

(4)

Display the TFT entries.

(5)

Call the SORT utility.

“*” Enter the sort statements.

"% SRT..." messages from the SORT utility routine.

(6)

Display the TFT entries: the TFT entry for the SORT input file, SORTIN, has been released by the SORT utility.

(7)

Change the link name: the output file from the SORT utility routine (SORTOUT) is renamed as the input file (LISTEIN) for the DRUCK program.

(8)

Create a TFT entry for the PRINT output file.

(9)

Display the TFT entries.

(10)

Start the PRINT program.

(11)

Delete the TFT entries for the DRUCK input file (LISTEIN).

(12)

Delete the TFT entries for the DRUCK output file (LISTAUS).

(13)

The SHOW-FILE-LINK command now shows that all the TFT entries for this job have been deleted.

Example 2: Transfer of applicable values from the catalog entry

/sh-f-attr lst.bsp.2,inf=par(org=yes)
%0000000003 :2OS2:$USER1.LST.BSP.2
% ------------------ ORGANIZATION -------------------------------------------
% FILE-STRUC = SAM         BUF-LEN    = STD(1)      BLK-CONTR  = PAMKEY
% IO(USAGE)  = READ-WRITE  IO(PERF)   = STD         DISK-WRITE = IMMEDIATE
% REC-FORM   = (V,M)       REC-SIZE   = 0
% AVAIL      = *STD
% WORK-FILE  = *NO         F-PREFORM  = *K          S0-MIGR    = *ALLOWED
%:2OS2: PUBLIC:      1 FILE  RES=        3 FRE=         2 REL=        0 PAGES
/add-file-link link=edtsam,file-name=lst.bsp.2,access-method=*by-cat,
rec-form=*by-cat,buffer-length=*by-cat,block-contr-info=*by-cat
/show-file-link link=edtsam,inf=all
%-- LINK-NAME --------- FILE-NAME -------------------------------------------
%   EDTSAM              :2OS2:$USER1.LST.BSP.2
%  -------------------- 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-CAT     OPEN-MODE  = *BY-PROG    REC-FORM   = *BY-CAT
%  REC-SIZE   = *BY-PROG    BUF-LEN    = *BY-CAT     BLK-CONTR  = *BY-CAT
%  F-CL-MSG   = STD         CLOSE-MODE = *BY-PROG
%  -------------------- FILE-CONTROL-BLOCK - DISK FILE ATTRIBUTES ----------
%  SHARED-UPD = *BY-PROG    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    POOL-SIZE  = *BY-PROG
%  -------------------- VOLUME ---------------------------------------------
%  DEV-TYPE   = *NONE       T-SET-NAME = *NONE
%  VSN/DEV    = GVS2.5/D3435 

The operands ACCESS-METHOD, RECORD-FORMAT, BUFFER-LENGTH and BLOCK-CONTR-INFO are specified as “BY-CATALOG” in the ADD-FILE-LINK command, since the applicable values are to be taken from the catalog entry when the file is opened. During processing, these values are copied from the catalog entry to the file LST.BSP.2 via the link name EDTSAM. The TFT entry has the value “*BY-CAT” in the corresponding fields.