DETACH-Examples
The following sample EXEC shows how to use the DETACH function to delete objects and sets generated by a previous ATTACH function (or command) for a specific system of a Layer Sysplex.
Sample EXEC for DETACH function for a system layer for a single system
/* */
/* A sample EXEC that will detach the layer objects in a */
/* definition base */
/* */
/*-------------------------------------------------------------*/
PARSE UPPER ARG EXECNAME FILLER
DROP LINE.
LINE.LAYERSYSPLEX = 'BBPLEX01'
LINE.SYSTEMLAYER = 'SYS-LAYER'
LINE.SYSTEM = 'SJSC'
'TOMEXEC FUNC(DETACH) TYPE(SYSTEM) STEM(LINE)'
'IMFEXEC MSG 'Return code for DETACH is 'TOMRC'''
/*-------------------------------------------------------------*/
/* */
/* This section will report on any exception messages issued */
/* by the DETACH function that was just issued. */
/* */
/*-------------------------------------------------------------*/
IF TOMRC /= 0 THEN
DO I=1 TO LINE.EXCEPT.0
'IMFEXEC MSG ''LINE.EXCEPT.I'''
END
'IMFEXEC EXIT CODE('TOMRC')'
After the EXEC completes, you can display the TST view and verify that the object is removed only for system SJSC:
TST view after DETACH function EXEC completes
COMMAND ===> SCROLL ===> PAGE
CURR WIN ===> 1 ALT WIN ===>
>W1 =TST===============SJSCKMZ1=*========DDMMMYYYY==16:01:32====MVTOM====D====2
- All StartedTask Objects - Hide Fixed Sectio
Active DefBase........: DEFAULT Sysplex: BBPLEX01
Edit DefBase..........: PRODUCTION Sysplex: BBPLEX01
CMD Object Name STC-Name StepName ASID Tran ValSys Scheds GCOsch Deps
--- -------------------- -------- -------- ---- ---- ------ ------ ------ -----
TKEN MAMKZ001 1 0 0 0
The following sample EXEC shows how to use the DETACH function to remove an object for all of the systems defined to the Layer Sysplex (Sysplex Matrix):
Sample EXEC for DETACH for all of the systems in the Layer Sysplex (Sysplex Matrix)
/* */
/* A sample EXEC that will delete objects and sets */
/* generated by a previous ATTACH at the SYSPLEX level. */
/* */
/*-------------------------------------------------------------*/
PARSE UPPER ARG EXECNAME FILLER
DROP LINE.
LINE.SYSPLEXLAYER = 'PLEX-LAYER'
LINE.SYSPLEX = 'BBPLEX01'
'TOMEXEC FUNC(DETACH) TYPE(SYSPLEX) STEM(LINE)'
'IMFEXEC MSG 'Return code for DETACH is 'TOMRC'''
/*-------------------------------------------------------------*/
/* */
/* This section will report on any exception messages issued */
/* by the DETACH function that was just issued. */
/* */
/*-------------------------------------------------------------*/
IF TOMRC /= 0 THEN
DO I=1 TO LINE.EXCEPT.0
'IMFEXEC MSG ''LINE.EXCEPT.I'''
END
'IMFEXEC EXIT CODE('TOMRC')'
After the EXEC completes, you can verify that the generated objects have been deleted.
The following example shows the syntax for the DETACH function:
TOMEXEC FUNC(DETACH) TYPE(SYSTEM) TOMID(TOMV2) STEM(ATTSTM) SYSPLEX(BBPLEX01)