Reorganizing all files in a library

These two programs allow the reorganization of all files in a selected library.

You Can View User Feedback To This Tip

These two programs allow the reorganization of all files in a selected library. One program specifies the library(s)while the other (after submission to batch) does the reorganizing. Since the files used are created in QTEMP the system cleans up after itself after the job is finished.


 
0002.00              PGM                                     Program to submit the Library for reorg.

                 
0003.00         MONMSG MSGID(CPF0000)                                    
0003.01                                                                       
0003.02       SBMJOB     CMD(CALL PGM(qgpl/RGZLIBFCL) PARM('TSTSEC' +       
0003.03                     '*ALL')) JOBQ(QPGMR)                 
                                                                       
0001.00   /*  REORG ALL PHYSICAL FILES IN RGZLIBF IN QTEMP                      
0002.00              PGM        PARM(&LIB &FIL)                                 
0003.00                                                                         
0004.00              DCLF       FILE(QSYS/QAFDMBRL)                             
0005.00              DCL        VAR(&SLIB) TYPE(*CHAR) LEN(10)                  
0006.00              DCL        VAR(&MBR) TYPE(*CHAR) LEN(10)                   
0007.00                                                                         
0008.00              DCL        VAR(&LIB) TYPE(*CHAR) LEN(10)                   
0009.00              DCL        VAR(&FIL) TYPE(*CHAR) LEN(10)                   
0010.00                                                                         
0011.00              DCL        VAR(&ODLBNM) TYPE(*CHAR) LEN(10)                
0012.00              DCL        VAR(&ODOBNM) TYPE(*CHAR) LEN(10)                
0013.00                                                                         
0014.00              OVRDBF     FILE(QAFDMBRL) TOFILE(QTEMP/MBRS)               
0015.00                                                                         
0016.00              DSPFD      FILE(&LIB/&FIL) TYPE(*MBRLIST) +                
 FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7  
0017.00                           OUTPUT(*OUTFILE) FILEATR(*PF) +               
0018.00                           OUTFILE(QTEMP/MBRS)                           
0019.00                                                                         
0020.00  AGAIN:      RCVF       RCDFMT(QWHFDML) /* File from Display File +     
0021.00                           Description */                                
0022.00                                                                         
0023.00              MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF))           
0024.00              MONMSG     MSGID(CPF0001) EXEC(GOTO CMDLBL(EOF))           
0025.00                                                                         
0026.00              RGZPFM     FILE(&MLLIB/&MLFILE) MBR(*FIRST)                
0027.00              MONMSG     MSGID(CPF2981)                                  
0028.00                                                                         
0029.00              GOTO       CMDLBL(AGAIN)                                   
0030.00   /*                                                                    
0031.00  EOF:        ENDPGM                                                     
****************** End of data ***********************************   

==================================
MORE INFORMATION ON THIS TOPIC
==================================

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.

USER FEEDBACK TO THIS TIP

  • The program should reorganize the member name in the DSPFD outfile, rather than *FIRST. As it stands, it would repeatedly reorganize the *FIRST member of a multi-member file! Change the reorganize command to: RGZPFM FILE(&MLLIB/&MLFILE) MBR(&MLNAME). — Nick Hobson

This was first published in January 2002

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close