Page 1 of 1

Parameter from Input Filename

Posted: Wed Apr 09, 2003 12:36 pm
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 ?

Posted: Wed Apr 09, 2003 12:46 pm
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

Posted: Wed Apr 09, 2003 1:10 pm
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]

Posted: Wed Apr 09, 2003 3:54 pm
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

Posted: Wed Apr 09, 2003 4:27 pm
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