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

Step-by-step power compiler

This utility finds and adds all the needed libraries for your RPG IV program and compiles it.

Let's say that you need to compile a program and you don't have all the needed libraries for the files in it.

This utility finds and adds all the needed libraries for your RPG IV program (assuming there are no overrides) and compiles it.

Example:

XCMPLIB member(mysource) file(qrpglesrc) library(mylibrary)

It is made out of 2 commands and 2 CL programs.

Command source: XCMPLIB

 
CMD        PROMPT('Add libraries to compile')            
PARM       KWD(MEMBER) TYPE(*CHAR) LEN(10) MIN(1) +          
             PROMPT('Source member')             
PARM       KWD(FILE) TYPE(*CHAR) LEN(10) DFT(QRPGLESRC) +    
             MIN(0) PROMPT('Source file')             
PARM       KWD(LIBRARY) TYPE(*CHAR) LEN(10) MIN(1) +         
             PROMPT('Source library')                 

Command source: XADDLIB

 
CMD        PROMPT('Modify library list')             
PARM       KWD(OBJE) TYPE(*CHAR) LEN(10) MIN(1) +           
             PROMPT('Object needed')         
PARM       KWD(TIPO) TYPE(*CHAR) LEN(10) DFT(*FILE) +       
             MIN(0) PROMPT('Type of object')           


CLP source: XCMPLIB

 
             PGM        PARM(&MEMBER &FILE &LIBRARY)

             DCL        VAR(&MEMBER) TYPE(*CHAR) LEN(10)

             DCL        VAR(&FILE) TYPE(*CHAR) LEN(10)

             DCL        VAR(&FILEAUX) TYPE(*CHAR) LEN(10)

             DCL        VAR(&LIBRARY) TYPE(*CHAR) LEN(10)

             DCLF       FILE(QTEMP/DUMMYSRC)

             DLTF       FILE(QTEMP/DUMMYSRC)

             MONMSG     MSGID(CPF0000)

             CRTPF      FILE(QTEMP/DUMMYSRC) RCDLEN(112)

             CPYF       FROMFILE(&LIBRARY/&FILE) +

                          TOFILE(QTEMP/DUMMYSRC) FROMMBR(&MEMBER) +

                          MBROPT(*REPLACE) INCCHAR(*RCD 18 *EQ 'F') +

                          FMTOPT(*CVTSRC)

             CPYF       FROMFILE(&LIBRARY/&FILE) +

                          TOFILE(QTEMP/DUMMYSRC) FROMMBR(&MEMBER) +

                          MBROPT(*ADD) INCCHAR(*RCD 18 *EQ 'f') +

                          FMTOPT(*CVTSRC)

 READ:       RCVF

             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))

            CHGVAR     VAR(&FILEAUX) VALUE(%SST(&DUMMYSRC 7 10))       
            XADDLIB    OBJE(&FILEAUX)                                  
            GOTO       CMDLBL(READ)  
 END:       ?CRTBNDRPG  PGM(&LIBRARY/&MEMBER) +                        
                         SRCFILE(&LIBRARY/&FILE) SRCMBR(&MEMBER)       
            ENDPGM


CLP source: XADDLIB

 
            PGM        PARM(&OBJETO &TIPO)                                 
            DCLF       FILE(QTEMP/DUMMY)                                   
            DCL        VAR(&OBJETO) TYPE(*CHAR) LEN(10)                    
            DCL        VAR(&TIPO) TYPE(*CHAR) LEN(10)                      
            DLTF       FILE(QTEMP/DUMMY)                                   
            MONMSG     MSGID(CPF0000)                                      
            DSPOBJD    OBJ(*ALL/&OBJETO) OBJTYPE(&TIPO) +                  
                         OUTPUT(*OUTFILE) OUTFILE(QTEMP/DUMMY)             
            RCVF                                                           
            MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))               
            ADDLIBLE   LIB(&ODLBNM)                                        
            MONMSG     MSGID(CPF0000)                                      
END:        ENDPGM                                                         

Compiling directives:

a. Create the dummy file

DSPOBJD OBJ(QTEMP) OBJTYPE(*LIB) OUTPUT(*OUTFILE) OUTFILE(QTEMP/DUMMY)

b. Create the first CL program.

CRTCLPGM PGM(XADDLIB) SRCFILE(QCLSRC)

c. Create the first command.

CRTCMD CMD (XADDLIB) PGM(XADDLIB)

d. Create the dummysrc file.

CRTPF FILE (QTEMP/DUMMYSRC) RCDLEN(112)

e. Create the second CL program.

CRTCLPGM PGM(XCMPLIB) SRCFILE(QCLSRC)

f. Create the second command.

CRTCMD CMD(XCMPLIB) PGM(XCMPLIB)

g. If you'd like you can create a pdm command and use it right there.

h. E.g.: XC XCMPLIB MEMBER(&N) FILE(&F) LIBRARY(&L)

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

Check out our section of application development topics.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

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


This was last published in May 2005

Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close