Page 1 of 1

sequential file name with system date and time

Posted: Thu Mar 06, 2003 2:15 am
by luca
How can I insert the system variable @date and @time in the name of a file ? Hope it is possible.
Thanks.

Posted: Thu Mar 06, 2003 4:42 am
by ray.wurlod
Depends on where you're doing it.

In DataStage BASIC it's easy.
FileName:".":Oconv(@DATE,"DDMY":@VM:"MCN"):".":Oconv(@TIME,"MTS":@VM:"MCN")


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

Posted: Thu Mar 06, 2003 5:27 am
by luca
Thank you for your anwers, to be more precise:
I want to do this in a job server (with a flow design)
and don't want to use a parameter (as this is not a parameter)
...
any other ideas?

Posted: Thu Mar 06, 2003 5:30 am
by luca
By the way (for ranjan), to insert a parameter value in the name of a file, the syntax is:
FILE_#parameterName#

Posted: Thu Mar 06, 2003 8:08 am
by chulett
luca -

I don't *believe* you can do this in a server job without leveraging a job parameter. Meaning, typically this would be set by job control and then passed in as a parameter. Or another (pre/controlling) job could generate the information and then stash it in a manner that a followup job could grab it and bring it in as a parameter. We date/time stamp filenames in this manner all the time.

Be happy to be proven wrong. [:)]

-craig

Posted: Thu Mar 06, 2003 11:07 am
by ray.wurlod
How about writing to a standard file name, then changing the name in an after-stage subroutine, perhaps ExecSH to execute a mv command?
Check out the man page on date, and remember that you can capture the output of a command in backquotes.
For example: mv filename filename.`date`

Posted: Thu Mar 06, 2003 5:36 pm
by chulett
Another excellent suggestion from Ray! [:D] You could even use a 'generic' script that takes the filename as a parameter and stamps it in some standard manner, which may give you a little more control and the ability to report errors more gracefully.

Don't forget you have control over the formatting of the date command, and can include the time as well. For example:

`date +%m%d%Y_%H%M%S`
`date +%Y%m%d`

-craig

Posted: Mon Mar 10, 2003 7:14 pm
by mihai
[:(]
You lucky lucky people.
DataStage on Unix (sigh)
[V]

Mihai

_________________________
desk direct:+441908448571