Passing before routine output in the datastage job parameter

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
avi21st
Charter Member
Charter Member
Posts: 135
Joined: Thu May 26, 2005 10:21 am
Location: USA

Passing before routine output in the datastage job parameter

Post by avi21st »

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 :lol: )
Avishek Mukherjee
Data Integration Architect
Chicago, IL, USA.
avi21st
Charter Member
Charter Member
Posts: 135
Joined: Thu May 26, 2005 10:21 am
Location: USA

Post by avi21st »

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?
Avishek Mukherjee
Data Integration Architect
Chicago, IL, USA.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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 "_".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

ray.wurlod wrote:can not legally be changed thereafter
Ray, just a bit curious to know - does this mean there is a illegal way to do this?

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.
avi21st
Charter Member
Charter Member
Posts: 135
Joined: Thu May 26, 2005 10:21 am
Location: USA

Post by avi21st »

Kirtikumar wrote:Use the job parameters and set their values in before job as suggested by Ray and you will have value from database.
I think I am not able to explain my requirements:

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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

And Dark side can get scary :twisted: , right Craig ?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
vsi
Premium Member
Premium Member
Posts: 507
Joined: Wed Mar 15, 2006 1:44 pm

Post by vsi »

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
avi21st
Charter Member
Charter Member
Posts: 135
Joined: Thu May 26, 2005 10:21 am
Location: USA

Post by avi21st »

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
My doesn't know what is the file name. So I cannot use this parameter. What I know is the file pattern..

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.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Nop. Sorry, wild cards are not allowed in a server job. You will have to pre-determine the values of all the parameters and pass it to this job.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You'll need to either process all the files one by one in a loop or concatenate all files together pre-job and then process the combo file.
-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 »

Kirtikumar wrote:
ray.wurlod wrote:can not legally be changed thereafter
Ray, just a bit curious to know - does this mean there is a illegal way to do this?
Yes. I don't go there. And it may not work in version 8.0 and later.
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