The ARG.PRESENT() function tests whether an argument variable was passed by the caller of a subroutine or function declared with the VAR.ARGS option.
When a program calls a subroutine or function that has been declared with the VAR.ARGS option, the actual number of arguments passed may be fewer than the number of argument variables in the subroutine definition. The unused argument variables will be left unassigned. The ARG.PRESENT() function allows the subroutine or function to test whether the argument was passed by the caller. Use of default values for missing arguments does not affect the value returned by this function.
Note that the ARG.PRESENTT() function relates to the arguments passed into a SUBROUTINE, FUNCTION or CLASS module and does not reflect the number of arguments passed into a local subroutine or function.
SUBROUTINE INCREMENT.COUNTER(CT) VAR.ARGS
READU REC FROM @VOC, 'COUNTER' ELSE STOP 'COUNTER missing'
IF ARG.PRESENT(CT) THEN CT = REC<2>
REC<2> += 1
WRITE REC TO @VOC, 'COUNTER'
The above subroutine increments a counter stored in field 2 of a VOC X-type record. If the CT argument is present in the call to this subroutine, the previous value of the counter is returned via this argument.