MF 

Perform Expressions

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.

Perform expression parameterized sectoin

where argument-list is:

parameterized section argument list

Syntax Rules:

  1. An argument must be specified for each non-optional parameter in the parameterized section.
  2. Each argument must be compatible with the type of the corresponding parameter.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. When passing a pointer argument BY VALUE to the section, the parameter can specify an alphanumeric type BY REFERENCE.
  8. When passing an alphanumeric type BY REFERENCE to the section, the section parameter can be a pointer.