The number of arguments in the calling source unit must be equal to the number of formal parameters in the called unit, with the exception of trailing formal parameters that are specified with an OPTIONAL phrase in the Procedure Division header of the called unit and omitted from the list of arguments of the calling unit.
If either the formal parameter or the associated argument is a strongly typed group item, the formal parameter and the argument must be of the same type (see the
section "Types").
A national group is always treated as an elementary data item.
Group items
If either the formal parameter or the argument is a group item, then that argument or the formal parameter corresponding to it must be a group item or an alphanumeric elementary item. In this case, the formal parameter may be shorter than the current parameter.
Elementary items
The conformance rules for elementary items depend on whether the argument is passed BY REFERENCE, BY CONTENT or BY VALUE (phrases in the CALL or INVOKE statement).
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:
If either the argument or the formal parameter is a universal object reference, the corresponding formal parameter or argument must also be a universal object reference.
If either the argument or the formal parameter is described with an interface-name, the corresponding formal parameter or argument must have the same interface-name.
If the formal parameter is specified with a class name, the corresponding argument must be specified with the same class name. In addition, the FACTORY and ONLY phrases must be the same.
If the formal parameter is specified with ACTIVE-CLASS, one of the following conditions must apply:
The argument must be specified with ACTIVE-CLASS, and the method must be called with one of the predefined object references SELF or SUPER or with an object reference specified with ACTIVE-CLASS. In addition, the FACTORY phrase must be the same for the formal parameter and the argument.
The argument must be specified with a class name and the ONLY phrase, and the method must be called either with this class name or with an object reference specified with this class name and the ONLY phrase. In addition, the FACTORY phrase must be the same for the for the formal parameter and the argument.
If neither the formal parameter nor the argument is of class object, the following rules apply:
If the called source unit is a program for which there is no entry of a program prototype name (i.e. a program-specifier) in the REPOSITORY paragraph of the calling unit and there is no NESTED phrase specified on the CALL statement, the formal parameter must have the same number of character positions as the corresponding argument.
If the called unit is one of the following:
a program for which there is a program prototype name in the REPOSITORY paragraph of the calling unit,
a program, and the NESTED phrase is specified on the CALL statement,
a method,
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 parameter has the SYNCHRONIZED phrase, the current parameter (argument) must also have the same phrase or be defined on level 01.
If the formal parameter is defined with the ANY LENGTH clause, then its length is taken over as the length of the corresponding argument.
If the argument is defined with the ANY LENGTH clause then the associated formal parameter must also be defined with the ANY LENGTH clause.
If the argument or the formal parameter is a type-specific pointer, both must be typespecific pointers and of the same type.
Elementary items passed BY CONTENT or BY VALUE
If the formal parameter is an object reference specified wtih ACTIVE-CLASS, one of the following conditions must apply:
The method must be called with one of the predefined object references SELF or SUPER or with an object reference specified with ACTIVE-CLASS. A SET statement with, as the sending operand, the argument and, as the receiving operand, an object reference specified with ACTIVE-CLASS with the same FACTORY phrase as the formal parameter must be valid in the calling runtime unit.
The method must be called with a class name or with an object reference that is specified with a class name and the ONLY phrase. A SET statement with, as the sending operand, the argument and, as the receiving operand, an object reference specified with this class name and the ONLY phrase with the same FACTORY phrase as the formal parameter must be valid in the calling runtime unit.
If the formal parameter is an object reference that is not specified with ACTIVE-CLASS, the conformance rules are the same as when a SET statement is executed in the calling runtime unit with the argument as the sending operand and the corresponding formal parameter as the receiving operand.
If the formal parameter is not of the “object” class, the following conformance rules apply:
If the called source unit is a program for which there is no entry of a program prototype name (i.e. a program-specifier) in the REPOSITORY paragraph of the calling unit and there is no NESTED phrase specified on the CALL statement, the formal parameter must have the same number of character positions as the corresponding argument.
If the called unit is one of the following:
a program for which there is a program prototype name in the REPOSITORY paragraph of the calling unit,
a program, and the NESTED phrase is specified on the CALL statement,
a method,
If the formal parameter is numeric, the conformance rules are the same as for a COMPUTE statement with the argument as the sending operand and the corresponding formal parameter as the receiving operand.
If the formal parameter is an index elementary item or an elementary item of the class “pointer”, a SET statement with the argument as the sending operand and the corresponding formal parameter as the receiving operand must be permissible.
Otherwise, a MOVE statement with the argument as the sending operand and the corresponding formal parameter as the receiving operand is permissible.
If the formal parameter is defined with the ANY LENGTH clause, then:
The associated argument must be of the class “alphabetic”, “alphanumeric” or national and be defined with the same USAGE DISPLAY or USAGE
NATIONAL.The associated argument must not be defined with the ANY LENGTH clause.
The length of the formal parameter corresponds to the length of the argument.