How to wait in the JavaScript script execution at job-level
search cancel

How to wait in the JavaScript script execution at job-level

book

Article ID: 131121

calendar_today

Updated On:

Products

DSERIES- SERVER CA Workload Automation DE - System Agent (dSeries)

Issue/Introduction

My script to recycle file triggers requires either a wait or sleep between execCommand hold and execCommand complete. In the following script the wait fails with;
"Error executing job-level runtime JavaScript script for job org.mozilla.javascript.EcmaError: ReferenceError: "wait" is not defined. (#3). The error is: {2}".

How can I wait between two execCommands in java. I don't want two links with a reldelay 1 minute in between.

//recycle file trigger;
execCommand('SUBAPPL(SUBC)','%(APPL._name).%APPL._gen','ACTION HOLD Reason("recycle file trigger")');
wait(120000);
execCommand('SUBAPPL(SUBC)','%(APPL._name).%APPL._gen','ACTION COMPLETE Reason("recycle file trigger")');
 

How to wait in the JavaScript script execution at job-level.

Environment

CA Workload Automation DE (dSeries)

Resolution

You can use the java.lang.Thread.sleep(xx) method in the javascript provided.

Note: Enable the “Allow Java calls in Javascript” from Admin -> Topology -> Configure Shared Parameters -> Internal -> Show Advanced Parameters, to allow JavaScript scripts to invoke Java methods.

Additional Information

Enable Java Method Calls in JavaScript Scripts