Output of a file as a parameter

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
hamzaqk
Participant
Posts: 249
Joined: Tue Apr 17, 2007 5:50 am
Location: islamabad

Output of a file as a parameter

Post by hamzaqk »

Hi all,

I have two jobs. the first one gets the max val for a column from a table and stored that in a file.

odbc---->> seq file

The second generates surrogate keys for the incoming records.

seq file---- > surrogate key gen----- > output

what i want to do is to pass the value which is stored in the file as the result of the first job run to the parameter in the second job.

in short.. i want the result of the first job to be the 'start value' of the surrogate key generator stage in the second job.

How can i do this ?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Easiest would be to read the file and pass its value into the second job as a job parameter. You would do this with an Execute Command activity 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.
hamzaqk
Participant
Posts: 249
Joined: Tue Apr 17, 2007 5:50 am
Location: islamabad

Post by hamzaqk »

thanks ray. can you please let me know what is the command to read the file ? what should i write in the command line of Execute Command activity .
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

After the first job writes the value to the sequential file, use UserVariable Activity to read the value from the file. And when writing the variable to the file write it as VarName=Value, VarName being the variable name used in job 2. Use get GetParameterValueFromFile() in UserVariable Activity to read the value.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

Hamzaq

You can use a CAT statement in the shellscript (Execute command activity) and get that to the next job

I have a sample where i do

cat <filename>|head -1

and get that to my next job .
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

Maveric wrote:Use get GetParameterValueFromFile() in UserVariable Activity to read the value.
Is there such a function available? Well, of course, if you have not custom coded it!!!!
gateleys
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

gateleys wrote:
Maveric wrote:Use get GetParameterValueFromFile() in UserVariable Activity to read the value.
Is there such a function available? Well, of course, if you have not custom coded it!!!!
Never mind. I didn't notice that it was a PX post. I wanted to know if it was available in Server Ed.
gateleys
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

cat filename | tr -d \n

The tr command strips newline characters. Otherwise you could strip them when using the activity variable.
Activity.$Output<1>
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