Page 1 of 1

how could i append "Date" to sequential file name

Posted: Wed Feb 18, 2009 4:35 am
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

Posted: Wed Feb 18, 2009 4:43 am
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.

Posted: Wed Feb 18, 2009 6:56 am
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.

Posted: Wed Feb 18, 2009 7:50 am
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

Posted: Wed Feb 18, 2009 8:01 am
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)?

Posted: Wed Feb 18, 2009 8:08 am
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

Posted: Wed Feb 18, 2009 8:14 am
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?

Posted: Wed Feb 18, 2009 8:28 am
by throbinson
My AIX 5.3 doesn't care about the colons. It appears to be EE. How about your EE?

Posted: Wed Feb 18, 2009 8:41 am
by chulett
Me no gots EE. :cry:

Posted: Wed Feb 18, 2009 8:58 am
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

Posted: Wed Feb 18, 2009 9:28 am
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?

Posted: Wed Feb 18, 2009 9:32 am
by throbinson
Just to completely beat this to death and then set it on fire, a colon is not allowed in a Windows filename.

Posted: Wed Feb 25, 2009 4:38 pm
by asorrell
Hmm.. flaming colons...

Could have lived without that visual...

Posted: Wed Feb 25, 2009 5:36 pm
by ray.wurlod
Apparently there are creams that you can use...

... or innuendoes (the old gags are best!)
:lol: