Append system date and time to a file name in Seq File Stag

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You'd need to pass those values in as job parameters to use them in the filename when created. Another option is to create a static filename and then rename it / add the timestamp after job, typically via a generic script.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ambasta
Participant
Posts: 93
Joined: Thu Jan 19, 2006 10:29 pm
Location: Bangalore

Post by ambasta »

After generating the file ..use after job subroutine or Unix shell script to rename the file
ambasta
franck0677
Participant
Posts: 3
Joined: Tue Sep 23, 2008 2:52 am
Location: France

More details please ?

Post by franck0677 »

chulett wrote:You'd need to pass those values in as job parameters to use them in the filename when created. ...
Hi, thanks for your explanation but could you give some details around the syntax of that. Around passing this values in as job parameters.
Some exemples ?
Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

For example, assuming a job parameter named FILE_TIMESTAMP, you would specify the filename as:

FileName_#FILE_TIMESTAMP#.txt

Does that help?
-craig

"You can never have too many knives" -- Logan Nine Fingers
franck0677
Participant
Posts: 3
Joined: Tue Sep 23, 2008 2:52 am
Location: France

Post by franck0677 »

chulett wrote:For example, assuming a job parameter named FILE_TIMESTAMP, you would specify the filename as:

FileName_#FILE_TIMESTAMP#.txt

Does that help? ...
OK thank u, and we used oconv to assign the good value to the parameter.
franck0677
Participant
Posts: 3
Joined: Tue Sep 23, 2008 2:52 am
Location: France

Post by franck0677 »

chulett wrote:For example, assuming a job parameter named FILE_TIMESTAMP, you would specify the filename as:

FileName_#FILE_TIMESTAMP#.txt

Does that help? ...
OK thank u, and we used oconv to assign the good value to the parameter.
srimitta
Premium Member
Premium Member
Posts: 187
Joined: Sun Apr 04, 2004 7:50 pm

Post by srimitta »

Or you can pass Timestamp as part of File name ( FileName_#FILE_TIMESTAMP#.txt) dynamically from Sequencer job or Job Control job.
Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives.
By William A.Foster
srimitta
Premium Member
Premium Member
Posts: 187
Joined: Sun Apr 04, 2004 7:50 pm

Post by srimitta »

Or you can pass Timestamp as part of File name ( FileName_#FILE_TIMESTAMP#.txt) dynamically from Sequencer job or Job Control job.
Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives.
By William A.Foster
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You might want to expand on that a little, seeing as how you cannot have a parameter value that references another parameter.
-craig

"You can never have too many knives" -- Logan Nine Fingers
GSIDSXGrp
Premium Member
Premium Member
Posts: 19
Joined: Tue Jul 31, 2007 2:25 pm

Post by GSIDSXGrp »

The method I used to get a sequence file name that includes the current date:

In the Parallel Job add a Parameter for the Current Date. In the Sequential File stage include the parameter in the File: myfile_#Current_Date#.txt

Create a Sequence Job. Add UserVariables Activity Stage. In the UserVariables stage add a variable in User Variables named TODAY_YYYYMMDD with Expression convert('-','',oconv(@DATE, "D4-YMD[4,2,2]"))

Add my Parallel Job as a Job Activity Stage to the Sequence Job. Link with UserVariables to Job Activity. In Job Activity Parameters, Insert the Parameter from UserVariables Stage.
tbtcust
Premium Member
Premium Member
Posts: 230
Joined: Tue Mar 04, 2008 9:07 am

Post by tbtcust »

Thanks GSIDSXGrp. Your solution works great.
Post Reply