Thursday, August 25, 2016

REXX: Implementing Wait function in REXX

It always nice to wait for someone, something to happen, something to be done. Its possible in REXX to make it wait for sometime before you do some action. 

For example, checking status of a submitted job. It doesn't make sense to check the status of the job every second or micro second. 

Normally the jobs take minutes or hours or at least some seconds. If we have such a scenario, we have to run a job and wait until the job is complete. We shall introduce the wait function before checking the job status. 

As usual, REXX is such a easy and simple language. The implementation is so simple.

/*REXX*/
SECS = 20 
TIMEDIFF = 0                                                  
STARTTIME = TIME('S')                                         
SAY 'I am going to wait for 20 seconds'
DO UNTIL TIMEDIFF >= SECS                                     
 TIMEDIFF = TIME('S') - STARTTIME                             
END                                                           
SAY 'I am done with waiting for 20 seconds'
EXIT

Incase of questions or any feedback, please write your questions in the comments.

No comments:

Post a Comment

Featured Post

REXX Skeleton: Submitting jobs through Rexx

Submitting jobs through REXX and reading the spool through REXX gives us immense potential to automate many manual activities in mainframes....