Page 1 of 1

Job Control and the SLEEP Statement

Posted: Wed Aug 10, 2005 9:18 am
by ArndW
If I create a dummy job and put in SLEEP 30 into the job control it works like it should and pauses for 30 seconds before continuing.

I have now created a job with more complex processing in the job control, it is actually used to start n-parallel runs of several hundred jobs (meaning you specify how many concurrent processes to run and when one finishes the job starts the next one). This job works as it should but I am having trouble slowing it down.

Part of the code is:

Code: Select all

CALL DSLogInfo('Sleeping ':SleepTime:' Seconds.',ProgramName)
SLEEP SleepTime
CALL DSLogInfo('I just slept ':SleepTime:' Seconds.',ProgramName)


When I run this job it does not SLEEP; the two DSLogInfo() timestamps are in the same second! I have changed this line to SLEEP 30 (using a constant) and NAP 30000 to no avail.

Does anyone have an idea of what could be happening?

Posted: Wed Aug 10, 2005 9:25 am
by ArndW
Even stranger. I wrote a test function which displays an informational message and executes a SLEEP and added that function call to my job. The informational message is being displayed, but no SLEEP is taking place. Somehow the sleep call is being suborned/skipped/ignored. Very odd..

Posted: Wed Aug 10, 2005 10:40 am
by roy
Hi,
Arnd I've tested and it works fine for me :roll:

Both Routine with this code:

Code: Select all

Call DSLogInfo(TIME() : " - " : Arg1,"Time - Sleep Interval")
Sleep Arg1
Call DSLogInfo(TIME() : " - " : Arg1,"Time - Sleept Interval")
Ans = Arg1


And Basic job control:

Code: Select all

Call DSLogInfo(TIME() : " - " : P_SLEEP,"Time - Sleep Interval")
Sleep P_SLEEP
Call DSLogInfo(TIME() : " - " : P_SLEEP,"Time - Sleept Interval")


Works fine.
Could it be an env configuration of no wait at system level in your case?

IHTH,

Posted: Wed Aug 10, 2005 12:00 pm
by chulett
Perhaps there is a difference between Sleep and SLEEP? I've never tried to use it all upper-case. :?

Posted: Wed Aug 10, 2005 3:14 pm
by ray.wurlod
Keywords of the language are documented as NOT being case sensitive.

Arnd, try SLEEP 31 or SLEEP 33. If that also fails, try calculating the time 30 seconds hence, and sleeping till then.

Code: Select all

SLEEP Oconv(Time()+30, "MT:")

Posted: Thu Aug 11, 2005 2:34 am
by ArndW
I ended up calling EXECUTE "SLEEP 30" and that didn't work either; so I finally did a EXECUTE 'SH -C "sleep 30"' and let UNIX take care of the pause. I did a bit of checking and put a SLEEP 30 at the beginning of the program and that did pause, but somewhere in the execution it stopped. The only external calls I am doing are to the normal DSAttach()(),DSPrepareJob(),DSRunJob() and DSGetJobStatus(). I will look into this more when I have a chance.
Ray - I tried different times (60,10 etc.). I'll have to look at the docs again, I didn't know you could specify a time to wait until in that call. Plus, remember that the NAP command had the same problem. Quite odd.

Posted: Thu Aug 11, 2005 8:03 am
by chulett
ArndW wrote:Quite odd.

Yes Watson, indeed, never seen anything quite like it. :? Do keep us apprised of your progress, old chap.