Example of using the assembler LINK macro (CCNUAAR)

The following example demonstrates the usage of the assembler LINK macro.

***********************************************************************
*                                                                     *
*  This assembler routine demonstrates DD Name renaming               *
*  (Dynamic compilation) using the assembler LINK macro.              *
*                                                                     *
*  In this specific scenario a subset of all the DDNAMES are          *
*  renamed.  The DDNAMES you do not want to rename are set to zero.   *
*                                                                     *
*  The Compiler and the Library should be in the LPA, or should       *
*  be specified on the STEPLIB DD in your JCL                         *
*                                                                     *
***********************************************************************
*
LINK     CSECT
         STM   14,12,12(13)
         BALR  3,0
         USING *,3
         LR    12,15
         ST    13,SAVE+4
         LA    15,SAVE
         ST    15,8(,13)
         LR    13,15
*
*   Invoke the compiler using LINK macro
*
         LINK  EP=CCNDRVR,PARAM=(OPTIONS,DDNAMES),VL=1
         L     13,4(,13)
         LM    14,12,12(13)
         SR    15,15
         BR    14
*
*   Constant and save area
*
*   This macro will compile for the Language Environment Library
*
SAVE     DC    18F'0'
OPTIONS  DC    H'8',C'SO EVENT'
*   For C++, substitute the above line with
*   OPTIONS  DC    H'6',C'CXX SO'
DDNAMES  DC    H'152'
         DC    CL8'NEWIN'
         DC    XL8'0000000000000000'
         DC    XL8'0000000000000000'
         DC    XL8'0000000000000000'
         DC    CL8'NEWRLIB'
         DC    XL8'0000000000000000'
         DC    CL8'NEWCPRT'
         DC    XL8'0000000000000000'
         DC    2XL8'0000000000000000'
         DC    2XL8'0000000000000000'
         DC    2XL8'0000000000000000'
         DC    XL8'0000000000000000'
         DC    XL8'0000000000000000'
         DC    XL8'0000000000000000'
         DC    XL8'0000000000000000'
         DC    XL8'0000000000000000'
         END