Procedures in CL

105 Views


Procedures in CL

A CL procedure is a set of self-contained HLL statements that performs a particular function and returns to the caller. It begins with PGM and ends with ENDPGM.

 

Declare the service program in DCLPRCOPT and then call the procedure using CALLPRC.

PGM        PARM(&JOBDAT &COMPMSG)          
                                              
DCL        VAR(&JOBDAT) TYPE(*CHAR) LEN(7) 
DCL        VAR(&COMPMSG)   TYPE(*CHAR) LEN(4) 
DCLPRCOPT  LOG(*NO) TEXT('RPG_Refresh_Date') USRPRF(*OWNER) +                   
             DFTACTGRP(*NO) ACTGRP(*CALLER) +                 
             BNDSRVPGM((*LIBL/RPGTSS01 *IMMED)) 
              
/* Call RPG_Refresh_Date_Proc Procedure */         
CALLPRC    PRC('RPG_Refresh_Date_Proc') +          
             PARM((&OVRJOBDAT *BYREF))                       

Declare the binding directory and then call the procedure using CALLPRC. The Procedure should be part of the program in binding directory.

PGM

/* Set activation group to QILE */                              
   DclPrcOpt  DftActGrp(*No) ActGrp(QILE) BNDDIR(QC2LE) 
        
CallPrc  prc('stat') parm((&Path) (&RtnResults)) RtnVal(&RtnInt) 
      
EndPgm 

 

RPGPGM: Using CL Procedures

Post Comments