Autonomic computing examples

These examples illustrate autonomic computing capabilities associated with the REXX SPOC API. Autonomic indicates that the code is responsive and can take certain actions to correct what it determines to be incorrect.

Autonomic example 1

In the following example, a transaction is queried. If the transaction is stopped, the REXX SPOC API attempts to start it. The REXX SPOC API examines the information returned by CSLULGTS, looking specifically for the line that refers to the transaction of interest.

/* autonomic computing example 1 */            
"CART  qrytran12"                              
"qry tran name(CDEBTRN3) show(status)"                   
results = cslulgts("resp.","qrytran12","3:15") 
                                               
Do idx = 1 to resp.0                           
  /* find which IMS and the status of tran */  
  parse var resp.idx . "TRAN(CDEBTRN3" . ,     
                        "MBR(" imsname ")" . , 
                       "LSTT(" status ")" .    
                                               
  /* if tran is stoppped, try to start it */   
  If pos('STOSCHD', status)  > 0 Then          
    Do                                         
      /* send command to IMS that needs to restart tran */ 
      "ROUTE"  imsname                         
      "UPD TRAN NAME(CDEBTRN3) START(SCHD)"    
    End                                        
End                                            

Autonomic example 2

In the following example, the QUERY command is used to determine the queue count (qcnt) of a transaction. A qcnt with a value greater than 5 is considered a problem. The REXX SPOC API attempts to resolve the problem by starting another region and changing the transaction to a different class.

/* autonomic computing example 2  */                          
"CART  qrytran13"                                             
"qry tran name(sks1) show(qcnt)"                              
results = cslulgts("resp.", "qrytran13", "3:15")              
Do idx = 1 to resp.0                                          
   parse var resp.idx . "TRAN(SKS1" . "Q(" count ")" .        
   If count ¬= ''  &,                                         
      count  > 5 Then                                         
    Do                                                        
       "CART  strtrgn05"                                      
       "START REGION IMSRG5"                                  
       start? = cslulgts("strt.", "strtrgn05", "10:00")       
       if imsrc = '00000000X' then
         Do                                                   
           "CART  updtran14"                                  
           "update tran name(SKS1) set(class(5))"             
         End                                                  
     End                                                      
End                                                           
"END"