Table Name from selected Column

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
baglasumit21
Participant
Posts: 132
Joined: Wed Mar 01, 2006 11:12 pm
Location: Pune

Table Name from selected Column

Post by baglasumit21 »

I have a table which has columns with table_name and a Flag. I need to fetch the table name with Flag = 'Y' and pass that table name as the table name for the target DB2 stage of my Job. Can any one help me in achieving this
SMB
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not in the same job.

You would need to obtain the table name in an upstream job and store it somewhere.

In the downstream job make the table name in the target stage a job parameter reference.

In the job sequence that runs both of these jobs, read the table name from its stored location to load a value into the job parameter of the downstream job.

Search the forum for methods of temporarily storing and retrieving values in a job sequence.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rleishman
Premium Member
Premium Member
Posts: 252
Joined: Mon Sep 19, 2005 10:28 pm
Location: Melbourne, Australia
Contact:

Post by rleishman »

I don't use DB2, but it should be similar to the Oracle OCI stage.

I believe that what you are trying to do is impossible. It calls for the table name to be dynamically determined at run-time.

The closest you can get to a dynamic table name is to use a Job Parameter (eg. #TABLE_NAME#) in your SQL statement. But then you have to set the value of the parameter, which cannot be done once the job has started.

At best, you could run a job that selected the table name, and then pass it into the next job as a parameter. Search on the following for details of how to pass values between jobs:
- DSSetUserStatus
- $UserStatus
Ross Leishman
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Keep it simple and visible. As Ray suggested, do it in two jobs. First one fetches the table name. Second one gets that value as a job parameter. Tie them together via a job sequence.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rleishman
Premium Member
Premium Member
Posts: 252
Joined: Mon Sep 19, 2005 10:28 pm
Location: Melbourne, Australia
Contact:

Post by rleishman »

Tap, tap, tap. Is there an echo in here? I thought that's what I said :? Apols to Ray if I repeated his response, but (like the OP) I was unable to read it all.

I guess I wasn't clear enough.
Ross Leishman
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I guess i missed out on your last para. Aplogies....
Well no damage done, just re-inforced your advice :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply