create cvs file with timestamp

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

Post by chulett »

Two ways.

1) Pass in the value to use as a Job Parameter and then use that parameter in the output filename.

2) Create a fixed filename in the job and then 'after job' rename / timestamp the file via your O/S, either directly or scripted.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

Jessie,

If the format of the date is not an issue, then you can achieve this by using the macro DSJobStartDate. This can be used right where you provide the name for the file (inside the Seq File stage). EX: ...Path.../DummyFile_#DSJobStartDate#.csv would generate a file in the path named DummyFile_05-14-2008.csv (I am not sure how it generates the date, but...you got the idea :wink: )

If format does matter, the way I did would be to handle it in an after job sub-routine. Invoke an ExecSh and in that you can rename the file that is being generated (search online for syntax and options). Assuming that you need current date, inside the routine, manipulate the Current Date or the date you need (passed as a parameter/argument) using OConv function and store it in a variable. Then you would use ExecSh and rename the file and concatenate the manipulated date to the name. I have actually implemented it and this is an idea I got from one of the earlier posts written by "DSGuru2B". So, you also might want to search for earlier posts for some more input.

Let us know how it goes.
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
Post Reply