save as TimeStamp

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
rcil
Charter Member
Charter Member
Posts: 70
Joined: Sat Jun 05, 2004 1:37 am

save as TimeStamp

Post by rcil »

Hi

Is there anyway that I can save my target seq file as TimeStamp.

thanks
rcil
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you be more specific?

I am guessing that you want to tag the file name with a timestamp of some kind. There are two approaches to this problem, searching the Forum will yield detailed solutions in each case.
  • Write to an untagged file and change its name using mv (and `date`) subsequently.

    Create job control code to generate the name of the file with a tag, and deliver this via job parameter to the job that writes to the file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rcil
Charter Member
Charter Member
Posts: 70
Joined: Sat Jun 05, 2004 1:37 am

Post by rcil »

Thanks for your response Ray. Yes you are correct, I want my target sequential file to be saved as a Timestamp.extension(ex: txt,dat etc).

According to your first solution do I have to use the mv 'date' in after job routine?

Please can you be more specific to your second solution? and on what do I have to search to get my solution in this forum because I searched in couple of ways but I didn't get any.

thanks
rcil
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could use mv in an after-job subroutine, or in a job (or job sequence) that controls this job. Use back quotes to capture that part of the date command's output that you require. For example (from AIX; use -f5 for Solaris, etc):

Code: Select all

mv `date +"%c%m%d_%H%M%S" | cut -d' ' -f6`
If you're using a controlling job, generate the output file name with intrinsic functions (and, possibly, system variables) then pass this generated name to the controlled job. For example (omitting error handling for clarity):

Code: Select all

OutputFile = "filename_" : Oconv(Date(),"DYMD":@VM:"MCN")
OutputFile := "_" : Oconv(Time(),"MTS":@VM:"MCN")
hJob = DSAttachJob("MyJob", DSJ.ERRNONE)
ErrCode = DSSetParam(hJob, "TargetFileName", OutputFile)
Perhaps a search for "DSSetParam" and "timestamp" will help you to find other posts.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

I have a very good solution on this:
We had a requirement of creating a file with a timestamp.

1.Store the timestamp value in a table.
2.Write a job which would hold this timestamp value
3.This job would call a routine which would call a second job
4.The second job would take this value as "Job Parameter"
5.This "Job Parameter" can be given as the target file name (between ##)

Regards
Post Reply