Language Environment considerations for Assembler applications

Like HLL programs, assembler programs are classified as either conforming or non-conforming with respect to Language Environment®. For assembler programs, conformance depends on the linkage and register conventions observed, rather than the assembler used. By definition, a Language Environment-conforming assembler routine is defined as one coded using the CEEENTRY and associated Language Environment macros.

Conformance governs the use of assembler programs by call from an HLL program. Both conforming and non-conforming assembler subroutines may be called either statically or dynamically from C or C++, COBOL or PL/I. However, there are differences in register conventions and other requirements for the two types. These are described below. Rules for mixing languages, including assembler, are discussed in Mixing languages in Language Environment.

Start of changeConforming MAIN programsEnd of change
Start of changeIf you are coding a new assembler MAIN program that you want to conform to the Language Environment interface or if your assembler routine calls Language Environment services, observe the following: End of change
Start of changeConforming sub-routines programsEnd of change
Start of changeIf you are coding a new assembler sub-routine that you want to conform to the Language Environment interface or if your assembler routine calls Language Environment services, observe the following: End of change
Start of changeAll conforming routinesEnd of change
To communicate properly with assembler routines, observe certain register conventions on entry to the assembler routine, while it is running, and on exit from the assembler routine.
Entry

On entry into a Language Environment-conforming assembler subroutine, these registers must contain the following values when NAB=YES is specified on the CEEENTRY macro:

R0
Reserved
R1
Address of the parameter list, or zero
R12
Common anchor area (CAA) address
R13
Caller's dynamic storage area (DSA)
R14
Return address
R15
Entry point address

Language Environment-conforming HLLs generate code that follows these register conventions, and the supplied macros do the same when you use them to write your Language Environment-conforming assembler routine. On entry to an assembler routine, CEEENTRY saves the caller's registers (R14 through R12) in the DSA provided by the caller. It allocates a new DSA and sets the NAB field correctly in this new DSA. The first half word of the new DSA is set to binary zero and the back chain in the second word is set to point to the caller's DSA.

While the subroutine is running

R13 must point to the routine's DSA at all times while the Language Environment-conforming assembler routine is running.

At any point in your code where you CALL another program, R12 must contain the common anchor area (CAA) address, except in the following cases:

  • When calling a COBOL program
  • When calling an assembler routine that is not Language Environment-conforming
  • When calling a Language Environment-conforming assembler routine that specifies NAB=NO on the CEEENTRY macro
Exit

On exit from a Language Environment-conforming assembler routine, R0, R1, R14, and R15 are undefined. All the other registers must have the contents they had upon entry.

The CEEENTRY macro automatically sets a module to AMODE (ANY) and RMODE (ANY). If you are converting an existing assembler routine to be Language Environment-conforming and the routine contains data management macros coded using 24-bit addressing mode, then you should change the macros to use 31-bit mode. If it is not possible to change all the modules making up a program to use 31-bit addressing mode, and if none of the modules explicitly sets RMODE (24), then you should set the program to be RMODE (24) during the link-edit process.

Non-conforming routines
Observe the following conventions when running non-Language Environment-conforming subroutines under Language Environment: If your assembler routine relies on C/C++, COBOL, or PL/I control blocks (for example, a routine that tests flags or switches in these control blocks), check that these control blocks have not changed under Language Environment . For more information, see the appropriate Language Environment migration guide.

Non-conforming routines cannot use Language Environment callable services.

Note:
CICS does not allow the use of HANDLE ABEND LABEL in Assembler programs that do not use DFHEIENT and DFHEIRET. Assembler programs that use the Language Environment stub CEESTART should either use HANDLE ABEND PROGRAM or a Language Environment service such as CEEHDLR. See Using Language Environment Abend-handling for information about CEEHDLR.

For more information or for explanations of the terms used in this section see the chapter on "Assembler Considerations" in the z/OS Language Environment Programming Guide.

[[ Contents Previous Page | Next Page Index ]]