z/OS Assembler programs, macros and calls


This page shows, with small examples, the program and macro objects that the extension creates and the links it creates for program calls and macro invocations. Each example lists the objects and links it produces.

Programs

A file whose content is a program (an END, CSECT, RSECT or START statement) produces a z/OS Assembler Program object, named after the file, whatever its extension.

LOADED.asm:

LOADED   CSECT
         BR    14
         END
Type Name
z/OS Assembler Program LOADED

Macros

A file whose content is a MACRO … MEND definition, with no program statement, produces a z/OS Assembler Macro object, named after the file.

MYMACRO.asmacro:

         MACRO
         MYMACRO &REG,&VALUE
         L     &REG,=F'&VALUE'
         MEND
Type Name
z/OS Assembler Macro MYMACRO

Calls to an Assembler program of the same analysis

LOAD EP=

A LOAD EP=name statement is linked like a CALL. LOADER.asm loads LOADED.asm, an Assembler program of the same analysis, so the link goes directly to that program:

LOADER   CSECT
         STM   14,12,12(13)
         LR    12,15
         LOAD  EP=LOADED
         LR    15,0
         BALR  14,15
         LM    14,12,12(13)
         BR    14
         END
Caller type Caller Link Callee type Callee
z/OS Assembler Program LOADER call Link z/OS Assembler Program LOADED

In CAST Imaging:

asm_load_ep_to_program.svg

A LOAD EPLOC= statement names its program only at run time: it creates no link.

LINK, XCTL and ATTACH (and their LINKX, XCTLX and ATTACHX forms) pass control to the program named by their EP= operand. LINKED.asm, XCTLED.asm and ATTACHED.asm are Assembler programs of the same analysis:

LINKER   CSECT
         LINK  EP=LINKED,PARAM=(PARM1,PARM2),VL=1
         ATTACH EP=ATTACHED,ECB=TASKECB
         DELETE EP=LINKED
         XCTL  (2,12),EP=XCTLED
PARM1    DS    F
PARM2    DS    F
TASKECB  DS    F
         END   LINKER
Caller type Caller Link Callee type Callee
z/OS Assembler Program LINKER call Link z/OS Assembler Program ATTACHED
z/OS Assembler Program LINKER call Link z/OS Assembler Program LINKED
z/OS Assembler Program LINKER call Link z/OS Assembler Program XCTLED

In CAST Imaging:

asm_link_xctl_attach_ep_to_programs.svg

DELETE EP= does not pass control to the program: it creates no link.

Operation codes in lower case

The operation codes are read in any case, as HLASM does. LOWCASE.asm calls LOWCALLD.asm, an Assembler program of the same analysis:

lowcase  csect
         call  lowcalld
         br    14
         end   lowcase
Caller type Caller Link Callee type Callee
z/OS Assembler Program LOWCASE call Link z/OS Assembler Program LOWCALLD

In CAST Imaging:

asm_programs_lower_case_opcodes.svg

Calls to a program of another language or analysis unit

A call to a program that is not an Assembler program of the same analysis goes to a z/OS Assembler Call to Generic Program object. Only one such object is created for each called name, and it is shared by all callers. CALLERA.asm and CALLERB.asm both call SHAREDPGM, which is not part of the analysis:

CALLERA.asm:

CALLERA  CSECT
         STM    14,12,12(13)
         LR     12,15
         CALL   SHAREDPGM
         L      13,4(13)
         LM     14,12,12(13)
         BR     14

CALLERB.asm:

CALLERB  CSECT
         STM    14,12,12(13)
         LR     12,15
         CALL   SHAREDPGM
         L      13,4(13)
         LM     14,12,12(13)
         BR     14
Caller type Caller Link Callee type Callee
z/OS Assembler Program CALLERA call Link z/OS Assembler Call to Generic Program SHAREDPGM
z/OS Assembler Program CALLERB call Link z/OS Assembler Call to Generic Program SHAREDPGM

In CAST Imaging:

asm_programs_call_to_generic_program.svg

The same applies to LOAD EP=, LINK EP=, XCTL EP= and ATTACH EP=. The LOADER.asm and LINKER.asm files shown above also hold these statements, where COBLOAD and COBLINK are not part of the analysis:

         LOAD  EP=COBLOAD,ERRET=NOTFOUND
         LINKX EP=COBLINK
Caller type Caller Link Callee type Callee
z/OS Assembler Program LINKER call Link z/OS Assembler Call to Generic Program COBLINK
z/OS Assembler Program LOADER call Link z/OS Assembler Call to Generic Program COBLOAD

In CAST Imaging:

