Passing job parameter from text file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Passing job parameter from text file

Post by rafik2k »

Hi,
I want to read paramter from text file and use the value of paramter in my job.
Example
FileName is parameter

Code: Select all

Parameter name,prompt,value
domain_name,Enter value name domain, electricity
I tried searching in archive, but failed to get desired result.

Please let me know any reference of previous post or suggestion on same

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Well, it's definitely been discussed before.

You can't do it within the job - job parameters are fixed when the job starts. Use whatever method you like in a job sequence to read the lines from the parameter file. Load these up into, say, user variables and use these to supply parameter values to the job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

Thanks Ray!
I need to read all 3 variable
Parameter name,prompt,value
from first line and their corresponding value from 2nd file.

Can you pleae let me know or give me hints how to acheive this?
I believe I will have write the routine, but don't know the actual syntax of reading text file.

Thanks
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

In the sequence you can call your routine by passing the file name, line number to be read and field number of the parameter. You can call this for all the parameters you want to read...

Code: Select all

Routine:

Open your seq file 
Ans = Trim(Field(FileLine,',',FieldNumber)) 
Close your seq file
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Passing job parameter from text file

Post by sachin1 »

hello if your input parameters are fixed, say in number 1,2 ...3 or more, but thier values are stored in text file then, you can do is in JOB CONTROL use following

DSSetParam
DSRunJob
...DSDetachJob

you can read your file and set values for parameters using DSSetParam.
Post Reply