z/OS Assembler COPY members


This page shows, with small examples, the copy member objects that the extension creates and the links it creates for COPY statements. A COPY statement is linked to each analyzed file of that name, ignoring case: a copy member, a macro file or a program file.

Copy members

A file that holds Assembler statements but no program and no macro definition (DSECTs, DS, DC and EQU statements, code fragments) is a copy member. It produces a z/OS Assembler Copy Member object, named after the file, only when a COPY statement of an analyzed file names it. COPYPGM.asm copies MYDSECTS.asm:

MYDSECTS.asm:

MYDSECT  DSECT
MYFIELD  DS    CL8

COPYPGM.asm:

COPYPGM  CSECT
         STM   14,12,12(13)
         LR    12,15
         USING MYDSECT,2
         MVC   MYFIELD,=CL8'COPIED'
         LM    14,12,12(13)
         BR    14
         COPY  MYDSECTS
         END
Caller type Caller Link Callee type Callee
z/OS Assembler Program COPYPGM call Link AssemblerZOS_CopyMember MYDSECTS

In CAST Imaging:

asm_copy_copy_members.svg

A copy member that no COPY statement names produces no object. A COPY of a member that is not delivered, such as COPY DFHAID for a CICS system member, creates no object and no link.

COPY of a macro file

COPYPGM.asm also copies MYMACS.asmacro, a macro file:

         COPY  MYMACS

MYMACS.asmacro:

         MACRO
&LABEL   MYMACS
&LABEL   DS    0H
         MEND
Caller type Caller Link Callee type Callee
z/OS Assembler Program COPYPGM call Link z/OS Assembler Macro MYMACS

In CAST Imaging:

asm_copy_macro_file.svg

COPY in a macro

The COPY statements of a macro file are linked from the macro. COPYMAC.asmacro copies MYEQUS.asm, a copy member of register equates:

COPYMAC.asmacro:

         MACRO
&LABEL   COPYMAC
         COPY  MYEQUS
&LABEL   DS    0H
         MEND

MYEQUS.asm:

R0       EQU   0
R1       EQU   1
Caller type Caller Link Callee type Callee
z/OS Assembler Macro COPYMAC call Link AssemblerZOS_CopyMember MYEQUS

In CAST Imaging:

asm_copy_in_macro.svg

For a macro that copies another macro file, see Calls from a macro.

Nested copy members

A copy member can copy other copy members, with no limit on the number of levels. Each COPY statement is linked from the file that holds it. NESTPGM.asm copies NESTA.asm, which copies NESTB.asm, which copies NESTC.asm:

NESTPGM.asm:

NESTPGM  CSECT
         USING NESTA,1
         COPY  NESTA
         MVC   AFIELD,=CL8'NESTED'
         BR    14
         END   NESTPGM

NESTA.asm:

NESTA    DSECT
AFIELD   DS    CL8
ALENGTH  DS    H
         COPY  NESTB

NESTB.asm:

BFLAG1   EQU   X'80'
BFLAG2   EQU   X'40'
         COPY  NESTC

NESTC.asm:

CMAXLEN  EQU   256
CMINLEN  EQU   1
Caller type Caller Link Callee type Callee
z/OS Assembler Program NESTPGM call Link AssemblerZOS_CopyMember NESTA
AssemblerZOS_CopyMember NESTA call Link AssemblerZOS_CopyMember NESTB
AssemblerZOS_CopyMember NESTB call Link AssemblerZOS_CopyMember NESTC

In CAST Imaging:

asm_copy_nested.svg

Code fragments

A copy member can also hold machine instructions only. Its file extension does not matter: CLRWORK.asmacro and PACKNUM.asmacro are copy members, since they hold no macro definition. FRAGPGM.asm copies both:

FRAGPGM.asm:

FRAGPGM  CSECT
         COPY  CLRWORK
         COPY  PACKNUM
         BR    14
WORKAREA DS    CL320
ZONED    DS    CL15
PACKED   DS    PL8
         END   FRAGPGM

CLRWORK.asmacro:

         XC    WORKAREA(256),WORKAREA
         XC    WORKAREA+256(64),WORKAREA+256

PACKNUM.asmacro:

         PACK  PACKED(8),ZONED(15)
         ZAP   PACKED,PACKED
Caller type Caller Link Callee type Callee
z/OS Assembler Program FRAGPGM call Link AssemblerZOS_CopyMember CLRWORK
z/OS Assembler Program FRAGPGM call Link AssemblerZOS_CopyMember PACKNUM

In CAST Imaging:

asm_copy_code_fragments.svg

The statements of a copy member are code of the program that copies it. Its calls, macro invocations, EXEC SQL blocks and EXEC CICS commands are linked from the copy member. CODEPGM.asm copies CODECPY.asm. CODECALD.asm is an Assembler program of the same analysis, CODECOB is not part of the analysis, and CODEMAC.asmacro is a macro file:

CODEPGM.asm:

CODEPGM  CSECT
         COPY  CODECPY
         BR    14
REC      DS    CL80
ENAME    DS    CL20
         END   CODEPGM

CODECPY.asm (first lines):

         MVC   REC(4),=C'CODE'
         CALL  CODECALD
         CALL  CODECOB
         CODEMAC
         EXEC SQL
            SELECT LASTNAME INTO :ENAME FROM EMP
         END-EXEC
Caller type Caller Link Callee type Callee
AssemblerZOS_CopyMember CODECPY call Link z/OS Assembler SQL Query SELECT LASTNAME INTO :ENAME
AssemblerZOS_CopyMember CODECPY call Link z/OS Assembler Macro CODEMAC
z/OS Assembler Program CODEPGM call Link AssemblerZOS_CopyMember CODECPY
AssemblerZOS_CopyMember CODECPY call Link z/OS Assembler Program CODECALD
AssemblerZOS_CopyMember CODECPY call Link z/OS Assembler Call to Generic Program CODECOB

In CAST Imaging:

asm_copy_code_links.svg

The SQL query is a child of the copy member. The EXEC CICS commands of CODECPY.asm are shown in Commands of a copy member.