asm_programs_load_link_ep_to_generic_program.svg

For EXEC CICS LINK PROGRAM(...) and EXEC CICS XCTL PROGRAM(...), see EXEC CICS commands.

Macro invocations

A statement whose operation code is the name of a macro file of the same analysis is linked to that macro. PGM.asm invokes the macro MYMACRO shown above:

BALAPI   CSECT
         STM    14,12,12(13)
         LR     12,15
         MYMACRO R3,42
Caller type Caller Link Callee type Callee
z/OS Assembler Program PGM call Link z/OS Assembler Macro MYMACRO

In CAST Imaging:

asm_programs_macro_invocation.svg

The program object is named after its file (PGM.asm), not after its CSECT.

Calls from a macro

The calls, LOAD, LINK, XCTL, ATTACH and COPY statements of a macro file are linked from the macro. CALLMAC.asmacro calls MCALLED.asm, an Assembler program of the same analysis, loads MCOBPGM, which is not part of the analysis, and copies MCOPIED.asmacro, a macro file:

CALLMAC.asmacro:

         MACRO
&NAME    CALLMAC
&NAME    CALL  MCALLED
         LOAD  EP=MCOBPGM
         COPY  MCOPIED
         MEND

MCALLED.asm:

MCALLED  CSECT
         BR    14
         END   MCALLED

MCOPIED.asmacro:

         MACRO
&LABEL   MCOPIED
&LABEL   DS    0H
         MEND
Caller type Caller Link Callee type Callee
z/OS Assembler Macro CALLMAC call Link z/OS Assembler Program MCALLED
z/OS Assembler Macro CALLMAC call Link z/OS Assembler Macro MCOPIED
z/OS Assembler Macro CALLMAC call Link z/OS Assembler Call to Generic Program MCOBPGM

In CAST Imaging:

asm_programs_calls_from_macro.svg

For a macro that copies a copy member, see COPY in a macro.

Cross-technology calls

Calls to COBOL, PL/I and other Assembler programs

These links are created by Universal Linker after all technologies have been analyzed. It links each z/OS Assembler Call to Generic Program object to the program of that name: a COBOL program analyzed by the Mainframe Analyzer, a PL/I main procedure analyzed by the PL/1 Analyzer, or an Assembler program of another analysis unit.

In the example of CALLERA.asm above, CALLERA calls SHAREDPGM:

CALLERA  CSECT
         CALL   SHAREDPGM

Depending on what SHAREDPGM is in the application, Universal Linker creates one of these links:

Caller type Caller Link Callee type Callee
z/OS Assembler Call to Generic Program SHAREDPGM call Link PLI MainProcedure SHAREDPGM
z/OS Assembler Call to Generic Program SHAREDPGM call Link z/OS Assembler Program SHAREDPGM
z/OS Assembler Call to Generic Program SHAREDPGM call Link Cobol Program SHAREDPGM

In CAST Imaging:

asm_programs_calls_to_cobol_pli_asm.svg

When no program of that name is found, the z/OS Assembler Call to Generic Program object stays unresolved.

Calls from COBOL and PL/I programs to Assembler programs

The analyzer of a COBOL or PL/I program cannot resolve a call to an Assembler program. It links the calling program to an object for the unresolved program: a COBOL program prototype for the Mainframe Analyzer, a PLI Missing Program for the PL/1 Analyzer. Universal Linker then links that object to the Assembler program of that name.

ASMUTIL is an Assembler program of the analysis:

ASMUTIL  CSECT
         BR    14
         END   ASMUTIL

COBPGM1.cbl calls ASMUTIL with a CALL statement:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. COBPGM1.
      *    CALLS THE ASSEMBLER PROGRAM ASMUTIL
       PROCEDURE DIVISION.
           CALL 'ASMUTIL'.
           GOBACK.

PLIPGM1.pli calls ASMUTIL, declared as an Assembler entry:

 /* CALLS THE ASSEMBLER PROGRAM ASMUTIL */
 PLIPGM1: PROCEDURE OPTIONS(MAIN);
    DCL ASMUTIL ENTRY OPTIONS(ASM);
    CALL ASMUTIL;
 END PLIPGM1;
Caller type Caller Link Callee type Callee
Cobol Program ASMUTIL call Link z/OS Assembler Program ASMUTIL
PLI Missing Program ASMUTIL call Link z/OS Assembler Program ASMUTIL

In CAST Imaging:

asm_programs_calls_from_cobol_pli.svg

A COBOL program that loads an Assembler program with EXEC CICS LOAD PROGRAM('ASMUTIL') is linked the same way, through a COBOL program prototype.