Example (Assembler)

The following is an example of an IDIXSFOR assembler exit.
         TITLE 'IDIXSFOR HLASM EXAMPLE'
*
*        The map of input/output parameters
*
PARMLIST DSECT
DSETNM@  DS    A        Address of side file data set name
DSETLEN  DS    A        Address of side file data set name length
LANGCODE DS    A        Address of language code
CUNM@    DS    A        Address of CU name
CUNMLEN  DS    A        Address of CU name length
LDMDMN@  DS    A        Address of load module name
LDMDMNLN DS    A        Address of load module name length
LDLBMN@  DS    A        Address of load library name
LDLBMNLN DS    A        Address of load library name length
FORCE@   DS    A        Address of force return option word
*
*        Language Codes
*
LANCOBOL EQU    4       COBOL
LANVSCBL EQU   41       VS COBOL II (under LE)
LANPLI   EQU   10       PL/I (other than Enterprise PL/I)
LANPLIEN EQU   11       Enterprise PL/I
LANC     EQU    3       C source
LANCDWRF EQU   35       C side file compiled with FORMAT(DWARF)
LANCMDBG EQU   37       C MDBG side file
LANASSEM EQU    7       Assembler, OS/VS COBOL, Non-LE VS COBOL II
*
*        force options
*
FORCEL12 EQU   1        Force accept mismatch of last 12 object inst.
FORCEIGN EQU   -1       Ignore side file processing for this CU
*
*        Prologue
*
IDIXSFOR CEEENTRY AUTO=DSASIZ,    Amount of main memory to obtain      *
               PPA=PPA3,          Program Prolog Area for this routine *
               MAIN=NO,           This program is a Subroutine         *
               NAB=NO,            NO- not called from LE-enabled pgm   *
               PARMREG=R3,        R1 value is saved here               *
               BASE=R11           Base register for executable code,
*                                      constants, and static variables
         USING CEECAA,R12         Common Anchor Area addressability
         USING CEEDSA,R13         Dynamic Storage Area addressability
         USING PARMLIST,R3
         L     R4,DSETNM@          Addr of side file data name address
         L     R4,0(R4)            Addr of side file data name
         L     R5,DSETLEN          Addr of side file data name length
*
         L     R6,LANGCODE         Addr of language code
         L     R6,0(R6)            Language code
*
         L     R7,CUNM@            Addr of CU name address
         L     R7,0(R7)            Addr of CU name
         L     R8,CUNMLEN          Addr of CU name length addr
*
         L     R9,LDMDMN@          Addr of load mod name address
         L     R9,0(R9)            Addr of load mod name
         L     R10,LDMDMNLN        Addr of load mod name length
*
         L     R2,LDLBMN@          Addr of load library name address
         L     R2,0(R2)            Addr of load library name
         L     R0,LDLBMNLN         Addr of load library name length
         C     R6,=A(LANCOBOL)     LANGCODE exit if not COBOL
         BNE   EXIT
*
*   Typical processing will use the load library DSN and the
*   compile unit name to determine the side file DSN with the
*   member name normally being the compile unit name.
*
*   When the input DSETNM is provided for a TEST(,SEPARATE) compile,
*   the LDLBNM may show (via data set naming conventions) the
*   application has been promoted from test to production. This
*   would allow input DSETNM generated at compile time to be altered
*   according to the data set naming conventions to locate the new
*   (promoted) location of the side file.
*
NEXT     EQU   *
*   If input load dsn name is PROD.LOAD, then
*   tell FA to ignore last 12 instruction mismatch
*   and change the DSN to TEST.IDILCOB
         CLC   =C'PROD.LOAD',0(R2)
         BNE   EXIT
         L     R1,FORCE@
         MVC   0(4,R1),=A(FORCEL12) force accept mismatch last 12 inst.
         MVC   0(14,R4),=C'''TEST.IDILCOB('
         MVC   14(8,R4),0(R7)               add member name = CU name
         L     R6,0(,R8)                    load CU name length
         LA    R6,14(R4,R6)                 point to end
         MVC   0(2,R6),=C')'''              close bracket and quote
         LA    R6,2(R6)                     include in length
         SR    R6,R4                        subtract beginning
         ST    R6,0(R5)                     set new name length
EXIT     EQU   *
*
*        Epilogue
*
         CEETERM RC=0
         LTORG ,
*
*
*        Symbolic Register Definitions and Usage
*
R0       EQU   0             Work register
R1       EQU   1             Parameter list address (upon entry)
R2       EQU   2             Work register
R3       EQU   3             Parameter list address (after CEEENTRY)
R4       EQU   4             Work register
R5       EQU   5             Work register
R6       EQU   6             Work register
R7       EQU   7             Work register
R8       EQU   8             Work register
R9       EQU   9             Work register
R10      EQU   10            Work register
R11      EQU   11            Base register for executable code
R12      EQU   12            Common Anchor Area address
R13      EQU   13            Save Area/Dynamic Storage Area address
R14      EQU   14            Return point address
R15      EQU   15            Entry point address
*
PPA3     CEEPPA ,                 Program Prolog Area for this routine
*
*        Map the Dynamic Storage  Area (DSA)
*
         CEEDSA ,            Map standard CEE DSA prologue
*
*        Local Automatic (Dynamic) Storage..
*
DSASIZ   EQU   *-CEEDSA      Length of DSA
*
*        Map the Common Anchor Area (CAA)
*
         CEECAA
         END   ,                   of IDIXSFOR