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.
 

<Please see attached file for image>

id="m_-6077858565853726990gmail-m_8888810915901957544Picture_x0020_3" height="297" src="https://mail.google.com/mail/u/0?ui=2&ik=57ae6eaa33&attid=0.3&permmsgid=msg-a:r6240494778651248427&th=16a20f3275f2fcc9&view=fimg&sz=s0-l75-ft&attbid=ANGjdJ9vkXhSMS1MTuOMVRpdYhUST8BgXt0DGFcmQEgMJDG_zhY9JNDz2eblTU3fSmwpYKdgYHDXryaXLMZRvM3AqjFyi-IFnMoQo7lZQbuHV7yTwzTAE-OQmc6yHd8&disp=emb&realattid=3fd631e301ae5aea_0.3" style="width: 8.8666in; height: 3.0916in;" width="851">
 

<Please see attached file for image>

id="m_-6077858565853726990gmail-m_8888810915901957544Picture_x0020_1" height="912" src="https://mail.google.com/mail/u/0?ui=2&ik=57ae6eaa33&attid=0.1&permmsgid=msg-a:r6240494778651248427&th=16a20f3275f2fcc9&view=fimg&sz=s0-l75-ft&attbid=ANGjdJ-lzmyq81VElMjDUa9hHv37xmps5NOcgUGnn4pVGE4GHZyWsqGlHlw5mJDdOSfiX1uCsp9MFjamG23QWzLOTodBtzBacgE7GvGnKMSh73lNl2OsoUsqH1JYj4w&disp=emb&realattid=3fd631e301ae5aea_0.1" style="width: 10.4416in; height: 9.5in;" width="1002">
 

<Please see attached file for image>

id="m_-6077858565853726990gmail-m_8888810915901957544Picture_x0020_2" height="688" src="https://mail.google.com/mail/u/0?ui=2&ik=57ae6eaa33&attid=0.2&permmsgid=msg-a:r6240494778651248427&th=16a20f3275f2fcc9&view=fimg&sz=s0-l75-ft&attbid=ANGjdJ-tF99ATAfA_qcAPrR2-pd5lky65YtP3ZDBW2tcnQHrojJ4z5AtU2J9GiC6KnkVOOIaEPJgeJO-38CXFwoFDhxOErPloHBWhjm_Ar-JxJCvv4pyLm-iFJSjdjw&disp=emb&realattid=3fd631e301ae5aea_0.2" style="width: 13.825in; height: 7.1666in;" width="1327">
 
 

Additional Information

Enable Java Method Calls in JavaScript Scripts

Attachments

1558687275532000131121_sktwi1f5rjvs16f8e.html get_app
1558687273812000131121_sktwi1f5rjvs16f8d.html get_app
1558687270925000131121_sktwi1f5rjvs16f8c.html get_app