Page 1 of 1

Dynamic Time Stamp

Posted: Thu Oct 23, 2003 7:20 am
by JDionne
I have a process currently in SQL server that runs a query and outputs a string of date time information into a batch file. Then I run the batch file to rename a load file. I am moving away from sql server and using DataStage as my data processing tool of choice. Is there a way for data stage to dynamicaly produce a name for a file and rename it?
Jim

Posted: Thu Oct 23, 2003 7:43 am
by Peytot
I don't think so. I think you need to use an After Subroutine to rename it with a system variable.

Pey

Posted: Thu Oct 23, 2003 8:51 am
by spracht
A couple of weeks ago, Michael Hester pointed out that you can use DS makros just like job parameters, surrounded by hashes, to achieve that.

Posted: Thu Oct 23, 2003 9:08 am
by JDionne
spracht wrote:A couple of weeks ago, Michael Hester pointed out that you can use DS makros just like job parameters, surrounded by hashes, to achieve that.
How would I search to find that post so that I can figure it out?
What was the tipc subject?
Jim

Posted: Thu Oct 23, 2003 9:27 am
by spracht
Can't remember, try to use

DSJobStartDate
DSJobStartTime
DSJobStartTimestamp

in your file name specification. like

file#DSJobStartDate#.txt to get 'file_2003-10-23.txt' as your file name.

Posted: Thu Oct 23, 2003 9:30 am
by JDionne
spracht wrote:Can't remember, try to use

DSJobStartDate
DSJobStartTime
DSJobStartTimestamp

in your file name specification. like

file#DSJobStartDate#.txt to get 'file_2003-10-23.txt' as your file name.
that makes sence....but where do i put that to rename the original data file? after job completion.....

Posted: Thu Oct 23, 2003 9:31 am
by spracht
I found it:

viewtopic.php?t=85059

and sorry, It wasn'r Michael but ariear :oops:

Posted: Thu Oct 23, 2003 9:39 am
by spracht
To rename a file you can use a similar synatax in an after- job subroutine, like (how was this in Windows?): ren file file_#DSJobStartDate#.txt. In Unix, I would probably use the OS to create the new filename, like:

mv file file_$(date '+%Y%m%d').txt

Posted: Thu Oct 23, 2003 9:47 am
by JDionne
spracht wrote:To rename a file you can use a similar synatax in an after- job subroutine, like (how was this in Windows?): ren file file_#DSJobStartDate#.txt. In Unix, I would probably use the OS to create the new filename, like:

mv file file_$(date '+%Y%m%d').txt
Im testing that now..Ill let you know whats happening
Jim

Posted: Thu Oct 23, 2003 9:59 am
by JDionne
worked like a charm
Thanx
Jim

Posted: Thu Oct 23, 2003 10:52 am
by JDionne
JDionne wrote:worked like a charm
Thanx
Jim
If i wanted to run two dos commands after job has run do i seperate them with a ; ?
Jim