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

Easy way to compile my RPG programs

These CL programs help you to compile an RPG III or ILE RPG program by putting the necessary commands into your RPG code.

These CL programs help you to compile an RPG III or ILE RPG program by putting the necessary commands into your...

RPG code to avoid a lot of errors during the compilation, such as the error:

* QRG2120 Severity: 40 Number: 35

Message . . . . : External description not found for file specified as externally described. File ignored.

In my case this is a common error because I always forget put the correct library in my library list, now I only have to put the next lines (you need to put the "*//" before every command) into my RPG code and every time I have to compile it the CL programs do the job.

 
 Columns . . . :    1  80                                      Browse
C405CDUSRS/QRPGSRC
 SEU==>
PUR500D3
 FMT *  ..... *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6
...+... 7 ...+... 8                                            
        *************** Beginning of data
************************************************************************
***************   
0001.00      H*//ADDLIBLE P4653DBPCD
030506                                 
0001.10      H*//ADDLIBLE P4653DBP1C
030506                                 
0001.20      H*//ADDLIBLE P405CDUSR
030506                                 
0001.30      H*//OVRDBF FILE(ZPAL01X) TOFILE(*LIBL/ZPAL01)
030506                                 
0001.40      H*//OVRDBF FILE(ESNL01X) TOFILE(*LIBL/ESNL01)
030506                                 
0001.50      H*//OVRDBF FILE(HPHL10X) TOFILE(*LIBL/HPHL10)
030506                                 
0001.60      H*//OVRDBF FILE(HPWL01X) TOFILE(*LIBL/HPWL01)
030506                                 
0001.70      H*//OVRDBF FILE(HSWL01X) TOFILE(*LIBL/HSWL01)
030506                                 
0001.80      F/TITLE PUR500D3 PO/Req Header/Detail Entry
030506                                 
0001.90
F*****************************************************************
970612                                 
0002.20      F*
970612                                 
0002.30      F*  Program ID          -    PUR500D3
970612                                 
0002.40      F*  Application ID      -    PUR500D3
970612                                 
0002.50      F*  Application Name    -    PO/Req Header/Detail Entry
970612                                 
0002.60      F*  Date Generated      -    Jun 12, 1997
970612                                 
0002.70      F*
970612                                 
0002.70      F*
970612              
0002.80
F*****************************************************************
030506              
0003.80      FPUR500F3CF  E                    WORKSTN
970612    
0003.90      F                                        RRN01 KSFILE
SCR002S1                  970612    
0004.00      F                                        RRN02 KSFILE
SCR003S1                  970612    
0004.10      F                                              KINFDS
DSPFDS                    970612    
0004.20      FFSCL01  IF  E           K        DISK
970612    
0004.30      F                                              KINFDS
FIDS01                    970612    
0004.40      F                                              KINFSR SFERR
970612    
0004.50      FHPCL01  IF  E           K        DISK
970612    



You can create a User-define option in your PDM and use it instead of the 14=Compile 
  
  Code: COMPILA
