JCL - MainFrames - Part 3

Ø  
Ø Max 15 INSTREAM procedures we can write
Ø In INSTREAM procedure PEND is mandatory
Ø We can execute the required procedure as follows
//STEPNAME EXEC PROC=PROCNAME
EX
//MATE02AB JOB NOTIFY=&SYSUID                                          
//PROC1 PROC                                                           
//STEP1 EXEC PGM=IEBGENER                                               
//SYSPRINT DD SYSOUT=*                                                
//SYSUT1 DD DSN=MATE05.GRP.PDS1(M2),DISP=SHR                           
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR                                                                                           
        GENERATE MAXFLDS=3                                             
        RECORD FIELD=(4,6,,1),FIELD=(5,11,,6),FIELD=(4,1,,12)          
// PEND                                                                
//PROC2 PROC                                                           
//STEP2 EXEC PGM=IEBGENER                                              
//SYSPRINT DD SYSOUT=*                                                 
//SYSUT1 DD DSN=MATE05.GRP.PDS(M1),DISP=SHR                            
//SYSUT2 DD DSN=MATE05.GRP.PS1,DISP=SHR                                
// PEND                                                               
//PROC3 PROC                                                            
//STEP3 EXEC PGM=IEBCOPY                                              
//SYSPRINT DD SYSOUT=*                                                 
//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR                               
//DD2 DD DSN=MATE05.GRP.PDS1,DISP=SHR                                                                                              
      COPY INDD=DD1,OUTDD=DD2                                         
