At times we need to reference all the generations of a GDG and it is important to know which generation is read first if GDG base is given as input in JCL. It is also one of the tricky interview questions asked about GDGs. Here comes the concept of using GDGORDER in JCL. By default system catalog entry specifies LIFO(Last in, First out).
Lets execute a JCL and see it’s output to understand the concept better. We will use IEBGENER to concatenate the GDG versions. The output will be printed in SYSUT2 in spool. But we can see the order of the GDG versions in JESYSMSG. Please use MSGLEVEL=(1,1) to print all the statements, allocation and termination messages, otherwise we wont be able to see the order of the GDG versions used.

The JESYSMSG will show as below. File names are blurred on purpose, but what is evident is the sequence XX91V00 to XX87V00, ie by default it has concatenated New to Old (LIFO).

The same Job with the keyword GDGORDER=FIFO will reverse the order of concatenation of the GDG versions.

The output shows the following, ie the order of concatenation is Old to New, FIFO

Hope this helps!
Leave a comment