Testing for OMITTED arguments
You can specify that one or more BY REFERENCE
arguments
are not to be passed to a called program by coding the OMITTED
keyword
in place of those arguments in the CALL
statement.
About this task
For
example, to omit the second argument when calling program sub1
,
code this statement:
Call 'sub1' Using PARM1, OMITTED, PARM3
The arguments in the USING
phrase
of the CALL
statement must match the parameters of
the called program in number and position.
In a called program,
you can test whether an argument was passed as OMITTED
by
comparing the address of the corresponding parameter to NULL
.
For example:
Program-ID. sub1.
. . .
Procedure Division Using RPARM1, RPARM2, RPARM3.
If Address Of RPARM2 = Null Then
Display 'No 2nd argument was passed this time'
Else
Perform Process-Parm-2
End-If
Related references
CALL statement (COBOL for Linux® on x86 Language Reference)
The USING phrase (COBOL for Linux on x86 Language Reference)
CALL statement (COBOL for Linux® on x86 Language Reference)
The USING phrase (COBOL for Linux on x86 Language Reference)