PRODGDG : To create the missing GDG bases in the PROD JCL

                                                       
/* Rexx */                                                                    
/*                                                                            
        Purpose        : To create the missing GDG bases in the PROD JCL      
                                                                               
        How to use     : After building/modifing the JCL (job), just go        
                         inside the job and give 'JJ'. It will show all        
                         the missing GDG bases.Later type 'md9999' to          
                         make them display, then type the command              
                         'PRODGDG' in the command line.                        
                                                                               
        GDG properties : GDG Base Limit  : 60                                  
                         NO EMPTY                                              
                         SCRATCH                                              
                                           
ADDRESS ISREDIT                                                                
"MACRO"                                                                        
                                                                               
/*--------------------------------------------------------------------*/      
/*---------------------   FIND JOB REGION  ---------------------------*/      
/*--------------------------------------------------------------------*/      
                                                                               
"f all ' HL1='"                                                                
"ISREDIT (currlin3) = LINE .ZCSR"                                              
 parse var currlin3 some ' HL1=' reg " " rest2                                
 if substr(reg,3,1) \= '2' then                                                
"f next ' HL1='"                                                              
"ISREDIT (currlin3) = LINE .ZCSR"                                              
 parse var currlin3 some ' HL1=' reg " " rest2                                
if reg \= 'XP2' then                                                          
   do                                                                          
     "f all '//' 1"                                                            
     address ispexec                                                          
     ZEDLMSG = '*** This macro only applicable for PROD jobs!!! ***'          
     'SETMSG MSG(ISRZ001)';                                                    
     exit                                                                      
   end                                                                        
"X all"                                                                        
"f all '4 DSS20091W'"                                                          
"f all ''x'"                                                                  
"del all x"                                                                    
    "x all"                                                                    
    "f all 'gdg base'"                                                        
    "f all '          ' 1"                                                    
    "del all x"                                                                
    "x all"                                                                    
    "f all ''x'"                                                              
    "del all x"                                                                
   "ISREDIT (lastline) = LINENUM .ZLAST"                                      
                                                                               
   If lastline \= 0 then                                                      
      Do                                                                      
         DO Curr=1 TO lastline                                                
            "ISREDIT (dataline) = LINE" Curr                                  
            if index(dataline,'DDNAME') \= 0 then                              
               do                                                              
                 parse var dataline some ','some1"'"gdg"'"                    
               end                                                            
            else                                                              
               do                                                              
                 parse var dataline some "'"gdg"'"                            
               end                                                            
            parse var gdg gdg ' '                                              
                                                                               
            InStem.curr = gdg                                                  
         end                                                                  
   end                                                                        
   J = 1                                                                      
   DO I = 1 TO lastline                                                        
   IF I = 1 THEN                                                              
   do                                                                          
   OutStem.I = InStem.I                                                        
   say OutStem.I                                                              
   end                                                                        
   ELSE                                                                        
   DO K = 1 TO J                                                              
   IF (InStem.I \= OutStem.K) & (K = J) THEN                                  
   DO                                                                          
   J = J + 1                                                                  
   OutStem.J = InStem.I                                                        
   say OutStem.J                                                              
   END                                                                        
   ELSE                                                                        
   DO                                                                          
   IF (InStem.I == OutStem.K) THEN                                            
   ITERATE I                                                                  
   END                                                                        
   END                                                                        
   END                                                                        
say J                                                                          
GdgBases=J                                                                    
if lastline=0 then                                                            
   do                                                                          
     address ispexec                                                          
     ZEDLMSG = '*** There are no Prod GDG bases to be created!!! ***'          
     'SETMSG MSG(ISRZ001)';                                                    
     exit                                                                      
   end                                                                        
m=1                                                                            
jobid= "XP2XSKM2"                                                              
p.m = "//"jobid "JOB (N0HRXT000000),'GDG',CLASS=D,"                            
m=m+1                                                                          
p.m = "//            MSGLEVEL=(1,1),MSGCLASS=X"                                
m=m+1                                                                          
do n=1 to GdgBases                                                            
   p.m = "//PSTEP0"n" EXEC PGM=IDCAMS"                                        
   m=m+1                                                                      
   p.m = "//SYSIN   DD  *"                                                    
   m=m+1                                                                      
   p.m = "    DEFINE GDG(                                 -"                  
   m=m+1                                                                      
   p.m = "    NAME("OutStem.n") -"                                            
   m=m+1                                                                      
   p.m = "    LIMIT(60)                                   -"                  
   m=m+1                                                                      
   p.m = "    NOEMPTY                                     -"                  
   m=m+1                                                                      
   p.m = "    SCRATCH)"                                                        
   m=m+1                                                                      
   p.m = "/*"                                                                  
   m=m+1                                                                      
   p.m = "//SYSPRINT DD SYSOUT=*"                                              
   m=m+1                                                                      
   p.m = "//***********************************************************"      
   m=m+1                                                                      
end                                                                            
                                                                               
ADDRESS ISREDIT                                                                
"x all"                                                                        
"del all x"                                                                    
do x=1 to m-1                                                                  
 q.x=strip(p.x)                                                                
   w=x-1                                                                      
 ln.x='"LINE_AFTER '³³w³³' ="'                                                
 address "ISREDIT" "LINE_AFTER "w"= " '"'p.x'"'                                
end                                                                            
/*                                                                            
   address ispexec                                                            
    ZEDSMSG = ''                                                              
    ZEDLMSG = '*** All GDG Base(s) has been created Successfully!!! ***'      
    'SETMSG MSG(ISRZ001)';                                                    
    */                                                                        
exit 

Comments

Popular posts from this blog

Date/time constants in JCL

JCL ABeND --

IEBGENER usage examples