Page 1 of 2

pass value between jobs

Posted: Fri Jan 26, 2007 4:19 am
by PeterPol
hi all,

One way to pass a value from one job to another is by using userstatus (DSSetUserstatus). I somewhere else read (and experienced) that this routine can only be used in serverjobs. What mechanism(s) can be used in px jobs for passing values?

Peter

Posted: Fri Jan 26, 2007 5:22 am
by ray.wurlod
What value do you want to pass?

Posted: Fri Jan 26, 2007 5:38 am
by PeterPol
Hi ray,

No value in particular. Any value that I want to pass to other jobs that follow in the sequence. For instance, a table value that I want to retrieve once, and use in other jobs that come after this one.

Peter

Posted: Fri Jan 26, 2007 7:43 am
by DSguru2B
There are methods advised here. Search to get a few revealed :D

Posted: Fri Jan 26, 2007 4:47 pm
by ray.wurlod
For one value, I'd still recommend the user status area. Use a server job (or a fully sequential parallel job that includes a BASIC Transformer) to obtain that value and store it in its user status area. Use the parent job sequence to retrieve that job's user status value, and supply that as the value with which to replace a job parameter in the main job.

If you don't want to do that, there are numerous other storage locations available, such as a text file, a row in a table, an environment variable and so on. To retrieve the value of an environment variable, you would need some way to execute either the DataStage command ENV or the operating system command echo in your job sequence.

Posted: Thu Feb 01, 2007 5:03 am
by PeterPol
Hello ray,

I tried passing a userstatus in a Basic transformer (from a fully sequential parallel job, as you suggested) to the parent job, but this doesn't work. I get the following warning:

subjob(BASIC_Transformer_3).#0.BASIC_Transformer_3 (DSSetUserStatus): Error reading Job Status record. JobNo = 646 JobName = subjob.#0 WaveNo = 1

Peter

Posted: Thu Feb 01, 2007 5:20 am
by kumar_s
How are you trying it?
Write a routine which calls the UserStatus function. It has been discussed serveral times.
Following will be the code for the function.

Code: Select all

INCLUDE DSINCLUDE JOBCONTROL.H
*FUNCTION UpdateUserStatus(Arg1)
Call DSSetUserStatus(Arg1)
Ans = Arg1
RETURN(Ans)

Posted: Thu Feb 01, 2007 5:29 am
by sud
PeterPol wrote:Hello ray,

I tried passing a userstatus in a Basic transformer (from a fully sequential parallel job, as you suggested) to the parent job, but this doesn't work. I get the following warning:

subjob(BASIC_Transformer_3).#0.BASIC_Transformer_3 (DSSetUserStatus): Error reading Job Status record. JobNo = 646 JobName = subjob.#0 WaveNo = 1

Peter
The strategy of using a BASIC transformer in a parallel job will not work in a MPP system. It works only in SMPs ... according to Datastage documentation.

Posted: Thu Feb 01, 2007 5:33 am
by PeterPol
Hello,

I have a routine named PublishUserStatus(arg1) that calls the userstatus function, as you adviced:

Call DSSetUserStatus(Arg1)
Ans = 0

Peter

Posted: Thu Feb 01, 2007 5:36 am
by kumar_s
Or straigt away use Server job.
viewtopic.php?t=95608&highlight=waveno

Posted: Thu Feb 01, 2007 5:40 am
by sud
Is that just a warning or a fatal error?

Posted: Thu Feb 01, 2007 5:55 am
by balajisr
subjob(BASIC_Transformer_3).#0.BASIC_Transformer_3 (DSSetUserStatus): Error reading Job Status record. JobNo = 646 JobName = subjob.#0 WaveNo = 1
I received similar warning not long ago when i tried to set userstatus using basic transformer . Not sure as to what the problem is.
As noted, it is better to do the same in server jobs.

Posted: Thu Feb 01, 2007 6:40 am
by PeterPol
hi,

Setting the userstatus is no problem in server jobs. I already experienced that. However, server jobs are very limited in processing possibilities, so I prefer to develop most things in parallel jobs.

Ray mentioned some alternatives like storing the value in a textfile or using environment variables. The first option seems rather time-consuming to me :? . The second option is new for me :?:

Peter

Posted: Thu Feb 01, 2007 8:12 am
by DSguru2B
PeterPol wrote:However, server jobs are very limited in processing possibilities, so I prefer to develop most things in parallel jobs.
A simple storage of a value to be retrieved later on is best to be done in a server job. Its a small job and hence preferably done in server. For massive processing use parallel jobs.

Posted: Thu Feb 01, 2007 8:19 am
by chulett
PeterPol wrote:However, server jobs are very limited in processing possibilities, so I prefer to develop most things in parallel jobs.
Interesting statement. I completely disagree but that's not a topic for this thread. :wink: