Wednesday, December 27, 2023

Changing the order of GDG concatenation

GDGORDER keyword specifies the order in which the individual generation data sets (GDSs) will be concatenated.

 

The values of Parameter are USECATLG, LIFO and FIFO.

 

USECATLG - The GDS concatenation is ordered as specified in the GDG data set catalog entry. When the GDGORDER keyword is not specified, the concatenation order from the catalog definition of the GDG data set is used. However, the default setting in the catalog entry for a GDG base data set definition is LIFO, to match the setting for releases prior to z/OS V2.1.

 

LIFO - The GDS concatenation is ordered with the newest GDS defined first and the oldest GDS last.

 

FIFO - The GDS concatenation is ordered with the oldest GDS defined first and the newest GDS last.

 

Let us explore this with an example. Suppose USERID.GDG has three generations as shown below.

 

 BROWSE    USERID.GDG.G0001V00                      Line 0000000000 Col 001 080

 Command ===>                                                  Scroll ===> CSR 

********************************* Top of Data **********************************

GDG1                                                                          

******************************** Bottom of Data ********************************

 

 BROWSE    USERID.GDG.G0002V00                      Line 0000000000 Col 001 080

 Command ===>                                                  Scroll ===> CSR 

********************************* Top of Data **********************************

GDG2                                                                          

******************************** Bottom of Data ********************************

 

 BROWSE    USERID.GDG.G0003V00                      Line 0000000000 Col 001 080

 Command ===>                                                  Scroll ===> CSR 

********************************* Top of Data **********************************

GDG3                                                                          

******************************** Bottom of Data ********************************

 

 

Case 1: When the GDGORDER keyword is not specified

 

The below step copies all the generations of GDG to SORTOUT.

 

//STEP1    EXEC PGM=SORT                             

//SORTIN   DD DISP=SHR,DSN=USERID.GDG                 

//SORTOUT  DD SYSOUT=*                               

//SYSOUT   DD SYSOUT=*                                 

//SYSIN    DD *                                         

 OPTION COPY                                         

//*                

 

Below is the output of the above step. The effect is LIFO

 

 BROWSE - SORTOUT           STEP1    - Page  1      Line  1        Cols 1-80   

 COMMAND ===>                                                SCROLL ===> CURSOR

******************************** Top of Data ***********************************

GDG3                                                                           

GDG2                                                                           

GDG1                                                                           

 ******************************* Bottom of Data ********************************

            

Case 2: When GDGORDER=FIFO

 

The below step copies all the generations of GDG to SORTOUT.

            

//STEP2    EXEC PGM=SORT                             

//SORTIN   DD DISP=SHR,DSN=USERID.GDG,GDGORDER=FIFO   

//SORTOUT  DD SYSOUT=*                               

//SYSOUT   DD SYSOUT=*                                 

//SYSIN    DD *                                         

 OPTION COPY                                         

//*                                                  

 

Below is the output of the above step.

 

 BROWSE - SORTOUT           STEP2    - Page  1      Line  1        Cols 1-80   

 COMMAND ===>                                                SCROLL ===> CURSOR

******************************** Top of Data ***********************************

GDG1                                                                           

GDG2                                                                           

GDG3                                                                           

 ******************************* Bottom of Data ********************************