ESP Workload Automation

 View Only

 ESP

Sravani Kolli's profile image
Sravani Kolli posted Aug 28, 2024 03:15 PM

Hello Team, 

I have scheduling requirement to code, if a file trigger job doesn't gets completed at certain time of the day, it should get the job force completed. I tried adding Abandon submission HH:MM, but it doesn't seem like working for file trigger job, but it is working fine for other jobs like Windows jobs.

So, to achieve this I have written a Link job and set to run at certain time of the day. This is working fine if the job doesn't gets completed, but if the job gets completed then by adding another Link job to force complete FORCE_COMPLETE job. The FC_JOB will be released by TESTJOB. Is there any other smart way of doing it? 

FILE_TRIGGER TESTJOB
...
RELEASE ADD(FC_JOB)

ENDJOB

JOB FC_JOB LINK PROCESS

    ESP AJ FORCE_COMPLETE_TESTJOB COMPLETE APPL(TEST.%ESPAPGEN)

ENDJOB


JOB FORCE_COMPLETE_TESTJOB TASK SELFCOMPLETING 

    DELAYSUB 23:00
    ESP AJ TESTJOB COMPLETE APPL(TEST.%ESPAPGEN)
    ESP AJ FC_JOB COMPLETE APPL(TEST.%ESPAPGEN)
ENDJOB

Rick Romanowski's profile image
Rick Romanowski

For consistency I made both jobs with the AJ commands "TASK SELFCOMPLETING"

I added The COMPLETED function to determine whether the application is complete.

https://techdocs.broadcom.com/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/using/use-procedures/use-built-in-functions/workload-status-functions.html

I added SEND statements to show the job flow.

The code listed below appears to work in my environment, please test fully in your environment.


ESP PROC

FILE_TRIGGER TEST_JOB                                          
  SEND '> Job %ESPAPJOB - %ESPATIME' USER(*)                   
  .
  .           
  RUN ANYDAY                                                   
  RELEASE FC_JOB_AJ_CMD                                        
ENDJOB                                                         
                                                               
JOB FC_JOB_AJ_CMD TASK SELFCOMPLETING                          
  IF NOT COMPLETED('%ESPAPPL','ALL') THEN +                    
   ESP AJ FC_JOB_FTNOTREC COMPLETE APPL(FTNOTREC.%ESPAPGEN)    
  SEND '> Job %ESPAPJOB - %ESPATIME' USER(*)                   
  RUN ANYDAY                                                   
ENDJOB                                                         
                                                               
JOB FC_JOB_FTNOTREC TASK SELFCOMPLETING                        
  DELAYSUB 23:00                                               
  IF NOT COMPLETED('%ESPAPPL','ALL') THEN +                    
   ESP AJ TEST_JOB COMPLETE APPL(FTNOTREC.%ESPAPGEN)           
  SEND '> Job %ESPAPJOB - %ESPATIME' USER(*)                   
  RUN ANYDAY                                                   
ENDJOB                                                 

Lucy Zhang's profile image
Broadcom Employee Lucy Zhang

Abandon submission can't be used for FILE_TRIGGER since it's not a job. And I think you may use ABANDON DEPENDENCIES on its successor. Like:

FILE_TRIGGER TESTJOB CONDITIONAL
...
RELEASE ADD(NEXTJOB)
 
ENDJOB

JOB NEXTJOB
  .....
  ABANDON DEPENDENCIES 23:00
  ...
ENDJOB

Note: the CONDITIONAL option for FILE_TRIGGER can bypass it after all other JOBs completed in the same application. 

In your post, the AJ command in following JOB is not necessary since it' released ONLY after the FM completes:

JOB FC_JOB LINK PROCESS

    ESP AJ FORCE_COMPLETE_TESTJOB COMPLETE APPL(TEST.%ESPAPGEN)

ENDJOB

There can be more considerations based on other jobs in the same application. And if needed, you can open a support case with us.

Hope this helps,

Lucy