hi,
I have a parallel job. Input is a file stage and the data is populated into a table through Teradata stage.
I need to take a backup of the files processed with a timestamp attached to it at runtime after successful completion of the job without hardcoding the timestamp in Job porperties.
Is there any built in function that I can use to have the current timestamp and assign it to a variable in Job properties.
Please let me know in case of any pointers.
regards
anand
Attach datetime to file after succesful completion of job
Moderators: chulett, rschirm, roy
Where do you need this timestamp? DS Jobs will let you use @DATE and @TIME to get the current time into a variable for use within a job. You can use the corresponding OS functions if you shell out to perform file copy operations. "Job Properties" is a designer box, and apart from the parameters there isn't anything that I recall in there that changes during job runs.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
hi,
I have a set of input files with data that needs to be moved into a Teradata table after regular intervals of time.
All the input files before getting processed will be moved to the same file path and will be having the same file name.
Once the data from a file is moved into the table, the file is moved to an archive directory with timestamp attached.
e.g #pFILENAME#.#pTIME#
where pFILENAME = file name processed
pTIME = current timestamp
I am trying the unix command 'mv' using After sub-routine to move the file to an archive directory but not able to attach the current timestamp to the file.
I tried @TIME as default value for the variable pTIME with data type as TIME, but when run it is asking for a value. Same with @DATE.
Any pointers.
Thanks
I have a set of input files with data that needs to be moved into a Teradata table after regular intervals of time.
All the input files before getting processed will be moved to the same file path and will be having the same file name.
Once the data from a file is moved into the table, the file is moved to an archive directory with timestamp attached.
e.g #pFILENAME#.#pTIME#
where pFILENAME = file name processed
pTIME = current timestamp
I am trying the unix command 'mv' using After sub-routine to move the file to an archive directory but not able to attach the current timestamp to the file.
I tried @TIME as default value for the variable pTIME with data type as TIME, but when run it is asking for a value. Same with @DATE.
Any pointers.
Thanks
-
- Participant
- Posts: 57
- Joined: Wed Jan 26, 2005 10:22 pm
- Location: India
You can use in UNIX:
But I guess you would need to call a script to concatenate it with the file you are mving.
Code: Select all
date +%Y-%m-%d-%H:%M:%S
Ashwin
There is no script that needs to be involved. This is because in our current deisgn of the project there are no unix scripts. I need to handle this with the DataStage job itself..
And since I am using the "mv" command to move the file in the job properties I need to devise how to pass the current timestamp in 'job properties' itself.
I agree that using unix script it would have been possible, but no unix script needs to be involved. Everything needs to be handled within the DataStage job itself.
Please let me know if there are any pointers.
Thanks
And since I am using the "mv" command to move the file in the job properties I need to devise how to pass the current timestamp in 'job properties' itself.
I agree that using unix script it would have been possible, but no unix script needs to be involved. Everything needs to be handled within the DataStage job itself.
Please let me know if there are any pointers.
Thanks
-
- Participant
- Posts: 31
- Joined: Mon Dec 01, 2003 6:24 am
- Location: London
If you are using a mv command in an After-Job Subroutine you can do the following:
The ExecSH option should be selected.
Code: Select all
mv <Source_Dir>/<Your_File> <Target_Dir>/<Your_File>`date '+%Y-%m-%d:%H:%M:%S'`