Readings values from a file into Variables in UVA stage

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
Suhel_2112
Premium Member
Premium Member
Posts: 10
Joined: Sun Jul 15, 2012 11:34 pm
Location: Bangalore

Readings values from a file into Variables in UVA stage

Post by Suhel_2112 »

I am writing 2 values into a sequential file and want to read these two values into 2 variable in UVA stage and then pass these variable down stream.

This file has only 1 line with two columns containing values.

From other threads i have seen that Execute Command Activity stage is generally used to read files.

I have not used this stage before to achieve this task :roll: ,

Can anybody help me with this ?
Thanks & Regards
Suhel Khan

Env Info:
DataStage Version : 8.5
DSEngine Platform : Windows Server 2008 R2
DWH Platform : Oracle 10g
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The Execute Command stage just runs operating system commands. To "read" a file one would generally just "cat" it and then check $CommandOutput for the returned values.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Suhel_2112
Premium Member
Premium Member
Posts: 10
Joined: Sun Jul 15, 2012 11:34 pm
Location: Bangalore

Post by Suhel_2112 »

Thanks Craig, that information was handy.

Also,

To read two columns from a files (just 1 record in it) into UVA stage variables,
currently i am using Command Activity stage twice on the same file . Once i
extracting columns 1 into one of the UVA variables and then extract columns 2 into another UVA variable.

Is there a better way to do it , like in just one go, rather than using Command Activity stage twice.
Thanks & Regards
Suhel Khan

Env Info:
DataStage Version : 8.5
DSEngine Platform : Windows Server 2008 R2
DWH Platform : Oracle 10g
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You could probably leverage the Field() function, one stage run referenced twice where the first takes field 1 and the second field 2.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply