Read a Parameter file from UNIX Directory & pass value
Moderators: chulett, rschirm, roy
Read a Parameter file from UNIX Directory & pass value
Hi All,
Pls help me in this scenario,
I have a Parameter file in the UNIX directory. I need to read this file, get the values from the file & pass it to the JOB Sequence.
Thanks in Advance,
Freddie.
Pls help me in this scenario,
I have a Parameter file in the UNIX directory. I need to read this file, get the values from the file & pass it to the JOB Sequence.
Thanks in Advance,
Freddie.
Passing parameter values to Sequence
Hi,
Thanks for the reply.
I have a parameter file in the UNIX dir. I am trying to read the file through a Execute COmmand Activity (Through a Script)& pass those values to the subsequent jobs.
Can you pls tell me how to do this & what is the UNIX code I should write. Also, pls let me know how I can pass the output from the UNIX code to the subsequent job.
THanks in advance,
Freddie.
Thanks for the reply.
I have a parameter file in the UNIX dir. I am trying to read the file through a Execute COmmand Activity (Through a Script)& pass those values to the subsequent jobs.
Can you pls tell me how to do this & what is the UNIX code I should write. Also, pls let me know how I can pass the output from the UNIX code to the subsequent job.
THanks in advance,
Freddie.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi All,
It is a parameter file with a list of values. (More than 6 parameters & corresponding values). I am trying to use an Execute Command activity & capture those values in the next stage.
Pls help.
Also let me know whether there s any other alternative of reading the parameter values from the file & passing it to a sequence.
Thanks
Freddie.
It is a parameter file with a list of values. (More than 6 parameters & corresponding values). I am trying to use an Execute Command activity & capture those values in the next stage.
Pls help.
Also let me know whether there s any other alternative of reading the parameter values from the file & passing it to a sequence.
Thanks
Freddie.
Best way IMHO is to do this all in hand-coded BASIC job control. Read the file, DSAttachJob(), use DSSetParam() to establish the values and then DSRunJob() to run the Sequence, DSWaitJob(), etc. This is very similar to the job control code you can automatically generate in any job's Properties from the Job Control tab using that drop-down. A little intimidating at first but a great skillset to have that will serve you well, so well worth the time you should invest to learn it.
Otherwise trying to echo out multiple parameter name/value pairs, interrogate what you found and then figuring out what to do with them is a little much to accomplish in a brain-dead Execute Command stage. If you know ahead of time where each one goes, you could echo out the X values in a delimited string and then substring out the appropriate bit X times from the result.
Still prefer the first solution.
Otherwise trying to echo out multiple parameter name/value pairs, interrogate what you found and then figuring out what to do with them is a little much to accomplish in a brain-dead Execute Command stage. If you know ahead of time where each one goes, you could echo out the X values in a delimited string and then substring out the appropriate bit X times from the result.
Still prefer the first solution.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I'm sorry but what in the heck do you think we've been trying to do? Am I just talking to myself here?DSFreddie wrote:Pls let me know how I can do it.
And while your requirement may be "simple", the solution - when it involves a variable number of parameters in name/value pairs - is not if you've never done it before.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
You can do this in a sequence but the BASIC code would be in a routine. You still need to parse the parameter file. I assume your parameter file looks like this:
Param.txt
Example:
The tricky part is when you add comments to these.
Example with comments:
This allows you to move your parameter file from Dev to Test to Prod and just uncomment the values. Not good for passwords but most of us do something like this.
You can do this in a UNIX command.
You need to wrap this in shell script. To do this in BASIC is similar.
(ParamName is the argument to this routine.)
The STOP statements need to have some kind of logic there to trap errors but this is close.
Now in your sequence job set a variable to the result of this routine. Call this over and over until you get all your parameters set. Now you can feed these variables into your job parameters from this point on.
None of this has been tested. So you need to work out the details.
Param.txt
Code: Select all
ParamName=ParamValue
Code: Select all
jpEdwDsn=OraEdwDev
Example with comments:
Code: Select all
#Prod jpEdwDsn=OraEdwProd
#Test jpEdwDsn=OraEdwTest
jpEdwDsn=OraEdwDev
You can do this in a UNIX command.
Code: Select all
cat Param.txt | grep -v '^#' | grep $1
Code: Select all
Ans=''
openpath '.' to CurrentDir else stop
read ParamFile From CurrentDir, 'Param.txt else stop
Found=@FALSE
NoLines=dcount(ParamFile, @FM)
For i=1 to NoLines until Found
Line=ParamFile<i>
FirstWord = field(Line, '=', 1)
if FirstWord=ParamName Then
ParamValue = field(Line, '=', 2, 99)
Found=@TRUE
end
Next i
If Found Then
Ans = ParamValue
End
return(Ans)
The STOP statements need to have some kind of logic there to trap errors but this is close.
Now in your sequence job set a variable to the result of this routine. Call this over and over until you get all your parameters set. Now you can feed these variables into your job parameters from this point on.
None of this has been tested. So you need to work out the details.
Mamu Kim
As noted, you'd have much more control over things in a nice chunk of BASIC job control code, something that could automatically poll a job for the parameters it needs and then parse them from your flat file or a dynamic array. What Kim posted can be made to work for you if you know the names of the parameters you need and are willing to call this as many times as you need something from the file.
I'd suggest setting these calls up in a UserVariables stage, that way you can easily create the X placeholders you'd need then call them once and just as easily reference them in any number of downstream Job Activity stage's parameter value box.
I'd suggest setting these calls up in a UserVariables stage, that way you can easily create the X placeholders you'd need then call them once and just as easily reference them in any number of downstream Job Activity stage's parameter value box.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers