result of a query in a variable activity

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
LAS
Participant
Posts: 11
Joined: Thu Oct 22, 2009 2:25 am
Location: Bretagne

result of a query in a variable activity

Post by LAS »

Hello

I'm using a sequencer job containing 3 server jobs (SJ1, SJ2 and SJ3).
SJ1 is linked to SJ2 and SJ3.
I have a parameter table (Oracle Database). One parameter indicates the path to take in the sequencer.
If parameter = 2 then SJ2 must run and SJ3 is ignored.
If parameter = 3 then SJ3 must run and SJ2 is ignored.
To do that, I have to read the parameter in the table and then evaluate the value in the triggers of SJ1.

Thanks to DSXchange, I found a link to a solution on www.anotheritco.com but I would like to know if it is possible to read the value of the parameter in a database and store it in a variable activity without using an intermediate file ?
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

Welcome...

In SJ1, you can read the value from the database and set the value to user status by using "DSSetUserStatus". And you can fetch the values in the Sequence job by using SJ1's jobactivity.$UserStatus.

Search the forum for the keyword DSSetUserStatus, you will get more details on how to use it.
LAS
Participant
Posts: 11
Joined: Thu Oct 22, 2009 2:25 am
Location: Bretagne

yes but ...

Post by LAS »

Thanks.
I did a search as you adviced.
I found 125 answers with the keyword DSSetUserStatus. It's a bit long to read but it's effective. Here is a summary of the solutions.

Step 1 : I create a routine like that :

Code: Select all

FUNCTION SetUserStatus(Arg1)
Call DSSetUserStatus(Arg1)
Ans = Arg1
Step 2 : I create a job SJ1 with 3 stages :
Stage1 (ORAOCI9) read the parameter from the table
Stage2 (Transformer) use the function SetUserStatus in Derivation
Stage3 (Sequential file) write the value in a file

Step 3 : I call the job SJ1 in a sequencer and I use $UserStatus in the expression of a custom conditionnal trigger to determine the next job to execute.

It works but I still have the intermediate file (Stage3 in the Step2).
How can I use the transformer without writing something in a file or a database ?
Do I really need to use a transformer to call the function SetUserStatus ?
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

For a transformer , definetly an output link should be there, but you can set the constraint to @FALSE, so nothing will be written to that file.

If you want to store some constant values to the userstatus, you can just call it in stage subroutines, but here you are fetching some values from Database and writing it user status, so i think you need a transformer here.

There might be some other ways also, which i am not aware. Please wait for our expert's comments.
LAS
Participant
Posts: 11
Joined: Thu Oct 22, 2009 2:25 am
Location: Bretagne

sorry I'm lost

Post by LAS »

DS_SUPPORT wrote:but you can set the constraint to @FALSE
I don't understand.
What does it means ? How can I do that ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It means nothing would ever leave the transformer down that link. You could also write the file to "/dev/null".
-craig

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

Post by ray.wurlod »

Have the Sequential File stage append to /dev/null (UNIX) or .\NUL (Windows). Then you have no file created.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
LAS
Participant
Posts: 11
Joined: Thu Oct 22, 2009 2:25 am
Location: Bretagne

Post by LAS »

Ok for the solution with /dev/null.
I'd like to understand the solution which consist in setting the constraint to @FALSE as proposed by DS_SUPPORT

Where can I set this constraint ?
LAS
Participant
Posts: 11
Joined: Thu Oct 22, 2009 2:25 am
Location: Bretagne

Post by LAS »

Where can I set this constraint ?
I find it. Sorry, I was not awake. :oops:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:wink:
-craig

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