Passing before routine output in the datastage job parameter
Moderators: chulett, rschirm, roy
Passing before routine output in the datastage job parameter
Hi
I need to get the file name from a Database table(DB2). The table has a job name and file name cross reference.Then pass the file name as a job parameter to the sequential file which processes it.
I would like to have a before job shell which gets the file name and passes it to the job parameter. Is it possible?
( I can do it with a hash file with job name file name and file name- he look it up and pass it to the parameter-but have to change all the jobs which are already coded. A before routine would make it easy and nobody would even notice the change in design )
I need to get the file name from a Database table(DB2). The table has a job name and file name cross reference.Then pass the file name as a job parameter to the sequential file which processes it.
I would like to have a before job shell which gets the file name and passes it to the job parameter. Is it possible?
( I can do it with a hash file with job name file name and file name- he look it up and pass it to the parameter-but have to change all the jobs which are already coded. A before routine would make it easy and nobody would even notice the change in design )
Avishek Mukherjee
Data Integration Architect
Chicago, IL, USA.
Data Integration Architect
Chicago, IL, USA.
I forgot to add the main requirement:
Actually I do not want to hard code the file name in the Sequential stage..
I know the pattern <Some ID field>_<FileType>_<TimeStamp>
for examle 1121_UCSINV_10192006082945..
at the time of running the job we can hard code the first two values. I need to run the once having the most recent time stamp value in it.
I thought about putting it in table and then assign the job parameter...Is there some other way to run a file without hardcoding its whole name?
Actually I do not want to hard code the file name in the Sequential stage..
I know the pattern <Some ID field>_<FileType>_<TimeStamp>
for examle 1121_UCSINV_10192006082945..
at the time of running the job we can hard code the first two values. I need to run the once having the most recent time stamp value in it.
I thought about putting it in table and then assign the job parameter...Is there some other way to run a file without hardcoding its whole name?
Avishek Mukherjee
Data Integration Architect
Chicago, IL, USA.
Data Integration Architect
Chicago, IL, USA.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Job parameter values must be set before the job run request is issued, and can not legally be changed thereafter.
Parsing is easy, use the Field() function with a delimeter argument of "_".
Parsing is easy, use the Field() function with a delimeter argument of "_".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
Ray, just a bit curious to know - does this mean there is a illegal way to do this?ray.wurlod wrote:can not legally be changed thereafter
Search the forum for the setting job params and you find the way to set params in before job routines.
Use the job parameters and set their values in before job as suggested by Ray and you will have value from database.
If this filename is just a target filename, there is one more way.
You can do the samething using after job routines. Store the result in some temp job and write an after job routine which will rename the temp file to actual file. Here you can get the value from DB or have it whatever you want.
Regards,
S. Kirtikumar.
S. Kirtikumar.
I think I am not able to explain my requirements:Kirtikumar wrote:Use the job parameters and set their values in before job as suggested by Ray and you will have value from database.
In a Unix directory I have a file. My job knows the direcoty path at run time and also knows the first part of the file name. I want my job to run any file that matchs the pattern.
How would I give the pattern in the Sequential Stage.
If I can do that- I do not need to assign job parameters.
Thanks for your help
Avishek Mukherjee
Data Integration Architect
Chicago, IL, USA.
Data Integration Architect
Chicago, IL, USA.
How does your job 'know' these things? If it knows them, go ahead and use that knowledge in the Sequential File stage.
What you should be doing is parameterizing both pieces and use those parameters in the stage.
Forget about all this 'before routine sets parameter values in running job' or seeking any... 'illegal' means of doing so, that path only leads to the Dark Side.
What you should be doing is parameterizing both pieces and use those parameters in the stage.
Forget about all this 'before routine sets parameter values in running job' or seeking any... 'illegal' means of doing so, that path only leads to the Dark Side.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
My doesn't know what is the file name. So I cannot use this parameter. What I know is the file pattern..vsi wrote:Hi Avishek
Though I did not understand your req. this might be helpful ,When you want to process all the files which has a particular pattern why don't you use Folder stage.
Thanks
Like Unix uses metacharacters- can we use them in Datastage...so that the sequential file stage picks up any file if it matches the pattern
Avishek Mukherjee
Data Integration Architect
Chicago, IL, USA.
Data Integration Architect
Chicago, IL, USA.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Yes. I don't go there. And it may not work in version 8.0 and later.Kirtikumar wrote:Ray, just a bit curious to know - does this mean there is a illegal way to do this?ray.wurlod wrote:can not legally be changed thereafter
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.