Parameter from Input Filename

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
datastagedummy
Participant
Posts: 56
Joined: Thu Feb 13, 2003 6:08 pm
Location: USA

Parameter from Input Filename

Post by datastagedummy »

I have a situation where I have to pass a parameter to the job based on the the first 3 chars of the name of the Input file. The question is can this be done by DStage ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

My first reaction would be "sure!" even though I don't totally follow your needs. Are you willing to write some Job Control? Perhaps if you gave a more specific example of what you are trying to accomplish, people can propose (heck, or even provide) solutions for you.

-craig
datastagedummy
Participant
Posts: 56
Joined: Thu Feb 13, 2003 6:08 pm
Location: USA

Post by datastagedummy »

I have a job that receives files from different departments and they all have the same layout the name of the file is xxxFilename where xxx is actually the department code.

In the output file which is actually a merge of all the department files i have a field DEPT_CODE that I want to populate from the first 3 characters of the Filename.

So that by looking at the data in the merged file I can drill down to the specific depts.

Pl advise. I am sure this can be done but am unable to think of how to [V]
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How are you working with the files now? Are their names passed in as parameters? Loaded one at a time? Wildcarded?

If you already know the name of the file and have it passed in as a parameter, look at setting up a Stage Variable that equals Filename[1,3] and then assign that to your DEPT_CODE field.

Or a controlling batch could take the parameter value you are passing in, substring off the first three characters and pass that in as yet another parameter.

Or it could retrieve the filename from the O/S, do the substring and then pass both pieces in as parameters.

Does any of that help get the creative juices going? [^]

-craig
datastagedummy
Participant
Posts: 56
Joined: Thu Feb 13, 2003 6:08 pm
Location: USA

Post by datastagedummy »

Thanks a lot for the help -Craig

quote:Originally posted by chulett
[br]How are you working with the files now? Are their names passed in as parameters? Loaded one at a time? Wildcarded?

If you already know the name of the file and have it passed in as a parameter, look at setting up a Stage Variable that equals Filename[1,3] and then assign that to your DEPT_CODE field.

Or a controlling batch could take the parameter value you are passing in, substring off the first three characters and pass that in as yet another parameter.

Or it could retrieve the filename from the O/S, do the substring and then pass both pieces in as parameters.

Does any of that help get the creative juices going? [^]

-craig
Post Reply