Problem solve Get help with specific problems with your technologies, process and projects.

Reorganizations for multiple vendors

This tip is for those who have multiple vendor environments where file reorg's cannot all be run with the same authorities.

This tip is for those of us who have multiple vendor environments where file reorganizations cannot all be run with the same authorities. We run this code over several libraries every weekend. I then repeat the code for the libraries for the next vendor making sure that the user on the SBMJOB has the proper authorities. I also change the file name in each CL. On Monday I have the file size data from this weekend run and automatically push it into a spreadsheet, which lets me track file growth.

If you would like to calculate your reorganizations for multiple vendors on a percentage you can change the line that's marked. I used to have this setup like that, but found the time to do all files with deleted records would still complete in the allotted time.

We use the submit job because the operators like to know what file is being worked on. It also gives us the ability to suspend the reorganizations if needed and to resume by simply holding and releasing a jobq.

  CL Program 1
             DCLF       FILE(REORGP1) RCDFMT(QWHFDMBR)                 
             DSPFD      FILE(LIBRARY1/*ALL) TYPE(*MBR) +              
                          OUTPUT(*OUTFILE) OUTFILE(MYLIB/REORGP1)      
             DSPFD      FILE(LIBRARY2/*ALL) TYPE(*MBR) +              
                          OUTPUT(*OUTFILE) OUTFILE(MYLIB/REORGP1) +    
                          OUTMBR(*FIRST *ADD)                         
             RCVF       RCDFMT(QWHFDMBR)                              
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))         
             IF         COND(&MBFTYP *NE 'P') THEN(GOTO CMDLBL(READ)) 
      IF         COND(&MBNDTR *GT 0) THEN(DO) Calculation here if desired. 

      SBMJOB     CMD(RGZPFM FILE(&MBLIB/&MBFILE) +             
                          MBR(&MBNAME)) JOB(&MBFILE) JOBD(*USRPRF) +  
                          JOBQ(MYQUEUE) JOBPTY(6) USER(XXXXX)
        User must have authority to perform reorg.
             GOTO       CMDLBL(READ) 


The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.