Tuesday, August 24, 2021

What is LLA and VLF

VLF (Virtual Lookaside Facility) is an OS/390 facility that stores objects and retrieves copies when requested. In a sense it is a server. LLA is a facility that improves module fetch time by storing the module pointer in VLF. Before MVS fetches a module from disk, it asks LLA (which, in turn asks VLF) if it has a copy of the module.

VLF keeps its objects in separate address spaces; these use expanded storage (if available) or central storage and are pageable. LLA is a client of the VLF service, and deals only with load modules. Other VLF clients deal with RACF profiles, and so forth.

Member COFVLFxx in PARMLIB contains a list of all the users of VLF. LLA is one such user. Member CSVLLAxx in PARMLIB contains a list of all libraries (and/or library members) that are managed by LLA. If this member does not exist, then all LNKLST libraries are managed by default (assuming that COFVLFxx contains a statement for the CSVLLA class, to enable LLA).

The MVS operator command D LLA will display all the libraries currently managed by LLA. The list it produces is rather long, and is best used with the SDSF log display. If you change a library (add or alter a member) that is managed by LLA, you should issue the MVS operator command F LLA,REFRESH to update the LLA information. Until you do this, the system (via LLA) will continue to use the old module.

VLF and LLA are perhaps not as well documented as a new system user would like, but more information can be found in the OS/390 Initialization and Tuning Guide. You can use LLA to make your programs load faster by adding your load module library to the LLA list. This makes sense if your program is (a) fetched hundreds of times each day, (b) is not in LPA, and (c) is not in LNKLST.

Thursday, August 12, 2021

SORT table or array using COBOL SORT statement

COBOL SORT statement can also be used for sorting tables (arrays). It sorts table elements according to specified table keys.

Below is a sample program to sort a table
 
WORKING-STORAGE SECTION.                                  
01 WS-FILLER.                                             
    05 WS-TBL  OCCURS 10  TIMES.                          
        10 WS-USE-CNT     PIC 9(4)   COMP.                
01 WS-I                   PIC 9(4)   COMP.                
PROCEDURE DIVISION.                                       
   MOVE 112  TO WS-USE-CNT (1)                            
   MOVE 13   TO WS-USE-CNT (2)                            
   MOVE 55   TO WS-USE-CNT (3)                            
   MOVE 15   TO WS-USE-CNT (4)                             
   MOVE 16   TO WS-USE-CNT (5)                            
   MOVE 3    TO WS-USE-CNT (6)                            
   MOVE 43   TO WS-USE-CNT (7)                            
   MOVE 78   TO WS-USE-CNT (8)                             
   MOVE 34   TO WS-USE-CNT (9)                            
   MOVE 46   TO WS-USE-CNT (10)                           
   SORT WS-TBL ASCENDING WS-USE-CNT                       
   PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I > 10       
      DISPLAY WS-USE-CNT (WS-I)                           
   END-PERFORM                                            
   GOBACK.
 
Output of the above code is
 
0003
0013
0015
0016
0034
0043
0046
0055
0078
0112
 
Another example is given below
 
WORKING-STORAGE SECTION.
01 GROUP-ITEM.
05 TABL OCCURS 10 TIMES
10 ELEM-ITEM1 PIC X.
10 ELEM-ITEM2 PIC X.
10 ELEM-ITEM3 PIC X.
...
PROCEDURE DIVISION.
...
SORT TABL DESCENDING ELEM-ITEM2 ELEM-ITEM3.