Page 1 of 1

Putting timestamp in filename of sequential stage

Posted: Thu Oct 21, 2004 3:59 pm
by cbres00
I have a simple job where I am pulling data from a MS SQL table, doing some minor transforms, then writing to a sequential file stage.

I want to use time to uniquely identify the filename (I have a param in the job for date). Right now my file name in the sequential stage is

my_file_#rundate#.txt Rundate is the job param.

I'd like the file name to look like

my_file_#rundate#.HHMMSS.txt

How can I accomplish this in an elegant manner?

Regards,
CB

Posted: Thu Oct 21, 2004 4:19 pm
by ray.wurlod
The easiest way is to have the job write to the base file name then have an after-stage or after-job subroutine run a command to change the name of the file.

For example you could invoke ExecSH as the routine, and provide the command

Code: Select all

mv #FileName# #FileName#_`date +"%Y%m%d"`_`date +"%H%M%S"`

Posted: Thu Oct 21, 2004 4:21 pm
by cbres00
Ok! Thanks much.

CB

ray.wurlod wrote:The easiest way is to have the job write to the base file name then have an after-stage or after-job subroutine run a command to change the name of the file.

For example you could invoke ExecSH as the routine, and provide the command

Code: Select all

mv #FileName# #FileName#_`date +"%Y%m%d"`_`date +"%H%M%S"`