A parameterized section that specifies a returning value can be used as a function, in any context in which the returning
item of the parameterized section is valid.
where argument-list is:
Syntax Rules:
- An argument must be specified for each non-optional parameter in the parameterized section.
- Each argument must be compatible with the type of the corresponding parameter.
- The BY VALUE/REFERENCE type for each argument must be the same as the that of the corresponding parameter. If neither BY
VALUE nor BY REFERENCE is specified, then BY VALUE is assumed.
- If an argument is passed BY CONTENT, the parameterized section passing mode must specify BY REFERENCE, where the passed item
is moved to a temporary buffer, so the contents of the original data item remains unchanged.
- When a section parameter specifies BY REFERENCE:
- Typed arguments passed to the section must be of the same TYPEDEF as the parameter. The exception is if the TYPEDEF is a one-byte
PIC X definition; in which case, a non-TYPEDEF'd PIC X can be used.
- Non-types arguments passed to the section must be of the same definition as the parameter.
- A passing literal argument must be BY REFERENCE or BY CONTENT.
- Pointer arguments passed to the section BY VALUE must be of the same TYPEDEF.
- When a section parameter specifies BY VALUE:
- Typed pointer arguments passed to the section must be of the same TYPEDEF as the parameter.
- When both the argument and parameter are specified BY VALUE, move compatibility checks are performed as per
The MOVE Statement.
- When passing a pointer argument BY VALUE to the section, the parameter can specify an alphanumeric type BY REFERENCE.
- When passing an alphanumeric type BY REFERENCE to the section, the section parameter can be a pointer.