Elementary Items Passed by Reference

If either the formal parameter or the corresponding argument is an object reference, the corresponding argument or formal parameter must be an object reference following these rules:

  1. If either the argument or the formal parameter is a universal object reference, the corresponding formal parameter or argument must be a universal object reference.
  2. If either the argument or the formal parameter is described with an interface-name, the corresponding formal parameter or argument must be described with the same interface-name.
  3. If either the argument or the formal parameter is described with a class-name, the corresponding formal parameter or argument must be described with the same class-name, and the FACTORY and ONLY phrases must be the same.
  4. If the formal parameter is described with the ACTIVE-CLASS phrase, one of the following conditions must be true:
    1. The argument must be an object reference described with the ACTIVE-CLASS phrase, where the presence or absence of the FACTORY phrase is the same as in the formal parameter, and the method to be activated must be invoked with the predefined object references SELF or SUPER, or with an object reference described with the ACTIVE-CLASS phrase.
    2. The argument must be an object reference described with a class-name and the ONLY phrase, where the presence or absence of the FACTORY phrase is the same as in the formal parameter, and the method to be activated must be invoked with that class-name or with an object reference described with that classname and the ONLY phrase.

If either the argument or the formal parameter is of class pointer, the corresponding formal parameter or argument must be of class pointer and the corresponding items must be of the same category. If either is a restricted pointer, both must be restricted and of the same type. The ADDRESS special register is considered to be of class pointer and category data-pointer.

If neither the formal parameter nor the argument is of class object or pointer, the conformance rules are the following:

  1. If the activated element is a program for which there is no program-specifier in the Repository paragraph of the activating element and there is no NESTED phrase specified on the CALL statement, the formal parameter must be of the same length as the corresponding argument.
  2. If the activated element is one of the following:
    • A program for which there is a program-specifier in the Repository paragraph of the activating element
    • A program that was called with a CALL statement in which the NESTED phrase is specified
    • A method
    • A function

    then the definition of the formal parameter and the definition of the argument must have the same PICTURE, USAGE, SIGN, JUSTIFIED, and BLANK clauses, with the following exceptions:

    1. Currency symbols match if and only if the corresponding currency strings are the same.
    2. Period picture symbols match if and only if the DECIMAL-POINT IS COMMA clause is in effect for both the activating and the activated runtime elements or for neither of them. Comma picture symbols match if and only if the DECIMAL-POINT IS COMMA clause is in effect for both the activating and the activated runtime elements or for neither of them.

    Additionally:

    1. If the formal parameter is described with the ANY LENGTH clause, its length is considered to match the length of the corresponding argument.
    2. If the argument is described with the ANY LENGTH clause, the corresponding formal parameter shall be described with the ANY LENGTH clause.