How to clean up old incomplete Applications automatically.
Define an event to invoke REXX. A sample REXX code is found below. (This is an example and needs to be tested. User written codes are unsupported.)
Note:
"ESP LAP -" will show all incomplete applications, with generations in descending order. Use ESP LAP applname to test one application.
"GENTIME X TODAY LESS 3 WORKDAYS" means it will check for 3 workdays before. Change to any desired value.
The command to complete the applications will be written to the ESP auditlog. Example: ESP6620I APPLMGR: APPL TES5.49 ALL COMPLETED BY username
---------------------
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')"