Page 1 of 1

Every Run date and time should change

Posted: Mon Aug 11, 2008 12:56 am
by pradeep_nov18
i have developed parallel job for the replace load where one of the output Archeive filename must have prefix Date and time how to acheieve.So for every run Date and time must change and it must overwrite(For eg:<Path><date&timefilename.dat>) and frequency of load is daily.

Re: Every Run date and time should change

Posted: Mon Aug 11, 2008 1:48 am
by syeed
pradeep_nov18 wrote:i have developed parallel job for the replace load where one of the output Archeive filename must have prefix Date and time how to acheieve.So for every run Date and time must change and it must overwrite(For eg:<Path><date&timefilename.dat>) and frequency of load is daily.
In UNIX:

if you are triggering Job through UNIX, then Add parameter which will have a value as

Var=Path/Time&DateFileName.Dat

Var=/home/Test/`date "+%Y%m%d&%H%M%S"`abc.dat

or

Just Add a Date parameter in UNIX

or

Have a routine and then pass a parameter through it

Equate RoutineName to DateTimeToTimestamp

Ans= oconv(@DATE, "DYMD[4,2,2]":@VM:"MCN"):"_" : oconv(@TIME, "MTS":@VM:"MCN")
Return(Ans)

Hope this will help you.

Posted: Mon Aug 11, 2008 7:13 am
by chulett
Or create a static filename in your job and then rename the file 'after job' using your O/S to add the date/time stamp.

Re: Every Run date and time should change

Posted: Mon Aug 11, 2008 8:34 am
by pradeep_nov18
hi Syed,

Thanks for the reply got some idea.

my file name is in ETL server that that is local/data1/edw/temp folder, even i have parameterized this path accordling to my understanding.I have to prefix the date function with file name in that right,I am using parallel job so oconv and iconv is not there please suggest how to do within datastage if possible.

Posted: Mon Aug 11, 2008 9:08 am
by chulett
The suggestion was to use a BASIC routine in a Sequence job to build the parameter, IConv and OConv would be available there.

Posted: Mon Aug 11, 2008 3:28 pm
by ray.wurlod
If you have MKS Toolkit or some other UNIX emulator installed you can also use an mv command to rename the file in an after-job subroutine ExecSH, using backquotes to capture the result of the date command.