// PEND                                                                
//PROC4 PROC                                                          
//STEP4 EXEC PGM=IEBGENER                                              
//SYSPRINT DD SYSOUT=*                                                 
//SYSUT1 DD DSN=MATE05.GRP.PDS(M1),DISP=SHR                            
//SYSUT2 DD DSN=MATE05.GRP.PDS1(M2),DISP=SHR                                                                                       
// PEND                                                                
//STEP5 EXEC PROC=PROC1                                                
//SYSOUT DD SYSOUT=*                                                   
/*                                                                     
2. CATALOG PROCEDURE
Ø By using catalog procedure we can make any procedure by using ‘JCLLIB ORDER’
Ø We can write maximum of 255 catalog procedures
Ø Using catalog procedure we can invoke any required step existed in procedure
Ø While writing catalog procedure in a member, procedure name and member name must be same
Ø In catalog procedures PEND statement is optional
Ø Using catalog procedure we can reduce the code because it is mainly used for code reusability
CODE IN MATE02.GRP.PDS(M1)
//M1 PROC
//STEP1 EXEC PGM=IEFBR14                                               
//SYSPRINT DD SYSOUT=*                                                 
//DD1 DD DSN=MATE05.GRP.PS4,DISP=(NEW,CATLG,DELETE),                   
//     SPACE=(TRK,(10,10),RLSE),                                       
//     DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),                            
//     VOL=SER=DEVMA0,UNIT=3390                                       
//SYSOUT DD SYSOUT=*                                                  
//SYSIN DD *                                                           
/*         
CODE IN MATE02.GRP.PDS(M2)
//M2 PROC
 //STEP2 EXEC PGM=IDCAMS                                              
//SYSPRINT DD SYSOUT=*                                                 
//DD1 DD DSN=MATE05.GRP.PDS,DISP=(NEW,CATLG,DELETE),                   
//        SPACE=(TRK,(10,10,1),RLSE),                                     
//        DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),                            
//        VOL=SER=DEVMA0,UNIT=3390                                        
//SYSOUT DD SYSOUT=*                                                    
//SYSIN DD *                                                           
/*
CODE IN MATE02.GRP.PDS(M3)
//M3 PROC                                      
//STEP3 EXEC PGM=IEBCOPY                                               
//SYSPRINT DD SYSOUT=*                                                 
//DD1 DD DSN=MATE05.GRP.PDS,DISP=SHR                                  
//DD2 DD DSN=MATE05.GRP.PDS1,DISP=SHR                                 
//SYSIN DD *                                                            
      COPY INDD=DD1,OUTDD=DD2  
      SELECT MEMBER=(M1,M2)                                       
//SYSOUT DD SYSOUT=*                                                  
/*
CODE IN MATE02.GRP.PDS(M4)
//M4 PROC                             
//STEP4 EXEC PGM=IEBGENER                                              
//SYSPRINT DD SYSOUT=*                                               
//SYSUT1 DD DSN=MATE05.GRP.PDS1(M2),DISP=SHR                           
//SYSUT2 DD DSN=MATE05.GRP.PS2,DISP=SHR                                
//SYSIN DD *                                                           
        GENERATE MAXFLDS=2                                             
        RECORD FIELD=(4,1,,1),FIELD=(5,6,,6)
//SYSOUT DD SYSOUT=*                                                   
/*
CODE IN MATE02.GRP.PDS(M5)
//M5 PROC                                        
//STEP5 EXEC PGM=IEBGENER                                              
//SYSPRINT DD SYSOUT=*                                                  
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR                                
//                DD DSN=MATE05.GRP.PS2,DISP=SHR                                
//SYSUT2 DD DSN=MATE05.GRP.PS3,DISP=SHR                            
//SYSIN DD *                                                           
//SYSOUT DD SYSOUT=*                                                   
/*
CODE IN MATE02.GRP.PDS(M6)
//M6 PROC                                          
//STEP1 EXEC PGM=IEBPTPCH                                             
//SYSPRINT DD SYSOUT=*                                                
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR                                
//SYSUT2 DD SYSOUT=*
//SYSIN DD *                                                           
      PRINT TYPORG=PS,MAXFLDS=2                                        
      TITLE ITEM=('EMPLOYEE DETAILS',30)                               
      TITLE ITEM=('ENUM ENAME ',1)                                 
      RECORD FIELD=(4,1,,25),FIELD=(5,6,,30)            
//SYSOUT DD SYSOUT=*                                                  
/*
CODE IN MATE02.GRP.JCL(CATPRO)
//MATE05AB JOB NOTIFY=&SYSUID                                          
//JCLLIB ORDER=(MATE05.GRP.PDS1)                                      
//STEP1 EXEC PROC=M1                                                  
/*
PROCEDURE OVERRIDING
Ø Using Procedure Overriding we can change the parameters values at the time of execution of a procedure
Ø We can override both EXEC and DD statement parameters
Ø To override the EXEC statement parameter values
PARAMETER.STEPNAME=VALUE
Ø To override DD statement parameter values
//STEPNAME.DDNAME DD PARAMETER=VALUE

EX
//MATE05AB JOB NOTIFY=&SYSUID                                           
//PROC3 PROC                                                          
//STEP1 EXEC PGM=IEFBR14,TIME=(5,50)                                   
//SYSPRINT DD SYSOUT=*                                                 
//DD1 DD DSN=MATE05.GRP.PS5,DISP=(NEW,CATLG,DELETE),                   
//       SPACE=(TRK,(10,10),RLSE),                                    
//       DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),                          
//       VOL=SER=DEVMA0,UNIT=3390
// PEND                                                                 
//STEP2 EXEC PROC=PROC3,TIME.STEP1=(2,20)                              
//STEP1.DD1 DD DSN=MATE05.GRP.PS6                                     
//SYSOUT DD SYSOUT=*                                                    
/*
          In the above example time value will be overrided by time=(2,20) at the same time ‘DSN’ value also overrided by PS6
SYMBOLIC PARAMETERS
Ø Symbolic parameters are the variables which can hold some values in it and the value of symbolic parameters will be applied to the parameters whenever the procedure is executed
Ø Symbolic parameters are represented with a prefix ‘&’
Ø The max length is 7 to 8 characters
EX
CASE1.
//MATE05AB JOB NOTIFY=&SYSUID
//PROC2 PROC
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=* 
//DD1 DD DSN=&A,DISP=(NEW,CATLG,DELETE),                                   
//       SPACE=(TRK,(10,10),RLSE),                                    
//       DCB=&B                          
//       VOL=SER=&C,UNIT=3390                                       
//PEND                                                  
//STEP2 EXEC PROC=PROC2,A=MATE05.GRP2.PS3                                          
//B=(RECFM=FB,LRECL=70,BLKSIZE=700),          
//C=DEVMA0                                 
//SYSOUT DD SYSOUT=*                                                   
/*  
CASE2.
//MATE05AB JOB NOTIFY=&SYSUID
//PROC3 PROC
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=* 
//DD1 DD DSN=&A,DISP=(NEW,CATLG,DELETE),                                    
//       SPACE=(TRK,(10,10),RLSE),                                    
//       DCB=&B                          
//       VOL=SER=&C,UNIT=3390                                      
//PEND                                                  
//STEP2 EXEC PROC=PROC3
//VAL1 SET A=MATE05.GRP2.PS3                                          
// VAL2 SET B=(RECFM=FB,LRECL=70,BLKSIZE=700),          
// VAL3 SET C=DEVMA0                                
//SYSOUT DD SYSOUT=*                                                    
/*  
REFERBACK OPERATOR
Ø By using ‘REFERBACK OPERATOR’ – ‘*’ we can use any previous step parameters value into the currently running step
Ø We cant use ‘REFERBACK’ in 1st step because ‘REFERBACK’ always takes the previous step values
SYNTAX: PARAMETER=*.STEPNAME.DDNAME
EX
//MATE05AB JOB NOTIFY=&SYSUID                                          
//STEP1 EXEC PGM=IEFBR14                                               
//SYSPRINT DD SYSOUT=*                                                 
//DD1 DD DSN=MATE05.GRP.PS7,DISP=SHR                                   
//       SPACE=(TRK,(10,10),RLSE),                                    
//       DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)                          
//       VOL=SER=DEVMA0,UNIT=3390                                      
//SYSOUT DD SYSOUT=*
//STEP2 EXEC PGM=IEBGENER                                              
//SYSPRINT DD SYSOUT=*                                                 
//SYSUT1 DD DSN=MATE05.GRP.PS1,DISP=SHR                                 
//SYSUT2 DD DSN=*.STEP1.DD1,DISP=SHR                                   
//SYSIN DD *                                                          
//SYSOUT DD SYSOUT=*                                                   
/*


GENERATION DATA GROUP(GDG)
Ø GDG’s are liked named data sets which are internally and chronologically related
Ø In general we cant create a data set with same name but by using GDG we can create max 255 liked named data sets. These are also called as ‘Generations’
Ø All ‘Generations’ are like PS files which we can edit and store some data in it
Ø Generations are two types. They are……..
1.     Absolute Generations
2.     Relative Generations
Ø Absolute Generations are cataloged names which can view in catalog area
Ø Relative Generations are not permanent names they may vary every time
Ø The Generations will be represented as follows………..
GnnnnVnn
        G – Generations
Max Value of nnnn – 9999
        V – Version
     Max Value of nn – 99
Ø While creating GDG we have to follow 3 steps. They are…….
1.     Creation of GDG base cluster
2.     Creation of Modal data set
3.     Generating the Generations
Step1. Creation of GDG base cluster
Ø While creating GDG base cluster we are having some required parameters as follows
1. NAME – Specifies the name of a GDG which is mandatory. For every GDG base cluster, Max length of GDG name is 35 characters
2. LIMIT(n) – where n specifies the no of Generations require by the user. Max value of n is 255
3. EMPTY or NOEMPTY
Ø In case of EMPTY, when ‘LIMIT’ is exceeded it uncatalogs all Generations and create a New generation
Ø In case of NOEMPTY, when ‘LIMIT’ is exceeded it uncatalogs the oldest Generation and New Generation is created.
Ø NOEMPTY is default

4. SCRATCH or NOSCRATCH
Ø SCRATCH will delete all uncataloged Generations
Ø In case of NOSCRATCH , it wont delete the uncataloged Generations
Ø NOSCRATCH is default
Step2. Creation of Modal data set
Modal data set is a PS file which is mainly used to set the properties for the newly creating Generations
Step3. Generating Generations
          Whenever user wants to generate the Generations according to the user requirement
                   GDG(+2)                                           GDG(+1)
          Day by Day Generations                               Daily Generations
EX1. GDG creation
//MATE05AB JOB NOTIFY=&SYSUID                                         
//STEP1 EXEC PGM=IDCAMS                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN  DD *                                                          
           DEFINE GENERATIONDATAGROUP(NAME(MATE05.GRP.GDG)-                    
           LIMIT(2)-                                                           
           EMPTY-                                                             
           NOSCRATCH)                                                         
//SYSOUT DD SYSOUT=*                                                    
/*                                                                    
Ø In the above example using ‘IDCAMS’ we create the GDG
Ø Using ‘Define’ command we can define a cluster
Ø ‘-‘ is a continuation character in VSAM

EX2. Creation of Modal data set
//MATE05AB JOB NOTIFY=&SYSUID                                          
//STEP1 EXEC PGM=IDCAMS                                                
//SYSPRINT DD SYSOUT=*                                                
//DD1 DD DSN=MATE05.GRP.MODAL,DISP=(NEW,CATLG,DELETE),                 
//       SPACE=(TRK,(10,10),RLSE),                                     
//       DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),                          
//       VOL=SER=DEVMA0,UNIT=3390                                      
//SYSOUT DD SYSOUT=*                                                   
/*                                                                     
EX3. Generating Generations
//MATE05AB JOB NOTIFY=&SYSUID 
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*                                                
//DD1 DD DSN=MATE05.GRP.GDG(+1),DISP=(NEW,CATLG,DELETE),               
//       SPACE=(TRK,(10,10),RLSE),                                     
//       DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),                         
//       VOL=SER=DEVMA0,UNIT=3390                                     
//SYSOUT DD SYSOUT=*                                                  
//SYSIN DD *                                                         
/*                                                                      
Description:
          In GDG ‘+’ specifies newly creating GDG’s
          ‘ – ‘ specifies an existing Generations
          ‘0’ specifies Current Generations
Altering the GDG
          By using ‘ALTER’ command we can change the properties of GDG base cluster
          By using ‘ALTER’
1.     We can change the ‘LIMIT’
2.     We can change from ‘EMPTY’ to ‘NOEMPTY’
3.     We can change from ‘SCRATCH’ to ‘NOSCRATCH’
4.     Using ‘ALTER’ we can also rename the GDG
EX.
//MATE05AB JOB NOTIFY=&SYSUID                                           
//STEP1 EXEC PGM=IDCAMS                                                
//SYSPRINT DD SYSOUT=*                                                
//SYSIN  DD *                                                          
          ALTER MATE05.GRP.GDG-                                               
          LIMIT(3)-                                                           
          NOEMPTY-                                                            
          SCRATCH)                                                             
//SYSOUT DD SYSOUT=*                                                   
/*
DELETE GDG
          By using ‘DELETE’ command we can delete the GDG from catalog, while deleting GDG we have two possible ways. They are…….
1.     Force
2.     Purge
Force will delete all generations along with GDG base cluster
In case of Purge, it deletes all the Generations

NOTE:
          It overrides the retention period and deletes the GDG
EX.
//MATE05AB JOB NOTIFY=&SYSUID                                         
//STEP1 EXEC PGM=IDCAMS                                                
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN  DD *                                                          
   DELETE MATE05.GRP.GDG FORCE
                                                       Or
                                                    PURGE                                      
//SYSOUT DD SYSOUT=*                                                   

/*                                                                                                                                         

No comments:

Post a Comment