A basic subroutine is defined with
Subroutine Name(SUBNAME) ... Endroutine
and called with
So far, so good.
Of course, parameters can be defined
Subroutine Name(SUBNAME) Parms(PARAMETERS)
where PARAMETERS is a list of parameters, of either
PARAMNAME (PARAMNAME *RECEIVED) (PARAMNAME *RETURNED) (PARAMNAME *BOTH)
*BOTH is default and means that the parameters is used in the call (“received”) and may be changed by the subroutine (“returned”). *RECEIVED means that it is read only and will not be returned into the caller’s parameter list. All parameters are required so the subroutine interface is rather strict.
The subroutine is then called with
Execute Subroutine(SUBNAME) With_Parms(PARAMETERS)
Local variables, sorry, fields, are defined with DEFINE. More on that, later.