CREATE A PDS - UTILITY TOOL

                                                             
     /*REXX*/                                                                      
/*trace all*/                                                                  
                                                                               
/*--------------------------------------------------------------------*/      
/*                                                                    */      
/*    PURPOSE        : To create PDS's for SR/CR                      */      
/*                                                                    */      
/*    HOW TO USE     : Type TSO CRE8PDS in command line               */      
/*                                                                    */      
/*                                                                    */      
/*    DATE WRITTEN   : November 2014                                  */      
/*                                                                    */      
/*--------------------------------------------------------------------*/      
                                                                               
     ADDRESS ISPEXEC                                                          
                                                                               
     call set_libraries                                                        
     CUR='SN'                                                                  
     SN= '        '                                                            
     call display_panel                                                        
                                                                               
/*--------------------------------------------------------------------*/      
/*            This para initially sets the libraries                  */      
/*--------------------------------------------------------------------*/      
                                                                               
/*--------------*/                                                            
  set_libraries:                                                              
/*--------------*/                                                            
                                                                               
     "ISPEXEC LIBDEF ISPPLIB DATASET ID('ST.ISP.ISPPLIB')"                    
     "ISPEXEC LIBDEF ISPMLIB DATASET ID('ST.ISP.ISPMLIB')"                    
     "ISPEXEC LIBDEF ISPSLIB DATASET ID('ST.ISP.ISPSLIB')"                    
                                                                               
     RETURN                                                                    
                                                                               
/*--------------------------------------------------------------------*/      
/*            This para displays the panel when invoked               */      
/*--------------------------------------------------------------------*/      
                                                                               
/*--------------*/                                                            
  display_panel:                                                              
/*--------------*/                                                            
                                                                               
     "ISPEXEC DISPLAY PANEL(PDSPAN) CURSOR("CUR")"                            
     "ISPEXEC VGET (ZPFKEY) ASIS"                                              
                                                                               
     If ZPFKEY = 'PF03' then                                                  
        Exit                                                                  
     Else                                                                      
        DO                                                                    
         call verify_input_option                                              
         call check_selected_option                                            
         call exit_code                                                        
        END                                                                    
                                                                               
     RETURN                                                                    
                                                                               
/*--------------------------------------------------------------------*/      
/*            This para validates the input given by user             */      
/*--------------------------------------------------------------------*/      
                                                                               
/*--------------------*/                                                      
  verify_input_option:                                                        
/*--------------------*/                                                      
                                                                               
     If Datatype(SN,'N') then                                                  
        Do                                                                    
          address ispexec                                                      
          "setmsg msg(MSGID021)"                                              
          "VPUT (SN,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T) PROFILE"          
                                                                               
          cur='SN'                                                            
          call display_panel                                                  
        End                                                                    
                                                                               
     if A \= 'Y' & B \= 'Y' & C \= 'Y' & D \= 'Y' & E \= 'Y' then              
     if F \= 'Y' & G \= 'Y' & H \= 'Y' & I \= 'Y' & J \= 'Y' then              
     if K \= 'Y' & L \= 'Y' & M \= 'Y' & N \= 'Y' & O \= 'Y' then              
     if P \= 'Y' & Q \= 'Y' & R \= 'Y' & S \= 'Y' & T \= 'Y' then              
        do                                                                    
          address ispexec                                                      
          "setmsg msg(MSGID022)"                                              
          "VPUT (SN,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T) PROFILE"          
                                                                               
          cur='A'                                                              
          call display_panel                                                  
        end                                                                    
      Return                                                                  
                                                                               
/*--------------------------------------------------------------------*/      
/*      This para checks what all PDS are selected for creation       */      
/*--------------------------------------------------------------------*/      
                                                                               
/*----------------------*/                                                    
  check_selected_option:                                                      
