A returning item must be specified in a calling statement if and only if a returning item is defined in the Procedure Division header of the called source unit.
If one of the operands is a strongly typed group item, both must be of the same type.
A national group is always treated as an elementary item.
Group items
If one of the operands is a group item, then the corresponding item must also be a group item or an alphanumeric elementary item and of the same length.
Elementary items
If either of the operands is an object reference, the corresponding item must also be an object reference, and the following rules apply:
If no ACTIVE-CLASS phrase is specified in the returning item of the called source unit, the conformance rules are the same as if a SET statement were performed in the called runtime unit with the returning item in the called source unit as the sending operand and the corresponding returning item in the calling source unit as the receiving operand.
If an ACTIVE-CLASS phrase exists in the returning item of the called source unit, the conformance rules are the same as if a SET statement were performed in the calling runtime unit with the returning item in the called source unit as the receiving operand, and a sending operand described with USAGE OBJECT REFERENCE as determined by the following rules:
If a method is invoked with a class-name, the sending operand must be described with the same class-name and an ONLY phrase.
If a method is invoked with the predefined object references SELF or SUPER, the sending operand must be described with an ACTIVE-CLASS phrase.
If a method is invoked with an object reference described with an interface-name, the sending operand must be a universal object reference.
If a method is invoked with any other object reference, this identifier is used as the sending operand, including the ONLY phrase if specified.
If the sending operand selected by applying the above rules is described with a class-name or an ACTIVE-CLASS phrase, the presence or absence of the FACTORY phrase must be the same as in the returning item of the called source unit.
If the operands are not object references, then rule b) given under ’Elementary items passed BY REFERENCE’ applies.
If neither the formal nor the current return value is of the class object, then both of the operands must have the same PICTURE, USAGE, SIGN, JUSTIFIED, and BLANK WHEN ZERO clauses, with the following additional conditions:
If a decimal point appears in the Picture clause, then the same DECIMAL-POINT IS COMMA clause must be in effect for both the calling and the called source unit
If the formal returning item has the SYNCHRONIZED phrase, the current returning item must also have the same phrase or be defined on level 01.
If the formal returning item is defined with the ANY LENGTH clause, then its length is taken over as the length of the current returning item.
If the current returning item is defined with the ANY LENGTH clause then the associated formal returning item must also be defined with the ANYLENGTH clause.
If one of the operands is a type-specific pointer, both must be type-specific pointers and of the same type.