Friday, December 2, 2011

How to Fix “GDG Generation Not Found JCL Error”

Here is the snippet to avoid JCL error due to NO GDG Generations are found on SMS.

You know that the only possible way to avoid DATASET NOT FOUND JCL Error is “Create datasets or use Dummy” here is a method to handle the errors in JCL itself.

You can have IDCAMS to issue LISTCAT LVL to list all the generations for the GDG and the move the out put to an input file, then use SORT utility to Check the resultant file for the .G and V00 characters on the file. If no GDG generations found set Return code of the step to 4 (it can be anything). then setup COND parameter for an IEFBR step in such a way that if the CONDCODE matches 4 (“COND=(4,NE)”), create the versions :)

JCL.

//R0318BMJ  JOB 'GDG VER FINDER',NOTIFY=R0318B               
//IDCAMS   EXEC PGM=IDCAMS                                   
//SYSPRINT DD DSN=&&TEMP,DISP=(,PASS)                        
//SYSIN    DD *                                              
LISTCAT LVL('TSHRCI.PATMAN.REPORT.GROUP') ALL               
/*                                                           
//*                                                          
//GETPOS   EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=&&TEMP,DISP=SHR                            
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                              
OPTION    NULLOUT=RC4,VLSCMP                                
SORT      FIELDS=COPY                                       
 INCLUDE   COND=(48,2,CH,EQ,C'.G',AND,54,3,CH,EQ,C'V00')     
/*                                                           
//MODEL    EXEC PGM=IEFBR14,COND=(4,NE,GETPOS)               
//GDGMODEL DD   DSN=TSHRCI.PATMAN.REPORT.GROUP(+1),          
//         DISP=(NEW,CATLG,DELETE),                          
//         UNIT=SYSDA,                                       
//         SPACE=(TRK,(1,1),RLSE),                           
//         DCB=(LRECL=80,RECFM=FB,BLKSIZE=800,DSORG=PS)      
//SYSPRINT DD   SYSOUT=*                                     
//SYSIN    DD DUMMY
                                          

INCLUDE   COND=(48,2,CH,EQ,C'.G',AND,54,3,CH,EQ,C'V00') 

Once you executed IDCAMS step the messages from LISTCAT will be moved to &&TEMP dataset, then using the above CONDITION statement SORT utility will check for .G and V00 characters on the TEMPDATASET, if found SOR will skip the step else if set RETURN CODE 4.

The TEMP Dataset is FBA, so you need to add 4 bytes to the actual position of the characters on TEMP dataset. 44 and 50 are the Character positions of .G & V00 on my TEMPDATASET, after adding 4 it will become 48 and 54.  To find the positions of your characters replace TEMP with a dataset on your system then, check the file. “Don’t forget to add 4 bytes”

//MODEL    EXEC PGM=IEFBR14,COND=(4,NE,GETPOS)

This will execute only if the GETPOS step returned a return code of 4.

Let me know if you have any concerns on the JCL. and Like it/rate it/Comment on it you like the post.

Thanks

-Shibu-

No comments:

Post a Comment