dynamically passing tablename

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
Ritesh Vikram
Participant
Posts: 8
Joined: Wed Mar 01, 2006 11:16 pm

dynamically passing tablename

Post by Ritesh Vikram »

I have a file in which a tablename is there. My job has a DB2 stage which uses this tablename. Now I want to dynamically pass this tablename directly to my DB2 stage. Can anyone plz suggest how to do this?
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi Ritesh,
You need two jobs. Job 1 read the table for the table name and pass it to the other job as JobParameter.
If you search the forum, you can find lot many similar recent post of the same kind. You can either use UserStatus or write into a file and read it to pass the value as JobParameter.
If you version permits, you can read the tablenames, and pass it to stored procedure satge, which has the functionality to create tables for each input records.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
wnogalski
Charter Member
Charter Member
Posts: 54
Joined: Thu Jan 06, 2005 10:49 am
Location: Warsaw

Post by wnogalski »

In the first job read the file with tablename and use SetJobUserStatus(link.PARAMETER) to set job's user status. In the next job in the sequence You can pass it as parameter f.e. job1.$UserStatus.
Regards,
Wojciech Nogalski
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Why write a code when the same can be done through a simple Sequence Job :? The friendly GUI.
Success consists of getting up just one more time than you fall.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You don't understand DSSetUserStatus() function. It must be executed from within a job. Also, there's nothing in your code to run Job1.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
baglasumit21
Participant
Posts: 132
Joined: Wed Mar 01, 2006 11:12 pm
Location: Pune

Post by baglasumit21 »

wnogalski wrote:In the first job read the file with tablename and use SetJobUserStatus(link.PARAMETER) to set job's user status. In the next job in the sequence You can pass it as parameter f.e. job1.$UserStatus.
Hi
I am from same team as Ritesh. The jobs are now running fine with hard coded value for the table name for eg. "call DSSetUserStatus("table_name")" but it is not taking the table name when I state "call DSSetUserStatus(link.PARAMETER)". is there any other way by which I can get that value from the link
SMB
wnogalski
Charter Member
Charter Member
Posts: 54
Joined: Thu Jan 06, 2005 10:49 am
Location: Warsaw

Post by wnogalski »

Create a sequence - put 2 jobs inside and connect them.
Job 1 - Sequential File --> Transformer --> Dummy HF.
Inside the Transformer in the Derivation from the output link use SetJobUserStatus(link.PARAMETER) where link.PARAMETER is the column from the input. This will set the job's status to the table name you extracted from the file.
Job 2 - create a parameter called for example TABLE_NAME. Inside the sequence a new parameter for job 2 will apprear and You will be able to assign job1.$UserStatus to it.
Regards,
Wojciech Nogalski
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi wnogalski,

SetJobUserStatus might be a built in routine by some of your other team in you site.
You just need to create a routine which has the following code

Code: Select all

Call DSSetUserStatus(Arg1)
Ans = Arg1
RETURN(Ans)
So that the value will be set for the derivation as well (If requried).
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Job1 selects the table name from wherever it is stored, and loads the table name into its (the job's) user status area via a routine that invokes DSSetUserStatus(), picking up the input table name from the input link.

The job sequence reads Job1's user status via $UserStatus activity variable and uses that to set a parameter in Job2.

Job2 uses a job parameter reference to set the table name.
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