Set global variable from file

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
samyamkrishna
Premium Member
Premium Member
Posts: 258
Joined: Tue Jul 04, 2006 10:35 pm
Location: Toronto

Re: Set global variable from file

Post by samyamkrishna »

One of the ways would be to.

read only the field you need using a cut command in UNIX.
replace '\n' with a ','.
pass this as a parameter to the job or sequence.
Cheers,
Samyam
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I wouldn't pass a list of "50 or 101" values as a parameter in a job, you can build a string and do it I just wouldn't recommend it. In your shoes I would load those values to a work table and then change your SQL to be more like:

Code: Select all

Select * from table where field in (select field from work_table);
That would work regardless of the number of rows in the input file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Can't? That's a pretty severe limitation if you can't build work tables. IMHO.
-craig

"You can never have too many knives" -- Logan Nine Fingers
samyamkrishna
Premium Member
Premium Member
Posts: 258
Joined: Tue Jul 04, 2006 10:35 pm
Location: Toronto

Post by samyamkrishna »

You can read only the field you need using a cut command in UNIX.
replace '\n' with a ',' and write the sql into a .sql file.

in the DB stage use read SQL from file option.
Cheers,
Samyam
naveenkumar.ssn
Participant
Posts: 36
Joined: Thu Dec 03, 2009 9:11 pm
Location: Malaysia

Re: Set global variable from file

Post by naveenkumar.ssn »

hi

I would suggest you to write all the required columns in a temp table and then use that temp table data to get your required search

OR

use the looping mechanism , read the content of file one by one and then view the records either at one go or read all the data .
Naveen Kumar
Datastage Consultant
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Get "them" to allow you to create and use temporary tables.
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