CategoryJCL

Overriding Concatenated Datasets in JCL

Lets assume that you have a PROC with the following step which has 5 concatenated steps.

//STEP010 EXEC PGM=PROGRAM1
//INPUTF      DD DSN=INPUT.FILE1,DISP=SHR
//            DD DSN=INPUT.FILE2,DISP=SHR
//            DD DSN=INPUT.FILE3,DISP=SHR
//            DD DSN=INPUT.FILE4,DISP=SHR
//            DD DSN=INPUT.FILE5,DISP=SHR

In the JCL which calls the above mentioned PROC, you want to override only one of the 5 concatenated files from PROC. For example, you want to override the 3rd concatenated file with another file called INPUT.NEWFILE in the JCL.

This can be accomplished by using the below code in your JCL where you want to override the file.

//STEP010.INPUTF   DD
//                 DD
//                 DD DSN=INPUT.NEWFILE,DISP=SHR
//                 DD
//                 DD

Please not that you can not use DUMMY statement, as the usage of DUMMY signifies END OF FILE statement and will ignore the next coming files.

GDG – A Basic Introduction

Introduction
  • GDG stands for Generation Data Group. Here a group of files are related functionally or chronologically and can be accessed individually or as a group. These files share a unique name.
  •  Every dataset in a GDG has a Generation number and version number. Eg.TESTGDG.DATA.G0001.V00
  • Subsequent files are named by incrementing the Generation number(G0001-G9999).
  • The current generation is referred a 0. The next generation as +1 an previous generation as -1
  • Every time a new gen is created, it becomes the current gen and the current gen becomes the previous generation.
  • All generations must be cataloged to keep track of the relative generation  numbers
  • Maximum number of versions for a GDG is 255.
  • Each generation can have same or different DCB parameters.
Why We Need IT:
  1. Record keeping
  2. Easy to relate data sets
  3. Auto deletion of outdated datasets
  4. No need to change the JCL every time.
How to define a GDG :
To use the GDG we have to define the GDG base / index.

//STEP10 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
            DEFINE GDG(NAME(TESTGDG.DATA.GDG) –
            LIMIT(10) –
            NOEMPTY –
            SCRATCH)
/*

Where,
  • GDG name can range from 1-44
  • LIMIT can range from 1-255
Various Other Options: 

Empty Vs NoEmpty

Empty:-This option will delete all the older generations if the limit of generations is reached
Example: If a GDG is defined with a limit of 10 and 11th generation is created then all the old 10 generations are deleted and the 11th generation is created.
NoEmpty:- This option will delete the oldest generation if the limit of generations is reached .
Example: If a GDG is defined with a limit of 10 and 11th generation is created then the 1st  generation is  deleted and the 11th generation is created.
Scratch Vs NoScratch

Scratch:-This option will delete the generation completely if the dataset is deleted. 

NoScratch-> This option will uncatalog the dataset if the dataset is deleted.

Creating a GDG version:
GDG version can be created in same JCL by giving +1 to the GDG base name.
STEP1   EXEC PGM=IEFBR14                                 
INFILE  DD  DSN= TESTGDG.DATA.GDG (+1),   
        DISP=(NEW,CATLG,DELETE),                         
        UNIT=SYSDA,                                      
        SPACE=(CYL,(200,200),RLSE),                      
       DCB=(LRECL=2700,BLKSIZE=0,RECFM=FB)                
                                                         
Altering a GDG:
We can also change the attributes of a GDG using the ALTER keyword.
//STEP1   EXEC PGM=IDCAMS                      
//SYSPRINT DD SYSOUT=*                         
//SYSIN    DD *                                
    ALTER TESTGDG.DATA.GDG  NOSCRATCH     
/*                                             
Deleting a GDG generation:
//STEP1   EXEC PGM=IEFBR14                    
//DL       DD  DSN=TESTGDG.DATA.GDG(+1),      
//         DISP=(OLD,DELETE,DELTE)            
/*      
Deleting a GDG base /Index:
Two parameters for deleting the base .
1.PURGE:    Object will be deleted regardless of the expiration date.   
//SYSIN    DD  *                  
   DELETE TESTGDG.DATA.GDG PURGE    
2.FORCE: Object will be delete even though it is not empty.   
//SYSIN    DD  *                  
   DELETE TESTGDG.DATA.GDG FORCE

TIME=NOLIMIT and TIME=MAXIMUM

We can specify the max limit of TIME parameter as
TIME=NOLIMIT or
TIME=MAXIMUM.

Now which specification gives maximum time for a JOB?

TIME=MAXIMUM will allow the job to run for 357912 minutes (248.55 days)

TIME=NOLIMIT will allow the job for unlimited amount of time

Another advantage of NOLIMIT option is that it can remain in wait status for more than the installation
time limit.

Run a step only from a set of steps in a job

I have a JCL with 20 steps. Due to some reasons I want to execute the step 15 only.

One way to do it is to use RESTART from STEP15, but it will try to execute the subsequent steps too. We have to insert null statement after step15 to prevent the execution of subsequent steps.

But one decent way is there in which we don’t need to touch the job steps code, but alter only the Jobcard.

And that is….

In the JOBCARD, code COND parameter. Then, when the Job is executed , only the Step mentioned in the RESTART parameter will get executed.

RESTART=STEP15,COND=(0,LE)

Run a Program using Referback

It is possible to execute a program from any library using the referback feature.

//STEP1 EXEC PGM=IEFBR14
//PROGRAM DD DSN=SYSTEM.PGM.LOADLIB(COBOLPGM),DISP=SHR

.
.
.
.
//STEP2 EXEC PGM=*.STEP1.PROGRAM

Dummy VSM Dataset in JCL

In general we use DUMMY datasets in JCL instead of a actual file for some requirements.

But how can we specify dummy VSAM dataset in a JCL?

The parameter AMP=’AMORG’ tells the OS to treat the file as VSAM file.

//NOVSAMIO DD DUMMY,AMP=’AMORG’