value of parameters from file

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
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

Post by MrBlack »

I'm having a hard time trying to understand what you are asking?

Can you parameterized a file name? - Yes. In the sequential stage properties you can reference a job parameter so when the job runs DS will dynamically look for the value of the parameter as the name of the file to load.

Can you insert a job parameter a column value in a transformer? Yes - instead of dragging a column from you source to your destination, just reference the job parameter instead.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

... and then there's this if (perhaps) you are talking about Parameter Value Files.

If you have a file with values in it that you want to bring into a job as Job Parameters then you'll need to read the file in some fashion and capture the output to pass in. It could be as simple as 'cat #filename#' in a Sequence... depends on exactly what is in your file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
hank_moody
Participant
Posts: 14
Joined: Tue Jan 21, 2014 2:58 pm

Post by hank_moody »

Probably I poorly explained
I want to take in Parallel Job the value from file(*.ds or *.txt) via parameter.
Is it possible?
Or I should read value only via stages (Data_Set/Sequential_File)?
Thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Still unclear, I'm afraid. However, your "I want to take" declaration is something I do believe I explained. If you don't agree, please be more specific... perhaps a fully fleshed out example of what you are trying to do would help in that case.
-craig

"You can never have too many knives" -- Logan Nine Fingers
hank_moody
Participant
Posts: 14
Joined: Tue Jan 21, 2014 2:58 pm

Post by hank_moody »

/opt/dsadm/project1:>cat file_tst.txt
"20000817"

In Designer I created parallel job.
In job properties I added parameter:
Parameter name: VAR1
Type: Pathname
Defaul value: /opt/dsadm/project1/file_tst.txt

In transformer stage I added derivation VAR1.
And in out stream I got the value: "/opt/dsadm/project1/file_tst.txt"
But I want to see: "20000817"
Last edited by hank_moody on Sat Jan 17, 2015 2:55 am, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK, that helps and is exactly what I explained how to do. Your job parameter needs to be appropriate for the actual value, nothing about how the parameters are passed will resolve things twice, so to speak. So... use a Sequence job to do the 'cat' and capture the output, then pass that output in as the job parameter value.

If you have any sort of 'job control framework' you could also code something up in a shell script to cat the value and then pass in the parameter as part of the dsjob invocation. If you are leveraging the API then look into:

DSAttachJob
DSSetParam
DSRunJob
DSDetachJob

All of this predicated on your need to pass this in as a job parameter. Depending on exactly what the job needs to do with this value and what else the job is doing, you may also be able to simply source from the file as you noted earlier.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You might also like to investigate Parameter Sets and their associated values files. This is exactly the mechanism for which you are searching.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hank_moody
Participant
Posts: 14
Joined: Tue Jan 21, 2014 2:58 pm

Post by hank_moody »

Thanks. I used a Sequence Job. It's works.
sauros73
Premium Member
Premium Member
Posts: 5
Joined: Mon Dec 05, 2005 1:15 pm
Location: Montreal
Contact:

Parameter Set Values File Name

Post by sauros73 »

I think this can help for some one searching that kind of subject.

If you check in the Values tab of a Parameter Set, the first field is called Value File Name.

This because the values of that tab are store on a text file on the server disk in the folder ../Projects/<project name>/ParameterSets/<Parameter Set Name>. The filename is the value of the " Values File Name"

I test it, and if you modified a value of a parameter in the Parameter Set=>Values tab=>Value File Name row, it is updated in the file on disk. And the opposite is true, if you modify the value on disk it is reflected in the Parameter Set.

That mean that if in your job you used the a particular Value File Name, you should be able to modified the value on disk (ex.: with a shell script) and it should be used by the job .

:!: :!: :!: :!: TO BE TESTED :!: :!: :!: :!:
Hugo POISSANT
Data Integration director
CGI
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yup, exactly what they are meant for.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I have many scenarios where the values files are updated from activities invoked from a controlling sequence before being used in job invoked from the same 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.
Post Reply