Page 1 of 1

Data and Time for the sequential file.

Posted: Fri Jun 10, 2011 11:51 am
by highpoint
Hi,

I want the sequential file name to have Date and Time in the following fomat.

20110610_124801

I am creating this as a variable in user varaiables activity and passing it is as parameter to job.


I am using the following:

Code: Select all

OCONV(DATE(), "D4-YMD[4,2,2]"): '_':OCONV(TIME(), "MTS") 

This returns:
2011-06-10_12:43:11

Sequential file name does not like ":" in its name.

I have gone through forum search. Could not find anything that suits me.


Help is appreciated to modify the OCONV to suit my format of

20110610_124801

Re: Data and Time for the sequential file.

Posted: Fri Jun 10, 2011 11:56 am
by samyamkrishna
in the file name do not give colon ':'

Or create two variable one for date and one for time and use it as in the sequential file stage.

#PATH#'/'#FILENAME##DATE#'_'#TIME#

this should work

Re: Data and Time for the sequential file.

Posted: Fri Jun 10, 2011 11:57 am
by highpoint
How are you generating DATE and TIME in user variable activity.

This should be generated during run time

Re: Data and Time for the sequential file.

Posted: Fri Jun 10, 2011 12:05 pm
by samyamkrishna
using functions the same you are doing above.
But instead of one variable create two variables and use them the file stage

Re: Data and Time for the sequential file.

Posted: Fri Jun 10, 2011 12:12 pm
by highpoint
Then time will have colon in it

Re: Data and Time for the sequential file.

Posted: Fri Jun 10, 2011 12:16 pm
by samyamkrishna
remove them inside the job. what are the stage you are using.
If there is a transformer stage you can easily remove it.

Re: Data and Time for the sequential file.

Posted: Fri Jun 10, 2011 12:17 pm
by highpoint
As mentioned above i am creating this in user variable activity.

Re: Data and Time for the sequential file.

Posted: Fri Jun 10, 2011 12:20 pm
by samyamkrishna
ar eyou using a transformer stage in the job?

Posted: Fri Jun 10, 2011 1:19 pm
by chulett
As noted, remove them if you don't want them in the final output:

Code: Select all

Convert("-:","",OCONV(DATE(), "D4-YMD[4,2,2]"): '_':OCONV(TIME(), "MTS"))

Posted: Fri Jun 10, 2011 1:22 pm
by mobashshar
If you are using Current Date and Time for file creation.. then do the following:

Create the file with a generic name like outfile
Use After Job Subroutine and ExecSH and do the following:
mv outfile outfile.`date +"%m%d%y%H%M%S"`

Done!

Posted: Fri Jun 10, 2011 4:25 pm
by ray.wurlod

Code: Select all

Oconv(Date(), "D4YMD[4,2,2]" : @VM : "MCN") :  "_" : Oconv(Time(), "MTS" : @VM : "MCN")