Lock file link name against deletion
Component: | BS2000 |
Functional area: | File processing |
Domain: | FILE |
Privileges: | STD-PROCESSING |
Function
The LOCK-FILE-LINK command locks an entry in the task file table (TFT), so that any subsequent REMOVE-FILE-LINK command for this TFT entry will be ineffective until an UNLOCK-FILE-LINK command is issued with the associated file link name.
If the file link name is amended by a CHANGE-FILE-LINK command, the TFT entry will remain locked, but now under the new file link name.
The ADD-FILE-LINK command can be used at any time to amend a TFT entry which has been locked by LOCK-FILE-LINK, but the lock will remain in effect.
Volumes from a TFT entry that is locked using LOCK-FILE-LINK are not released by the SECURE-RESOURCE-ALLOCATION command.
Format
LOCK-FILE-LINK |
LINK-NAME = *FIRST-BLANK / <filename 1..8 without-gen> |
Operands
LINK-NAME = *FIRST-BLANK / <filename 1..8 without-gen>
The file link name of the TFT entry which is to be locked.
If there is no TFT entry with this file link name, an entry will be created. This entry can then be allocated to a file by an ADD-FILE-LINK command or via the FCB and have its contents written into it.
LINK-NAME = *FIRST-BLANK
If *FIRST-BLANK is specified, the first TFT entry whose file link name consists of spaces (blanks) will be processed.
LINK-NAME = <filename 1..8 without-gen>
File link name of the TFT entry which is to be locked.
Return codes
(SC2) | SC1 | Maincode | Meaning |
---|---|---|---|
0 | CMD0001 | Command executed | |
1 | CMD0202 | Syntax or semantic error in command | |
32 | DMS05C7 | Unexpected internal error in DMS | |
64 | DMS06FF | BCAM connection severed | |
130 | DMS0594 | Not enough virtual memory available |
Example
Locking file link names to prevent deletion
/add-file-link link=sortin,file-name=max.file.10 ———————————————— (1)
/add-file-link link=sortout,file-name=max.file.10.sort-1 ———————————————— (2)
/show-file-link ———————————————— (3)
% %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTIN :2OS2:$USER1.MAX.FILE.10 % SORTOUT :2OS2:$USER1.MAX.FILE.10.SORT-1
/sort-file ———————————————— (4)
':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/BS 2000V20.0 % SRT1130 PLEASE ENTER SORT STATEMENTS % SRT1016 SORT/MERGE INPUT RECORDS:............................2.924 (FROM 01) % SRT1030 SORT/MERGE OUTPUT RECORDS:...........................2.924 % SRT1002 2017-03-03/18:19:43/000000.09 SORT/MERGE COMPLETED
/show-file-link ———————————————— (5)
% %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTOUT :2OS2:$USER1.MAX.FILE.10.SORT-1
/add-file-link link=sortin,file-name=max.file.10 ———————————————— (6)
/lock-file-link link=sortin ———————————————— (7)
/show-file-link inf=(status=*yes) ———————————————— (8)
% %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTIN :2OS2:$USER1.MAX.FILE.10 % -------------------- STATUS ---------------------------------------------- % STATE = INACTIVE ORIGIN = FILE LOCK-F-LI = YES %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTOUT :2OS2:$USER1.MAX.FILE.10.SORT-1 % -------------------- STATUS ---------------------------------------------- % STATE = INACTIVE ORIGIN = FILE
/sort-file ———————————————— (9)
':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/BS 2000V20.0 % SRT1130 PLEASE ENTER SORT STATEMENTS % SRT1016 SORT/MERGE INPUT RECORDS:............................2.924 (FROM 01) % SRT1030 SORT/MERGE OUTPUT RECORDS:...........................2.924 % SRT1002 2017-03-03/18:19:43/000000.09 SORT/MERGE COMPLETED
/show-file-link inf=(status=*yes) ——————————————— (10)
% %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTIN :2OS2:$USER1.MAX.FILE.10 % -------------------- STATUS ---------------------------------------------- % STATE = INACTIVE ORIGIN = FILE LOCK-F-LI = YES % REM-F-LINK = YES RELE-DEV = YES UNL-R-TAPE = NO %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTOUT :2OS2:$USER1.MAX.FILE.10.SORT-1 % -------------------- STATUS ---------------------------------------------- % STATE = INACTIVE ORIGIN = FILE
/add-file-link link=sortout,file-name=max.file.10.sort-2 ——————————————— (11)
/sort-file fields=(field-explicit(pos=5,length=6,sort-order=*ascend),
field-explicit(pos=20,length=15,sort-order=*descend)) —————————————— (12)
':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 RESE RVED % SRT1001 2017-03-03/18:19:43/000000.00 SORT/MERGE STARTED, VERSION 08.0A00/BS 2000V20.0 % SRT1130 PLEASE ENTER SORT STATEMENTS % SRT1016 SORT/MERGE INPUT RECORDS:............................2.924 (FROM 01) % SRT1030 SORT/MERGE OUTPUT RECORDS:...........................2.924 % SRT1002 2017-03-03/18:19:43/000000.09 SORT/MERGE COMPLETED
/show-file-link inf=(status=*yes) —————————————— (13)
% %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTIN :2OS2:$USER1.MAX.FILE.10 % -------------------- STATUS ---------------------------------------------- % STATE = INACTIVE ORIGIN = FILE LOCK-F-LI = YES % REM-F-LINK = YES RELE-DEV = YES UNL-R-TAPE = NO %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTOUT :2OS2:$USER1.MAX.FILE.10.SORT-2 % -------------------- STATUS ---------------------------------------------- % STATE = INACTIVE ORIGIN = FILE
/unlock-file-link link=sortin ——————————————— (14)
/show-file-link ——————————————— (15)
% %-- LINK-NAME --------- FILE-NAME --------------------------------------------- % SORTOUT :2OS2:$USER1.MAX.FILE.10.SORT-2
/remove-file-link link=sortout ——————————————— (16)
/show-file-link ——————————————— (17)
% DMS05E1 TASK FILE TABLE (TFT) NOT AVAILABLE OR SPECIFIED FILE NOT IN 'TFT'. OPERATION NOT PROCESSED
(1) | Creates a TFT entry for the file MAX.FILE.10 under the link name SORTIN. This link name is used by the SORT utility routine as the default link name for an input file. |
(2) | Creates a TFT entry for the file MAX.FILE.10.SORT-1 under the link name SORTOUT. This link name is used by the SORT utility routine as the default link name for an output file. |
(3) | Output of the TFT entries using SHOW-FILE-LINK. |
(4) | The SORT-FILE command is used to sort records of the file MAX.FILE.10 into the file MAX.FILE.SORT-10. This command is a component of the SORT utility routine and provides specific sort functions at the command level (see the “SORT” manual [40]). The command was called without operands, i.e. with default values, so the complete record is sorted; the input file is determined from the TFT entry with the link name SORTIN, and the output file from the TFT entry with the link name SORTOUT. |
(5) | The output of TFT entries shows that the entry with the link name SORTIN was automatically released after sorting (implicit REMOVE-FILE-LINK). |
(6) | A TFT entry with the link name SORTIN is created again for the file MAX.FILE.10. |
(7) | The TFT entry with the link name SORTIN is now locked with the LOCK-FILE-LINK command. This means that the TFT entry cannot be deleted so long as the lock remains in effect. The file MAX.FILE.10 may be used as an input file more than once for sort runs. |
(8) | Output of the TFT entries with the status of the file link. |
(9) | The command SORT-FILE is called again (as in step 4). |
(10) | Output of the TFT entries with the status of the file link. The TFT entry for SORTIN still exists. The value of YES in the REM-F-LINK output field indicates that a REMOVE-FILE-LINK was issued for this entry (in this case, the implicit REMOVE-FILE-LINK of SORT). |
(11) | Creates a new TFT entry for the file MAX.FILE.10.SORT-2 with the link name SORTOUT. This file is to be used as the new output file for a sort run. |
(12) | The SORT-FILE command is called. The input file is still MAX.FILE.10, but the output file is now MAX.FILE.10.SORT-2. In this sort run, only selected parts of records are to be sorted and transferred to the output file (selective sort): 6 bytes as of the first data byte (record length field + 1 = 5) are sorted in ascending order. The second sort criterion selects 15 bytes of the record, starting with the 17th byte, and to be sorted in descending order. |
(13) | Output of the TFT entries with the status of the file link (as in step 10). |
(14) | The lock for the TFT entry with the link name SORTIN is released by the UNLOCK-FILE-LINK command. |
(15) | (implicit) REMOVE-FILE-LINK commands were executed only after the lock was removed. |
(16) | The TFT entry for SORTOUT is released explicitly with the REMOVE-FILE-LINK command. |
(17) | No further TFT entries exist. |