Dynamic Time Stamp

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
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Dynamic Time Stamp

Post 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
Peytot
Participant
Posts: 145
Joined: Wed Jun 04, 2003 7:56 am
Location: France

Post by Peytot »

I don't think so. I think you need to use an After Subroutine to rename it with a system variable.

Pey
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post 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.
Kind Regards
Stephan
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post 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
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post 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.
Kind Regards
Stephan
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post 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.....
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post by spracht »

I found it:

viewtopic.php?t=85059

and sorry, It wasn'r Michael but ariear :oops:
Kind Regards
Stephan
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post 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
Kind Regards
Stephan
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post 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
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post by JDionne »

worked like a charm
Thanx
Jim
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post 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
Post Reply