*****************
            PGM        PARM(&PLIB &PFIL &PPRG &PTYPE)

             DCLF       FILE(UTILIB/COMPILAFM)
             DCL        VAR(&PPRG) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PFIL) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PLIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PTYPE) TYPE(*CHAR) LEN(10)
             DCL        VAR(&LEN) TYPE(*DEC) LEN(15 5) +
                          VALUE(71)
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(71)
             DCL        VAR(&PSTS) TYPE(*CHAR) LEN(1) VALUE('0')

  /*  MESSAGES
*/
             DCL        VAR(&PGMTXT)  TYPE(*CHAR) LEN(50) +
                            VALUE('Compilation ended')

             DCL        VAR(&MSG1)  TYPE(*CHAR) LEN(70)
             DCL        VAR(&MSG2) TYPE(*CHAR) LEN(50) VALUE('The +
                          program does not exist or is empty')
             DCL        VAR(&MSG3) TYPE(*CHAR) LEN(65) +
                          VALUE('Compile stopped. Errors found in +
                          file, press F6 to see report')


             CHGVAR     VAR(&PGMNAME) VALUE('COMPILA')
             CHGVAR     VAR(&WSRCL) VALUE(&PLIB)
             CHGVAR     VAR(&WSRCF) VALUE(&PFIL)
             CHGVAR     VAR(&WSRCM) VALUE(&PPRG)
             CHGVAR     VAR(&WOBJL) VALUE(&PLIB)
             CHGVAR     VAR(&WOBJM) VALUE(&PPRG)


START:

             SNDF       RCDFMT(MSGCTL)
             SNDRCVF    RCDFMT(PANT1)
             RMVMSG     CLEAR(*ALL)

/* User requested to cancel.                                        */
             IF         COND(&IN03) THEN(DO)
             SNDPGMMSG  MSG(&PGMTXT) TOPGMQ(*PRV)
             GOTO       CMDLBL(END)
             ENDDO

/* If error found in file and press F6  (See compile report)  */
             IF         COND(&IN06) THEN(DO)
             DSPSPLF    FILE(&PPRG) JOB(*) SPLNBR(*LAST)
             GOTO       CMDLBL(END)
             ENDDO

             IF         COND(&WSRCL = ' ' *AND &WSRCF = ' ' *AND +
                          &WSRCM = ' ' *AND &WOBJL = ' ' *AND +
                          &WOBJM = ' ') THEN(DO)
             GOTO       CMDLBL(START)
             ENDDO

     /* COMPILA RPG 400 */
             IF         COND(&PTYPE = 'RPG       ') THEN(DO)
             CALL       PGM(UTILIB/COMPILA2) PARM(&WSRCL &WSRCF +
                          &WSRCM &WOBJL &WOBJM &PSTS)
             ENDDO


     /* COMPILA RPG ILE */
             IF         COND(&PTYPE = 'RPGLE     ') THEN(DO)
             CALL       PGM(UTILIB/COMPILA3) PARM(&WSRCL &WSRCF +
                          &WSRCM &WOBJL &WOBJM &PSTS)
             ENDDO

             CHGVAR     VAR(&IN40) VALUE('0')

             IF         COND(&PSTS = '1') THEN(DO)
             CHGVAR     VAR(&MSG1) VALUE('Program ' *CAT &WSRCM *CAT +
                          ' has been compiled')
             SNDPGMMSG  MSG(&MSG1) TOPGMQ(*SAME (*))
             CHGVAR     VAR(&WSRCL) VALUE(' ')
             CHGVAR     VAR(&WSRCF) VALUE(' ')
             CHGVAR     VAR(&WSRCM) VALUE(' ')
             CHGVAR     VAR(&WOBJL) VALUE(' ')
             CHGVAR     VAR(&WOBJM) VALUE(' ')
             GOTO       CMDLBL(START)
             ENDDO

             IF         COND(&PSTS = '2') THEN(DO)
             SNDPGMMSG  MSG(&MSG2) TOPGMQ(*SAME (*))
             GOTO       CMDLBL(START)
             ENDDO

             IF         COND(&PSTS = '3') THEN(DO)
             SNDPGMMSG  MSG(&MSG3) TOPGMQ(*SAME (*))
             CHGVAR     VAR(&IN40) VALUE('1')
             GOTO       CMDLBL(START)
             ENDDO

END:         ENDPGM

**************



COMPILA2 

***************
             PGM        PARM(&PSRCL &PSRCF &PSRCM &POBJL &POBJM &PSTS)

             DCLF       FILE(*LIBL/QRPGSRC)
             DCL        VAR(&PSRCL) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PSRCF) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PSRCM) TYPE(*CHAR) LEN(10)
             DCL        VAR(&POBJL) TYPE(*CHAR) LEN(10)
             DCL        VAR(&POBJM) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PSTS) TYPE(*CHAR) LEN(1)
             DCL        VAR(&LEN) TYPE(*DEC) LEN(15 5) +
                          VALUE(71)
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(71)


             OVRDBF     FILE(QRPGSRC) TOFILE(&PSRCL/&PSRCF) MBR(&PSRCM)

START:
             RCVF
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(NODATA))
             MONMSG     MSGID(CPF4102) EXEC(GOTO CMDLBL(NODATA))

             IF         COND(%SST(&SRCDTA 7 3) = '*//') THEN(DO)
             CHGVAR     VAR(&CMD) VALUE(%SST(&SRCDTA 10 70))
             CALL       PGM(QCMDEXC) PARM(&CMD &LEN)
             MONMSG     MSGID(CPF2103)
             GOTO       CMDLBL(START)
             ENDDO
             ELSE       CMD(DO)
             GOTO       CMDLBL(CONTINUE)
             ENDDO

CONTINUE:

             CRTRPGPGM  PGM(&POBJL/&POBJM) SRCFILE(&PSRCL/&PSRCF) +
                          SRCMBR(&PSRCM)
             MONMSG     MSGID(QRG0000) EXEC(GOTO CMDLBL(ERR))
   /*        MONMSG     MSGID(QRG9001) EXEC(GOTO CMDLBL(ERR))     */

             CHGVAR     VAR(&PSTS) VALUE('1')
             GOTO       CMDLBL(END)

