Job Control and the SLEEP Statement

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Job Control and the SLEEP Statement

Post 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?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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..
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps there is a difference between Sleep and SLEEP? I've never tried to use it all upper-case. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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:")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ArndW wrote:Quite odd.

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

"You can never have too many knives" -- Logan Nine Fingers
Post Reply