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


Calling assembler programs

When the assembler program is the caller, R13 must point to the caller's register save area (18 words), and the first 2 bytes of the save area must be zero. The save area back chain must be set with a valid 31-bit address. (That is, the high-order byte must be cleared when running AMODE 24.)

The recommended way to establish a register save area address is:
          LA   13, SAVEAREA
          .
          .
          .
SAVEAREA  DS   18F
as this will ensure that the high-order byte is cleared for AMODE 24 programs.
If you must use a branch and link type of instruction to jump over the save area and set its address, the preferred method is:
          BAS  13,SKIP
SAVEAREA  DS   18F
SKIP      DS   0H
If you use a BAL instruction, you must clear the high-order byte yourself, as follows:
          BAL  13,SKIP
SAVEAREA  DS   18F
SKIP      LA   13,0(,13)

The BAL instruction puts the instruction length code, the condition code (CC), and the program mask in the high-order byte of the register. We recommend using the BAS instruction instead of the BAL instruction, since the BAS instruction places zeros in the high-order byte, thus preventing the 24-bit addressing problem.

If the program passes parameters, a parameter list must be prepared, and the address of this list loaded into R1. R1 must be set to zero if no parameter list is passed. R14 must contain the return address in the assembler program, and R15 must contain the address of the entry point of the COBOL program.

Note: If you pass a parameter list, it must be a group of one or more contiguous fullwords, each of which contain the address of a data item to be passed to the COBOL program. It is recommended that the high-order bit of the last fullword address be set to 1, to flag the end of the list.

Terms of use | Feedback

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