Page 1 of 1

save as TimeStamp

Posted: Sun Jun 13, 2004 10:38 pm
by rcil
Hi

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

thanks
rcil

Posted: Sun Jun 13, 2004 11:07 pm
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.

Posted: Mon Jun 14, 2004 12:07 am
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

Posted: Mon Jun 14, 2004 4:12 pm
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.

Posted: Mon Jun 14, 2004 10:52 pm
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