ERR:         CHGVAR     VAR(&PSTS) VALUE('3')
             GOTO       CMDLBL(END)


NODATA:       CHGVAR     VAR(&PSTS) VALUE('2')


END:         ENDPGM
****************


COMPILA3
*****************
            PGM        PARM(&PSRCL &PSRCF &PSRCM &POBJL &POBJM &PSTS)

             DCLF       FILE(*LIBL/QRPGLESRC)
             DCL        VAR(&PSRCL) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PSRCF) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PSRCM) TYPE(*CHAR) LEN(10)
             DCL        VAR(&POBJL) TYPE(*CHAR) LEN(10)
             DCL        VAR(&POBJM) TYPE(*CHAR) LEN(10)
             DCL        VAR(&PSTS) TYPE(*CHAR) LEN(1)
             DCL        VAR(&LEN) TYPE(*DEC) LEN(15 5) +
                          VALUE(90)
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(90)


             OVRDBF     FILE(QRPGLESRC) TOFILE(&PSRCL/&PSRCF) +
                          MBR(&PSRCM)

START:
             RCVF
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(NODATA))
             MONMSG     MSGID(CPF4102) EXEC(GOTO CMDLBL(NODATA))

             IF         COND(%SST(&SRCDTA 7 3) = '*//') THEN(DO)
             CHGVAR     VAR(&CMD) VALUE(%SST(&SRCDTA 10 90))
             CALL       PGM(QCMDEXC) PARM(&CMD &LEN)
             MONMSG     MSGID(CPF2103)
             GOTO       CMDLBL(START)
             ENDDO
             ELSE       CMD(DO)
             GOTO       CMDLBL(CONTINUE)
             ENDDO

CONTINUE:
             CRTBNDRPG  PGM(&POBJL/&POBJM) SRCFILE(&PSRCL/&PSRCF) +
                          SRCMBR(&PSRCM) DFTACTGRP(*NO) +
                          ACTGRP(*CALLER) OPTION(*XREF) +
                          DBGVIEW(*ALL) OPTIMIZE(*NONE) USRPRF(*OWNER)


             MONMSG     MSGID(RNS0000) EXEC(GOTO CMDLBL(ERR))

             CHGVAR     VAR(&PSTS) VALUE('1')
             GOTO       CMDLBL(END)

ERR:         CHGVAR     VAR(&PSTS) VALUE('3')
             GOTO       CMDLBL(END)


NODATA:       CHGVAR     VAR(&PSTS) VALUE('2')


END:         ENDPGM
*****************

COMPILAFM (SCREEN)
*****************
     A                                      DSPSIZ(24 80 *DS3)
     A          R PANT1
     A                                      CF03(03 'Exite')
     A  40                                  CF06(06 'Show errors')
     A                                      OVERLAY
     A                                  1 67DATE
     A                                      EDTCDE(Y)
     A                                  2 67TIME
     A                                  2  2USER
     A                                 23  4'F3=Exit'
     A                                 23 18'Enter=Continue'
     A                                  1  2'COMPILAFM'
     A                                  1 28'Delphi Mechatronic System'
     A                                      DSPATR(HI)
     A                                  7 34'Source Library'
     A                                      DSPATR(HI)
     A                                 13 34'Object Library'
     A                                      DSPATR(HI)
     A                                  9 35'File'
     A                                  9 19'Library'
     A                                  9 51'Member'
     A            WSRCL         10A  B 10 19
     A            WSRCF         10A  B 10 35
     A            WSRCM         10A  B 10 51
     A                                 15 27'Library'
     A                                 15 44'Member'
     A            WOBJL         10A  B 16 27
     A            WOBJM         10A  B 16 44
     A                                  2 29'Compile Programs Screen'
     A*****************************************************************
     A          R MSGRCD                    TEXT('MSG SFL RECORD')
     A                                      SFL SFLMSGRCD(24)
     A            MSGKEY                    SFLMSGKEY
     A            PGM                       SFLPGMQ
     A*
     A*****************************************************************
     A          R MSGCTL                    TEXT('MSG SFL CONTROL')
     A*****************************************************************
     A                                      OVERLAY SFLCTL(MSGRCD)
SFLSIZ(10)
     A                                      SFLPAG(1) SFLDSPCTL SFLDSP
SFLINZ
     A N98                                  SFLEND
     A            PGMNAME                   SFLPGMQ

  
  


 

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close