Parameterizing output of Job

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
Smeitei
Participant
Posts: 28
Joined: Tue Jan 23, 2007 3:14 pm

Parameterizing output of Job

Post by Smeitei »

HI,

I am having a scenario like this.

1. Query Oracle Table to get A Date field and keep it as a parameter
2. Use the above parameter in a Where clause when I query Redbrick Tables to get the required columns

As the two table reside in difffernt schemas one in Oracle and anothere in Redbrick I cannot do a join. Options I thought
1. Pass on the Oracle datefield to a sequential file and Open and read it to a parameter before the 2nd job which queries Redbrick and use it in the parameter in the User defined sql
2. Unload Table from Oracle into Redbrick as a work Table.. Work in this table. Do whatever insert/update/delete i have to do and at the end load it back to Oracle. But this is like maintaining a mirror table so i left the idea

I went ahead with the #1 approach but felt it to be a bit lengthy and round about way . Is there any way I can pass a run time value to a parameter in DataStage.

e.g Defined #Datetime# in DSAdmin with some default value and when the first job querying Oracle runs the Output is assigned to #Datetime# parameter and i can use it in later jobs
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Go with point 1. How will you go about getting that done? Well that depends upon how you will be controlling the process. Is it via job sequence or via a shell script?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

what you want to do?
just pass the output from oracle table as parameter to second job(for red bricks),
or you want to define that value to any environment variable?
just clear this point.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Red Brick specialist also

Post by ray.wurlod »

Can you state your actual requirement in terms of what you want to get out of the Red Brick database? We're aware that the date comes from an Oracle database, and can probably manage that in a job parameter, but how do you need to use this date in a Red Brick query?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Smeitei
Participant
Posts: 28
Joined: Tue Jan 23, 2007 3:14 pm

Post by Smeitei »

The date field which i want to pass as a run time parameter will be use in the User defined query in ODBC stage where i query redbrick database

something like this

Select
c1,
c2,
..

from Table 1
where Laod_datetime > #param#

The above #Param# is the value i get from Oracle database and want to use while querying tables in redbrick databse
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

just make two job,
1) extract oracle database and load you date-value(which you want to pass to
Red bricks query) to Hash file ,
2)define a parameter ,
write query for red bricks in ODBC,pass that parameter in query.

Then create sequence job,

1st job--->routine activity(DSUtilityHashLookUp)----2nd job,
in 2nd job activity pass ,return value from routine activity(Hash look up)
as parameter.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

First job selects date from Oracle and loads it into that job's user status area.

Job sequence accesses first job's user status area using the activity variable $UserStatus, in the definition of the second job's job parameter. Type in to that field FirstJob.$UserStatus, where FirstJob is the name of the job activity that executes the first job.

The approach suggested by swades will work, but requires that a hashed file be created (or an existing hashed file used). Using the user status area does not require external hashed file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jreddy
Premium Member
Premium Member
Posts: 202
Joined: Tue Feb 03, 2004 5:09 pm

Post by jreddy »

Ray, how would be set the value returned from Oracle job/table to the userStatus variable.. pls advise

thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Search the forums. This has been covered extensively before.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

jreddy wrote:Ray, how would be set the value returned from Oracle job/table to the userStatus variable
In a job that selects the value from Oracle use an interlude to DSSetUserStatus() function as the derivation in a Transformer stage. Search the forum for sample code.
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