News Stay informed about the latest enterprise technology news and product updates.

James Greene's code

James Greene's code

    /* Designed and written by JAMES GREENE MARCH 9, 2001 */                                      
  /* N433 FOXWOOD DR                                    */                                      
  /* APPLETON, WISCONSIN   54914                        */                                      
  /* 920-757-5089                                       */                                      
  /* TRIPLEJ46@HOTMAIL.COM                              */                                      
  /*  I have many more administrative tools             */                                      
             PGM        /* Example of clp to create environment in +                            
                          which program TJRLS02A will run */                                    
 STEPA:      CPYF       FROMFILE(TJPSVOUT) TOFILE(TJPSVOUTSV) +                                 
                          MBROPT(*REPLACE) CRTFILE(*YES) +                                      
                          FMTOPT(*MAP *DROP) /* save outfile from +                             
                          previous save. */                                                     
 STEPB:      SAVLIB     LIB(*ALLUSR) DEV(TAP01) OUTPUT(*OUTFILE) +                              
                          OUTFILE(TJPSVOUT) INFTYPE(*OBJ) /* +                                  
                          existing outfile is replaced by new +                                 
                          information */                                                        
 TJRLS02A:   CALL       PGM(TJRLS02A)                                                           
             ENDPGM                                                                             
**********************************************************************                          
     A*  Source member TJPLS02A                                                                 
     A*  logical view for outfile from                                                          
     A*  SAVLIB command   Outfile created                                                       
     A*  by STEPB in CLP example above                                                          
     A          R QSRSAV                    PFILE(TJPSVOUT)                                     
     A          K SROLIB                                                                        
     A          K SRONAM                                                                        
     A          K SROMNM                                                                        
     A          K SROTYP                                                                        
     A          K SROATT                                                                        
**********************************************************************                          
     A*  source member TJPLS02B                                                                 
     A*  logical view for outfile from                                                          
     A*  previous days running of SAVLIB command                                                
     A*  See example CLP above - STEPA                                                          
     A          R QSRSAV                    PFILE(TJPSVOUTSV)                                   
     A          K SROLIB                                                                        
     A          K SRONAM                                                                        
     A          K SROMNM                                                                        
     A          K SROTYP                                                                        
     A          K SROATT                                                                        
**********************************************************************                          
     A*  source member TJPLS02C                                                                 
     A*   This file poplulated by rpg pgm TJRLS02A                                              
     A*   Contains a history of save exceptions reported by                                     
     A*   pgm TJRLS02A                                                                          
     A          R TJPLS02CF                                                                     
     A            INFTYPE       32                                                              
     A            SROSYS         8          TEXT('System')                                      
     A            SROSRL         6          TEXT('Saved release')                               
     A            SROLIB        10          TEXT('Library name')                                
     A            SROASP         2S 0       TEXT('Library Asp identifier')                      
     A            SROSAV         6S 0       TEXT('Number of objects saved')                     
     A            SROERR         6S 0       TEXT('Number of objects not sav')                   
     A            SROSEQ         4S 0       TEXT('Sequence number: -5=see S')                   
     A            SROLBL        17          TEXT('File label Id')                               
     A            SROSVT        13          TEXT('Save timestamp:  Cyymmddh')                   
     A            SRONAM        10          TEXT('Object name')                                 
     A            SROMNM        10          TEXT('Member name')                                 
     A            SROTYP         8          TEXT('Object type')                                 
     A            SROATT        10          TEXT('Object attribute')                            
     A            SROSIZ        15S 0       TEXT('Size')                                        
     A            SROOWN        10          TEXT('Owner')                                       
     A            SROSTA         1          TEXT('Status:  0=not saved 1=sa')                   
     A            SROMSG         7          TEXT('Error message identifier')                    
     A            SROTXT        50          TEXT('Object text')                                 
     A          K SROSVT                                                                        
     A          K INFTYPE                                                                       
     A          K SROLIB                                                                        
     A          K SRONAM                                                                        
     A          K SROMNM                                                                        
     A          K SROTYP                                                                        