/*----------------------*/                                                    
                                                                               
     DR = '20'                                                                
     SPS = '100, 10'                                                          
                                                                               
     If A = 'Y' then                                                          
       Do                                                                      
         TYPE = 'CBL'                                                          
         RLEN = '80'                                                          
         MCLAS= 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         DR = '50'                                                            
         SPS = '200, 20'                                                      
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     IF B = 'Y' then                                                          
       Do                                                                      
         TYPE = 'JOB'                                                          
         RLEN = '80'                                                          
         MCLAS= 'MCAPLDEV'                                                    
         SCLAS= 'SCAPLDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If C = 'Y' then                                                          
       Do                                                                      
         TYPE = 'PRC'                                                          
         RLEN = '80'                                                          
         MCLAS= 'MCAPLDEV'                                                    
         SCLAS= 'SCAPLDEV'                                                    
         DR = '50'                                                            
         SPS = '200, 20'                                                      
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If D = 'Y' then                                                          
       Do                                                                      
         TYPE = 'PR1'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If E = 'Y' then                                                          
       Do                                                                      
         TYPE = 'PR2'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If F = 'Y' then                                                          
       Do                                                                      
         TYPE = 'PR3'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If G = 'Y' then                                                          
       Do                                                                      
         TYPE = 'SCH'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                            
     If H = 'Y' then                                                          
       Do                                                                      
         TYPE = 'CPY'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If I = 'Y' then                                                          
       Do                                                                      
         TYPE = 'SCT'                                                          
         RLEN = '132'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If J = 'Y' then                                                          
       Do                                                                      
         TYPE = 'TRG'                                                          
         RLEN = '255'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If K = 'Y' then                                                          
       Do                                                                      
         TYPE = 'EZT'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If L = 'Y' then                                                          
       Do                                                                      
         TYPE = 'EMC'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If M = 'Y' then                                                          
       Do                                                                      
         TYPE = 'SDP'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If N = 'Y' then                                                          
       Do                                                                      
         TYPE = 'SDM'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If O = 'Y' then                                                          
       Do                                                                      
         TYPE = 'SDS'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If P = 'Y' then                                                          
       Do                                                                      
         TYPE = 'LNK'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If Q = 'Y' then                                                          
       Do                                                                      
         TYPE = 'AXN'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     If R = 'Y' then                                                          
       Do                                                                      
         TYPE = 'AON'                                                          
         RLEN = '80'                                                          
         MCLAS = 'MCNDVDEV'                                                    
         SCLAS= 'SCNDVDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     IF S = 'Y' then                                                          
       Do                                                                      
         TYPE = 'TJCL'                                                        
         RLEN = '80'                                                          
         MCLAS= 'MCAPLDEV'                                                    
         SCLAS= 'SCAPLDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     IF T = 'Y' then                                                          
       Do                                                                      
         TYPE = 'SCL'                                                          
         RLEN = '80'                                                          
         MCLAS= 'MCAPLDEV'                                                    
         SCLAS= 'SCAPLDEV'                                                    
         call check_pds_exist                                                  
       End                                                                    
                                                                               
     Return                                                                    
                                                                               
/*--------------------------------------------------------------------*/      
/*     This para checks if the PDS is already present or not          */      
/*--------------------------------------------------------------------*/      
                                                                               
/*----------------*/                                                          
  check_pds_exist:                                                            
/*----------------*/                                                          
                                                                               
     PDSFILE = 'XT2.SMS.'SN'.'TYPE''                                          
                                                                               
     Address TSO                                                              
     x = outtrap("LISTC.")                                                    
         "LISTCAT ENTRIES('"PDSFILE"')"                                        
     x = outtrap("OFF")                                                        
                                                                               
     Do AJ = 1 TO LISTC.0                                                      
        If (pos("NOT FOUND",LISTC.AJ)/=0) then                                
           Do                                                                  
                call create_pds                                                
           End                                                                
        Else                                                                  
           Do                                                                  
                                                                               
           End                                                                
     End                                                                      
                                                                               
     Return                                                                    
                                                                               
/*-----------*/                                                                
  create_pds:                                                                  
/*-----------*/                                                                
                                                                               
     Address TSO                                                              
     x = outtrap(N.)                                                          
         "ALLOC DS('"PDSFILE"') NEW",                                          
         "MGMTCLAS("MCLAS") STORCLAS("SCLAS")",                                
         "DSORG(PO) RECFM(F M) LRECL("RLEN") SPACE("SPS")",                    
         "DIR("DR") CYLINDERS"                                                
     x = outtrap(off)                                                          
                                                                               
     Return                                                                    
                                                                               
/*----------*/                                                                
  exit_code:                                                                  
/*----------*/                                                                
                                                                               
     Exit         

Comments

Popular posts from this blog

Date/time constants in JCL

JCL ABeND --

IEBGENER usage examples