Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Compiler and Runtime Migration Guide


Invoking programs - AMODE requirements

With VS COBOL II, assembler programs could invoke COBOL programs regardless of the AMODE specification. For example:
Figure 1. Effect of AMODE for invoking programs
igym1019 Begin figure description. This figure shows examples of assembler programs with VS COBOL II invoking COBOL programs regardless of the AMODE specification. End figure description.

In the figure above, the following occurs:

  1. Program COBOLA dynamically calls AssemblerA. (Assembler is AMODE 31.)
  2. AssemblerA loads COBOLB which is RENT, DATA(24), and AMODE(24).
  3. AssemblerA BALRs to COBOLB. (Now, COBOLB is entered in AMODE 31.)
  4. COBOLB returns to AssemblerA.
  5. AssemblerA calls AssemblerB.
  6. AssemblerB does a BASSM to COBOLB. (COBOLB is entered in AMODE 24.)
  7. COBOLB abends because it expects to be entered in AMODE 31.

Under Language Environment, COBOL programs compiled with VS COBOL II, IBM COBOL, or Enterprise COBOL that are invoked by assembler programs must be entered in the same AMODE each time that they are called.

To avoid the abend in the example above:

If an assembler program that is AMODE 31 calls a COBOL program that is AMODE 24, the assembler program must also be RMODE 24 in order for COBOL to return to the assembler program. If the assembler program is AMODE ANY in this case, an abend might result upon return from the COBOL program as a result of branching to an address that is not valid. This is because R14 will contain a 31-bit address from the assembler program's save area, but COBOL will return to the assembler program in AMODE 24.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)