Parameter from Input Filename
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 56
- Joined: Thu Feb 13, 2003 6:08 pm
- Location: USA
Parameter from Input Filename
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 ?
-
- Participant
- Posts: 56
- Joined: Thu Feb 13, 2003 6:08 pm
- Location: USA
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]
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]
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
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
-
- Participant
- Posts: 56
- Joined: Thu Feb 13, 2003 6:08 pm
- Location: USA
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
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