SLEEP function clarification

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
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

SLEEP function clarification

Post by vivekgadwal »

Gurus,

First of all, thank you for your help in resolving my earlier query about Trans() function.

I am using the SLEEP function to suspend the DataStage jobs from executing if, for a particular row (the latest row) in a Control Table, a couple of fields are not populated. These fields are to be updated by a different process, which utilizes the data we have loaded initially (into a Work table) and transforms the data and populates these two fields in the Control table as a signal that our ETL can be triggered. Hence, the requirement is for our process to wait until the process on the other team's end to be complete, without any manual intervention.

Just now, I came to know from one of my colleagues, that the SLEEP function has caused trouble for his team earlier (this was in earlier versions...presumably 7.0). He claims that it is not reliable as sometimes the process did not sleep which resulted in them developing a different mechanism instead of using SLEEP function. Even IBM acknowledged that there might be a minor Bug in the function at that time.

My questions are:
> Do you know of any such issues with SLEEP function?
> If so, do you know if that has been solved?

Please advise.
I am continuing my development as if SLEEP should not cause any trouble for me. If there is an alternate approach that I can take, kindly let me know.

Regards,
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

This is regarding the DataStage SLEEP function rather than the one at the operating system level, yes?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I had issues with the DataStage SLEEP function several years ago with V7, it would usually function but sometimes, for no immediately obvious reason, stop working. I recall having opened up a call with support at the time, but as a sporadic problem it was almost impossible to track down. We modified our jobs to shell out to UNIX and issue a SLEEP there. I have not had any problems since that one installation and have used SLEEP a lot. Perhaps it was a combination of version and AIX...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Was wondering... don't think I've ever actually used the internal one but have shelled out and used the O/S sleep function without issue many (many) times and places.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

ArndW wrote:I had issues with the DataStage SLEEP function several years ago with V7, it would usually function but sometimes, for no immediately obvious reason, stop working. I recall having opened up a call with support at the time, but as a sporadic problem it was almost impossible to track down.
This is exactly the problem faced and they opened up a ticket with IBM too. It seems they have run some tests on their side and confirmed that SLEEP (in DataStage) has some issues. They said that this might be fixed for later releases. Does anybody know if this has been fixed?
I, so far, didn't have any issues (I just started development last week and have done, may be, four or five runs using SLEEP). But, this issue concerns me.
ArndW wrote: We modified our jobs to shell out to UNIX and issue a SLEEP there. I have not had any problems since that one installation and have used SLEEP a lot. Perhaps it was a combination of version and AIX...
I don't think this problem is unique to the combination of version and AIX as we are SOLARIS based shop and we had issues with the function. I believe the way ArndW mentioned is the alternate path they have taken...i.e., to use OS level SLEEP functionality, although I haven't looked at the code in those jobs though (we are currently going through migration to a new box...so cannot access some projects!)

If I have to take up this route of using UNIX SLEEP, then does it suspend the whole process for the duration input to the SLEEP command? Does this have any effect on other jobs...both dependent to the process that calls the SLEEP command and independent to it?

Thanks for you suggestions...

Regards,
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What about the NAP command. Did you look into it. I do not seem to recall ever having issues with the NAP command.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

DSguru2B wrote:What about the NAP command. Did you look into it. I do not seem to recall ever having issues with the NAP command.
NAP sounds like a viable option.
> Does it have any limitations...like the max. amount of time (in milliseconds) that we can enter?
> Also, in the DS Help, it says..."will slow down the performance of your job"!
I was wondering if waiting for 15 minutes to 30 minutes (wait time is not yet determined) and checking the database if the other process finished doing its job and wait for some more time if the process is not finished might be very very slow if I am using this NAP function! What are your comments on that?

Regards,
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well, performance should really not be a deciding factor here as you are just checking for a value in a column. The job is goign to be running long anyways as you will beoing going sleep every few mins untill your condition is met.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I really don't know if NAP ends up executing anything other than an OS sleep call (well, "nanosleep" or the like) at UNIX. So I wouldn't rely on NAP not showing the same sporadic issues.
Post Reply