Example of using the assembler ATTACH macro (CCNUAAP)
The following example demonstrates the usage of the assembler ATTACH macro.
***********************************************************************
* *
* This assembler routine demonstrates DD Name renaming *
* (Dynamic compilation) using the Assembler ATTACH macro. *
* *
* In this specific scenario all the DDNAMES are renamed. *
* *
* The TASKLIB option of the ATTACH macro is used *
* to specify the steplib for the ATTACHed command (ie. the compiler) *
* *
* The Compiler and Library should be specified on the DD *
* referred to in the DCB for the TASKLIB if one or both *
* are not already defined in LPA. The compiler and library do not *
* need to be part of the steplib concatenation. *
* *
***********************************************************************
ATTACH 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 ATTACH macro
*
OPEN (COMPILER)
ATTACH EP=CCNDRVR,PARAM=(OPTIONS,DDNAMES),VL=1,DCB=COMPILER, X
ECB=ECBADDR,TASKLIB=COMPILER
ST 1,TCBADDR
WAIT 1,ECB=ECBADDR
DETACH TCBADDR
CLOSE (COMPILER)
L 13,4(,13)
LM 14,12,12(13)
SR 15,15
BR 14
*
* Constant and save area
*
SAVE DC 18F'0'
ECBADDR DC F'0'
TCBADDR DC F'0'
OPTIONS DC H'12',C'SOURCE EVENT'
* For C++, substitute the above line with
* OPTIONS DC H'10',C'CXX SOURCE'
DDNAMES DC H'152'
DC CL8'NEWIN'
DC CL8'NEWLIN'
DC CL8'DUMMY' PLACEHOLDER - NO LONGER USED
DC CL8'NEWLIB'
DC CL8'NEWRLIB'
DC CL8'NEWPRINT'
DC CL8'NEWCPRT'
DC CL8'NEWPUNCH'
DC CL8'NEWUT1'
DC CL8'NEWUT4'
DC CL8'NEWUT5'
DC CL8'NEWUT6'
DC CL8'NEWUT7'
DC CL8'NEWUT8'
DC CL8'NEWUT9'
DC CL8'NEWUT10'
DC CL8'NEWUT14'
DC CL8'NEWUT15'
DC CL8'NEWEVENT'
COMPILER DCB DDNAME=MYCOMP,DSORG=PO,MACRF=R
END