Visual RPG Language Reference

CALLB - Call a Procedure

Used to call BEGPROC procedures.

CALLB
Proc (<Class or Class.Procedure or Procedure name>)
ParmList (*NONE| Parameter List Name)
Err (Indicator Variable | *EXTENDED)
Lr (Indicator Variable)    

Parts

Proc

Required.  Proc specifies the name of the class and/or procedure to call.  If Proc contains a class name, then the *Entry BegProc in that class is called.   

ParmList

Optional.  ParmList specifies the parameter list name.  *NONE is the default and indicates that there is not a parameter list.  

If a ParmList is not given, CALLB may be followed by a group of DCLPARM commands specifying the parameters to be passed to the procedure.  If a parameter is going to be omitted (the corresponding DclSrParm has the *OMIT option), use the special value *OMIT in the DCLPARM's name. 

Err

Optional. Err determines what the runtime will do if an error occurs while executing this command.  The following rules apply:

  • Err (Indicator Variable) - the specified Indicator is set if an error occurred.

  • Err (*EXTENDED) - the program status flag is set whose status can be checked using the %ERROR built-in function.

  • If the Err keyword is not given and an error occurs, a runtime exception will be thrown.

Lr

Optional. The specified indicator is set to the value of *INLR of the called procedure. 

Remarks

Because a procedure may return a value, you may also use a free-form expression to invoke procedures:

   <procedure name>(Comma-separated parameter list)

   e.g. MyProc( CustName, *Omit )

Example


// Call to a procedure with a ParmList.
CallB Proc(MyProcedure) ParmList(Listout)

// Call to a procedure with parameters.
CallB Proc(MyProcedure)			
    DclParm CustName(*Omit)   
    DclParm CustPhone(*Omit)

See Also

BEGPROC 
CALLD 
DCLPARM