Add Value from File

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
cyclogenisis
Premium Member
Premium Member
Posts: 48
Joined: Wed Jan 07, 2015 3:30 pm

Add Value from File

Post by cyclogenisis »

Looking for a way to add a column and populate the value of that column for every row. The value of that column for every row will be coming a csv file with a date in it.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Could you expand on the problem you are facing? Adding a column to a job and processing that extra column in a DataStage job is quite easy, so I'll assume that you have some other issue.
cyclogenisis
Premium Member
Premium Member
Posts: 48
Joined: Wed Jan 07, 2015 3:30 pm

Post by cyclogenisis »

I have some data coming down the pipe like this:

Image

Need to add another column in the next step to this data that is coming downstream and the value for this column will be the same for every row. It is a date found in a csv file.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Create a job parameter to hold it and populate it using the file, then add the column in a transformer and reference the job parameter as the derivation.
-craig

"You can never have too many knives" -- Logan Nine Fingers
cyclogenisis
Premium Member
Premium Member
Posts: 48
Joined: Wed Jan 07, 2015 3:30 pm

Post by cyclogenisis »

Sorry, how would you actually save the value from the sequential file to the job parameter?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That would typically be handled via a Sequence job and there are a handful of current topics on that subject over in the General forum. This one as one example, there should be plenty more. Basically you need something to 'read' the file and then pass the result to the Job Parameter in the Job Activity stage.
-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 »

Is there only one record in the file? Then 'reading' it might be as simple as using an Execute Command stage to cat the file to standard out and then you would need to capture the $CommandOutput from the stage to send to the parameter, something the Sequence job would automate for you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
naveenkumar.ssn
Participant
Posts: 36
Joined: Thu Dec 03, 2009 9:11 pm
Location: Malaysia

Post by naveenkumar.ssn »

Hi

Could not view your image.

Can you put down as the text if possible

Regards
Naveen
Naveen Kumar
Datastage Consultant
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not really sure why they felt the need to heavily redact the screenshot of the job but also didn't really see a need for it to answer the question. IMHO.

Guessing they have some sort of proprietary naming system and they're simply protecting their IP. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
cyclogenisis
Premium Member
Premium Member
Posts: 48
Joined: Wed Jan 07, 2015 3:30 pm

Post by cyclogenisis »

Thanks chullett. Actually some of my links have table naming convention in them so I thought it would be best to take those out. ;).
Post Reply