DETACH-Examples


This example shows how to remove (DETACH) objects from the Definition Base that were previously added with an ATTACH function.

The DETACH function requires that you specify the TYPE parameter where the value can be one of the following values:

  • TYPE=SYSTEM: removes objects for one system using the values specified in the line.layersysplexline.systemlayer, and the line.system LOCAL variables
  • TYPE=SYSPLEX: removes objects for all of the systems using the values in the line.sysplex and line.sysplexlayer variables

Related topic

Important

The DETACH function must be used at the same level as the previous ATTACH function. Therefore, if the previous ATTACH function occurred at the system level, the DETACH function must also be issued on the system level.

If the previous ATTACH occurred at the sysplex level and you try to issue a DETACH function at the system level, TOM processing returns an 8 return code and the following message is written to the TOM log:

MAMTM306E MAMADMIN request error: System-Layer LayerName is not attached to system SystemName

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

/* REXX--------------------------------------------------------*/       
/*                                                             */       
/* 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

DDMMMYYY  16:01:32 ------ BMC AMI Ops WINDOW INTERFACE (V7.0.00) ---------------
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)

/* REXX--------------------------------------------------------*/     
/*                                                             */     
/* 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(SYSPLEX) TOMID(TOMV2) STEM(ATTSTM) SYSPLEX(BBPLEX01)
TOMEXEC FUNC(DETACH) TYPE(SYSTEM) TOMID(TOMV2) STEM(ATTSTM)  SYSPLEX(BBPLEX01)

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*