Is there a sleep functionality in DataStage

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
dganeshm
Premium Member
Premium Member
Posts: 91
Joined: Tue Aug 11, 2009 3:26 pm

Is there a sleep functionality in DataStage

Post by dganeshm »

I want to send rows to a Web Service transformer in a controlled format , is there a sleep functionality in DataStage Server Jobs...
Regards,
Ganesh
dganeshm
Premium Member
Premium Member
Posts: 91
Joined: Tue Aug 11, 2009 3:26 pm

Re: Is there a sleep functionality in DataStage

Post by dganeshm »

For example, if the number of rows has reached 500 , create a 2 minute delay and then start processing the next set of 500 and then a 2 minute delay and so on..
Regards,
Ganesh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, several.

There is a SLEEP command (argument in seconds or as HH:MM (24 hour clock)).

There are statements SLEEP (argument in seconds) and NAP (argument in milliseconds) that you can use in a server routine.

You have access to the operating system sleep command by various means.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dganeshm
Premium Member
Premium Member
Posts: 91
Joined: Tue Aug 11, 2009 3:26 pm

Post by dganeshm »

Where can I use the sleep command , i dont see it in the transformer.., I have not created a routine , can you please help me.
Regards,
Ganesh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Commands can not be executed from the Transformer. If you need to sleep while in a Transformer then you need a Routine that the Transformer stage can call.

Code: Select all

FUNCTION Doze(aInterval)
Perform "SLEEP " : aInterval
Ans = 0
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dganeshm
Premium Member
Premium Member
Posts: 91
Joined: Tue Aug 11, 2009 3:26 pm

Post by dganeshm »

I tried this :
FUNCTION DELAY(Arg1)
SLEEP Arg1
PRINT 'STARTING DELAY'
EXECUTE 'CS'
PRINT 'DELAY COMPLETE'
Ans = 1

and it worked, but yours is much more understandable, I will do it your way..
Regards,
Ganesh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Even better is to leave out the Perform statement.

Code: Select all

FUNCTION Doze(aInterval) 
SLEEP aInterval 
Ans = 0 
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or, for the truly paranoid function developer.

Code: Select all

FUNCTION Doze(aInterval) 
Begin Case
   Case UnAssigned(aInterval) Or IsNull(aInterval)
      NULL  ; * do nothing
   Case Not(Num(aInterval))
      NULL  ; * do nothing
   Case aInterval <= 0
      NULL  ; * do nothing
   Case @TRUE
      * We have a positive number as the argument
      SLEEP aInterval 
End Case
Ans = 0 
RETURN(Ans)
Add generation of warnings, etc., to your heart's desire!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dganeshm
Premium Member
Premium Member
Posts: 91
Joined: Tue Aug 11, 2009 3:26 pm

Post by dganeshm »

Thanks a lot Ray..
Regards,
Ganesh
scooper1004
Participant
Posts: 2
Joined: Thu Mar 10, 2011 11:27 am

Post by scooper1004 »

Is there a way to do this in a parallel job?



Moderator: I corrected your post, you can't put your reply in the subject line, no-one will see it unless they take the time to actually form a reply and notice it there. FYI.
U
Participant
Posts: 230
Joined: Tue Apr 17, 2007 8:23 pm
Location: Singapore

Post by U »

Welcome aboard.

The same technique can be used in a parallel job, but using a parallel routine (and therefore C++ code).

In a parallel job you might also use a BASIC Transformer stage which can invoke server routines such as that described above.
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

Going out of topic here( realized this forum is server jobs only ) , but will an unix sleep in an external filter stage work ? if it does not alter the rest of data ?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No, because the External Filter stage has to do something with the data on its input link and generate data onto its output link. You could possibly add another command in the pipeline, for example

Code: Select all

sleep 30 && cat -
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply