how could i append "Date" to sequential 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
jose.arunbabu
Participant
Posts: 6
Joined: Tue Jan 20, 2009 10:21 pm

how could i append "Date" to sequential file name

Post by jose.arunbabu »

Hi,

My requirment is to gnerate csv files like "<date>.csv " from datastageV8 at the target stage. Every time i run the job i need to get the with the todays date as its file name.

I have to get a solution on how to do this entirely in datastage itself.

Thanks in advance

Jose
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Don't.

Generate xyz.csv and use an after-job subroutine to change the name of the file.

It's FAR easier.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

But carries baggage of it's own which may be too heavy. Like, an After routine is already defined for the job or such a simple task as renaming a file seems overly complicated to do it in two places, one fairly hidden in the GUI.
I like using a DS Macro for this;

Code: Select all

#DSJobStartDate#.csv
Everything has a downside and this one is that the file will be overwritten if you run the job more then once a day.
rony_daniel
Participant
Posts: 36
Joined: Thu Sep 01, 2005 5:44 am
Location: Canada

Post by rony_daniel »

throbinson wrote:But carries baggage of it's own which may be too heavy. Like, an After routine is already defined for the job or such a simple task as renaming a file seems overly complicated to do it in two places, one fairly hidden in the GUI.
I like using a DS Macro for this;

Code: Select all

#DSJobStartDate#.csv
Everything has a downside and this one is that the file will be overwritten if you run the job more then once a day.
That downside can also be taken care if another macro #DSJobStartTime# is added to the file name like #DSJobStartDate#_#DSJobStartTime#.csv
Thanks & Regards,
Rony
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

That doesn't work on UNIX 7.5.3, neither does #DSJobStartTimeStamp# for this reason;

Sequential_File_15: When processing argument -fileWhen processing path: /tmp/2009-02-18_07:55:25.csv is not a valid path name: Invalid hostname: /tmp/2009-02-18_07

Are you saying it works on 8.x or yours (rony_daniel)?
v2kmadhav
Premium Member
Premium Member
Posts: 78
Joined: Fri May 26, 2006 7:31 am
Location: London

Post by v2kmadhav »

Hello

If you can afford to use a parameter and call the job from a sequencer...
you can pass in
Convert('-: ','', DSJobStartTimestamp)
it would create your file as 20090218135610.csv

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

Post by chulett »

Both of those macros in filenames work fine for me - H-PUX, 7.5.1a, Server. Are you saying they don't work in PX jobs? Or are you saying that your flavor of UNIX does not allow the colons in the filename?
-craig

"You can never have too many knives" -- Logan Nine Fingers
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

My AIX 5.3 doesn't care about the colons. It appears to be EE. How about your EE?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Me no gots EE. :cry:
-craig

"You can never have too many knives" -- Logan Nine Fingers
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

Server - works
EE - Doesn't work because of the colon. A hardcoded test of a Sequential file name that contains a colon throws the same fatal warning;

Code: Select all

Sequential_File_15: When processing argument -fileWhen processing path: /tmp/todd:todd.csv is not a valid path name: Invalid hostname: /tmp/todd
and UNIX doesn't care either;

Code: Select all

touch todd:todd.csv
-rw-rw-r--   1 dstage            0 Feb 18 08:55 todd:todd.csv
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'm not aware of a UNIX that would care about the colons, but decided to ask. This smells like a bug... anyone report this to their support provider, gotten an official take on the issue?
-craig

"You can never have too many knives" -- Logan Nine Fingers
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

Just to completely beat this to death and then set it on fire, a colon is not allowed in a Windows filename.
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Hmm.. flaming colons...

Could have lived without that visual...
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Apparently there are creams that you can use...

... or innuendoes (the old gags are best!)
:lol:
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