Extracting value from file,populating it as job 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
Puli
Participant
Posts: 53
Joined: Mon May 26, 2008 2:59 am
Location: Australia

Extracting value from file,populating it as job parameter

Post by Puli »

Hi,

I have a requirement in which i have a file which has a COUNT value in it(There is only one record in the file).
In another job i want this COUNT value to be set as the default value of a Job Parameter. How can i achieve this?

Regards
Pulio
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

use a sequence to get the value from file,( may be cat the file in execute command) and use the output of this as a value in the next job called in the sequence
Puli
Participant
Posts: 53
Joined: Mon May 26, 2008 2:59 am
Location: Australia

Post by Puli »

Thanks for your response.But still i am not getting how we can get the value into the Defaul value of a job parameter.Can u please give the sample code piece also?

Thanking
Pulio
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

Your output file will have the count right? :?
If yes then you can use 'Before Job Subroutine' ...in that 'SetDSParamsFromFile'
For example

My output file is result.txt which will have count say 10
So use following unix command (before starting the next job)

Code: Select all

count=`cat result.txt`
echo Parameter_Name=$count > /home/dev/test/JobParam.txt

cat /home/dev/test/JobParam.txt
Parameter_Name=10
This will create your parameter file.
1.Then under the 'General' tab, set the 'Before Job Subroutine' to be 'SetDSParamsFromFile'
2.The routine takes two arguments (a directory and a file name) which are comma separated.
example : /home/dev/test/,JobParam.txt
The above can also be transformed into job parameters with defaults assigned to them
eg :You can use argument as #Parameter_Name# where Parameter_Name is the parameter defined in the job
3." The Job Parameter file format is as follows:
<parameter-name> = <parameter-value>
E.g. Parameter_Name=10

Hope this will solve your problem... :wink:
http://findingjobsindatastage.blogspot.com/
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
Post Reply