Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Conformance between interfaces

An interface interface-1 conforms to an interface interface-2 if and only if:

  1. For every method in interface-2 there is a method in interface-1 with the same name taking the same number of parameters, with consistent BY REFERENCE, BY VALUE and OPTIONAL specifications.

  2. If the formal parameter of a given method in interface-2 is an object reference, the corresponding parameter in interface-1 must be an object reference following these rules:

    1. If the parameter in interface-2 is a universal object reference, the corresponding parameter in interface-1 must also be a universal object reference.

    2. If the parameter in interface-2 is described with an interface-name, the corresponding parameter in interface-1 must have the same interface-name.

    3. If the parameter in interface-2 is described with a class-name, the corresponding parameter in interface-1 must have the same class-name, and the presence or absence of the FACTORY and ONLY phrases must be the same in both interfaces.

    4. If the parameter in interface-2 is described with ACTIVE-CLASS, the corresponding parameter in interface-1 must also be described with ACTIVE-CLASS. The FACTORY phrase must be either present or not present at both interfaces.

  3. If the formal parameter of a given method in interface-2 is not an object reference, the corresponding formal parameter in interface-1 must have the same ANY LENGTH, PICTURE, USAGE, SIGN, JUSTIFIED, BLANK WHEN ZERO and SYNCHRONIZED clauses. Furthermore, the following additional condition applies:
    If a decimal point appears in the Picture clause, then the same DECIMAL-POINT IS COMMA clause must be in effect for both interface-1 and interface-2.

  4. The presence or absence of the RETURNING phrase in the Procedure Division must be the same in the corresponding methods.

  5. If the returning item in a given method of interface-2 is an object reference, the corresponding returning item in interface-1 must also be an object reference following these rules:

    1. If the returning item in interface-2 is a universal object reference, the corresponding returning item in interface-1 must also be an object reference.

    2. If the returning item in interface-2 is described with an interface-name that identifies the interface int-r, the corresponding returning item in interface-1 must be either of the following:

      1. an object reference for an interface that conforms to int-r

      2. an object reference for a class, in accordance with the following rules:

        1. If a FACTORY phrase exists, the factory interface of the specified class must be in conformance with int-r.

        2. If no FACTORY phrase exists, the object interface of the specified class must be in conformance with int-r.

    3. If the returning item in interface-2 is described with a class-name, the corresponding returning item in interface-1 must be an object reference, subject to the following rules:

      1. If the returning item in interface-2 is described with the ONLY phrase, then the returning item in interface-1 must also be described with the ONLY phrase and the same class-name.

      2. If the returning item in interface-2 is described without the ONLY phrase, then the returning item in interface-1 must also be described with the same class-name or a subclass of that class-name.

      3. The presence or absence of the FACTORY phrase must be the same.

    4. If the returning item in interface-2 is described with the ACTIVE-CLASS phrase, the corresponding returning item in interface-1 must also be described with the ACTIVE-CLASS phrase, and the presence or absence of the FACTORY phrase must be the same.

    If the description of the returning item of a method in interface-1 directly or indirectly references interface-2, the description of the returning item of the corresponding method in interface-2 must not directly or indirectly reference interface-1.

  6. If the returning item in a given method of interface-2 is not an object reference, the corresponding returning item must have the same ANYLENGTH, PICTURE, USAGE, SIGN, JUSTIFIED, BLANK WHEN ZERO and SYNCHRONIZED clauses. Furthermore, the following additional condition applies:
    If a decimal point appears in the Picture clause, then the same DECIMAL-POINT IS COMMA clause must be in effect for both interface-1 and interface-2.

Example 12-24


Interface i1
    Method X    no parameters
    Method Y    using a with 01 a Pic 999 usage display.

Interface i2
    Method Y    using b with 01 b Pic 9(3).

Interface i3
    Method Y    using c with 01 c Pic 9(4)
    Method Z    returning d with 01 d usage object reference i1

Interface i4
    Method Z    returning e with 01 e usage object reference i2


Notes

  1. Interface i1 conforms with Interface i2, since method Y from i2 also exists in i1 and its parameter definitions are the same (9(3) is equivalent to 999 and the usage display is standard).

  2. Interface i2 does not conform with Interface i1, since method X does not exist in i2.

  3. Interface i3 does not conform with Interface i2 although methods from i2 are also present in i3 because the parameters are defined differently here (9(4) instead of 9(3)).

  4. Interface i3 conforms with i4, since method Z exists in both, and the returning items, though not identical, still match: Interface i1 (from the method definition of Z in i3) conforms with i2 (from the method definition of Z in Z in i4).