REXX example to force complete aged Applications on CA Workload Automation ESP Edition
search cancel

REXX example to force complete aged Applications on CA Workload Automation ESP Edition

book

Article ID: 209324

calendar_today

Updated On:

Products

ESP Workload Automation

Issue/Introduction

We need to maintain our test system, so that aged applications can be cleared.

Environment

Release : 11.4 & 12.0

Component : CA ESP WORKLOAD AUTOMATION

Resolution

Here is an example:
Note: please do your own test first, and it's only an example, we officially don't support it.
- "ESP LAP -" will show all incomplete applications, with generations in descending order. When you test it, you can use "ESP LAP applname" for one APPL applname.
- "GENTIME X TODAY LESS 3 WORKDAYS"  means it will check for 3 workdays before, you can change it;
- The command to complete the applications will be written to ESP auditlog, like:
ESP6620I APPLMGR: APPL TES5.49 ALL COMPLETED BY LUCY
- You can define a scheduled event and INVOKE it.

REXXON                                                                
X=TRAPOUT('LAP.')                                                     
"ESP LAP -"                                                           
X=TRAPOUT('OFF')                                                      
"GENTIME X TODAY LESS 3 WORKDAYS"                                     
DATE1 = CLANGVAR("%XYEAR%XMM%XDD")                                    
DO I = 1 TO LAP.0                                                     
  IF LAP.I = "" THEN                                                  
    ITERATE                                                           
  PARSE UPPER VAR LAP.I VERB THEREST                                  
  SELECT                                                              
    WHEN VERB = "APPL" THEN                                           
      CALL DOAPPL                                                     
    WHEN VERB = "CREATED" THEN                                        
      CALL DOCREATED                                                  
      OTHERWISE NOP                                                   
  END                                                                 
END                                                                   
                                                                      
DOAPPL:                                                               
PARSE VAR THEREST APPL . APPLGEN .                                    
APPLICATION = STRIP(APPL)                                             
APPLGEN = STRIP(APPLGEN)                                              
RETURN                                                                
                                                                      
DOCREATED:                                                            
PARSE VAR THEREST . CREATE                                                                                            
"GENTIME Z" CREATE                                                    
DATE2 = CLANGVAR("%ZYEAR%ZMM%ZDD")                                    
IF DATE2 > DATE1 THEN RETURN   
"ESP AJ ALL TERMINATE APPL(" || APPLICATION || "." || APPLGEN || ")", 
      "REASON('FORCED BY USER')"  
RETURN                            
---------------