**********************************************************************                          
     f*  Source member TJRLS02A                                                                 
     f*  Program generates 3 reports and one outfile.                                           
     f*  Report 1.  List objects not saved by current save operation                            
     f*  Report 2.  List objects saved by current operation but not                             
     f*             by previous operation                                                       
     f*  Report 3.  List objects saved by previous operation but not                            
     f*             by curreent operation                                                       
     f*  Outfile    Save results of above 3 reports.  This file can     and                     
     f*             be cleared at any time.                                                     
     f*   See selection criteria below.  Should be incorpoated equally                          
     f*   as shown below in each of 3 locations indicated.                                      
     f*   Change or remove selections as desired                                                
     f*                                                                                         
     ftjpls02a  if   e           k disk                                                         
     ftjpls02b  if   e           k disk    rename(qsrsav:qsrsav1)                               
     ftjpls02c  o  a e             disk                                                         
     Fqsysprt   o    f  128        printer usropn                                               
     d pgmsts         SDS                                                                       
     d  #program         *PROC                                                                  
     d  #wsid                244    253                                                         
     d  #user                254    263                                                         
     d  type           s             24                                                         
     c*  read current outfile and list objects not saved                                        
     c                   open      qsysprt                                                      
     c                   eval      type = 'Skipped Objects Report'                              
     c                   except    heading                                                      
     c                   dou       %eof(tjpls02a  )                                             
     c                   read      tjpls02a                                                     
     c                   if        not %eof(tjpls02a  )                                         
     f*   Selection criteria can be incorpoated here as shown.                                  
     c                   if        %subst(srolib:1:5) <> 'MIMIX'   and                          
     c                             %subst(srolib:1:2) <> '##'      and                          
     c                             %subst(srolib:1:3) <> 'WEB'     and                          
     c                             srolib <> 'QUSRSYS'                                          
     c                   else                                                                   
     c                   if        srosta = '0'                                                 
     c                   except    detail                                                       
     c                   eval      inftype = 'Not saved today'                                  
     c                   write     tjpls02cf                                                    
     c                   endif                                                                  
     c                   endif                                                                  
     c                   endif                                                                  
     c                   enddo                                                                  
     c                   except    eoj                                                          
     c                   eval      type = '  New Objects Report  '                              
     c                   except    heading                                                      
     c*  read current outfile and compare to previous outfile - list                            
     c*  new objects saved                                                                      
     c     *loval        setll     tjpls02a                                                     
     c                   dou       %eof(tjpls02a  )                                             
     c                   read      tjpls02a                                                     
     c                   if        not %eof(tjpls02a  )                                         
     f*   Selection criteria can be incorpoated here as shown.                                  
     c                   if        %subst(srolib:1:5) <> 'MIMIX'   and                          
     c                             %subst(srolib:1:2) <> '##'      and                          
     c                             %subst(srolib:1:3) <> 'WEB'     and                          
     c                             srolib <> 'QUSRSYS'                                          
     c                   if        srosta = '1'                                                 
     c     key1          chain     tjpls02b                                                     
     c                   if        not %found or                                                
     c                             %found and srosta = '0'                                      
     c                   except    detail                                                       
     c                   eval      inftype = 'Saved today but not yesterday'                    
     c                   write     tjpls02cf                                                    
     c                   endif                                                                  
     c                   endif                                                                  
     c                   endif                                                                  
     c                   endif                                                                  
     c                   enddo                                                                  
     c                   except    eoj                                                          
     c*  read previous outfile and compare to current outfile - list                            
     c*  objects saved on previous save but not saved on current save                           
     c                   eval      type = '  Old Objects Report  '                              
     c                   except    heading                                                      
     c     *loval        setll     tjpls02b                                                     
     c                   dou       %eof(tjpls02b  )                                             
     c                   read      tjpls02b                                                     
     c                   if        not %eof(tjpls02b  )                                         
     f*   Selection criteria can be incorpoated here as shown.                                  
     c                   if        %subst(srolib:1:5) <> 'MIMIX'   and                          
     c                             %subst(srolib:1:2) <> '##'      and                          
     c                             %subst(srolib:1:3) <> 'WEB'     and                          
     c                             srolib <> 'QUSRSYS'                                          
     c                   if        srosta = '1'                                                 
     c     key1          chain     tjpls02a                                                     
     c                   if        not %found    or                                             
     c                             %found and srosta = '0'                                      
     c                   except    detail                                                       
     c                   eval      inftype = 'Saved yesterday but not today'                    
     c                   write     tjpls02cf                                                    
     c                   endif                                                                  
     c                   endif                                                                  
     c                   endif                                                                  
     c                   endif                                                                  
     c                   enddo                                                                  
     c                   except    eoj                                                          
     c                   eval      *inlr = *on                                                  
     c     *inzsr        begsr                                                                  
     c     key1          klist                                                                  
     c                   kfld                    srolib                                         
     c                   kfld                    sronam                                         
     c                   kfld                    sromnm                                         
     c                   kfld                    srotyp                                         
     c                   kfld                    sroatt                                         
     c                   endsr                                                                  
     c**************************************************************                            
     Oqsysprt   e            heading        1  1                                                
     o                       *date               10                                             
     O                       #program            21                                             
     o                       type                46                                             
     O                       #wsid               59                                             
     O                       #user               70                                             
     o                       page          z     78                                             
     Oqsysprt   e            heading        1                                                   
     o                                           12 'Library'                                   
     o                                           22 'Object'                                    
     o                                           33 'Member'                                    
     o                                           44 'Type'                                      
     o                                           55 'Attribute'                                 
     o                                           66 'Saved?'                                    
     o                                           77 'Message'                                   
     Oqsysprt   e            detail         1                                                   
     O                       srolib              12                                             
     O                       sronam              22                                             
     O                       sromnm              33                                             
     O                       srotyp              44                                             
     O                       sroatt              55                                             
     O                       srosta              66                                             
     O                       sromsg              77                                             
     Oqsysprt   e            eoj            1                                                   
     o                                           19 'End of Report'  

Dig Deeper on iSeries programming commands

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close