dynamic file name

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
hobocamp
Premium Member
Premium Member
Posts: 98
Joined: Thu Aug 31, 2006 10:04 am

dynamic file name

Post by hobocamp »

This is my first post - so go easy with me. :)

I have a server job where I need part of the output file name to be dynamic. That is, the first part of the target file name will always be the same, but the second part of the target file name would be determined by a particular character value found in my source file.

To be more specific, does anyone know of a way that I would be able to attach a value from within the source file to the output target file name?

Thanks for any help.

Thomas Smith
Last edited by hobocamp on Wed Jan 03, 2007 3:33 pm, edited 1 time in total.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Welcome aboard! :D.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Can be done in two jobs. Find and store that special character, in a file or UerSatus. In your second job, define a parameter, while defining the parameter, the default value will be a routine which will make a call to the user status or read it from whereever you stored it. Tie the jobs together via job sequence.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

How about defining a job parameter "File_Name_Append" and then set the value of this parameter to your character by using 'DSSetParam' function in a stage variable.

Use the 'DSGetParamInfo' in the after-job subroutine(ExecSH) to retrieve your character from the parameter and rename your created file.

This is just coming of the top of my head. It is not tested. So, I'm not sure whether it will work.

Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can also be done in an after-job subroutine, provided you've stored the special character somewhere. But this would be a custom subroutine, not one of the out-of-the-box ones.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

It wont work Whale. A job parameter cannot be set within the job. It needs to be set before the job is fired. It can definately be done before starting the job. The OP is sitting on unix, so the special character can be read and stored in a file, the contents of that file can be passed as a parameter to the job with -param option.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Safer to assert that a job parameter can not legally be changed in a running job. Some folks out there are doing it illegally, and will need to re-think their strategy before upgrading to version 8.0, when their "hack" may cease to work.
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