Data and Time for the sequential file.

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
highpoint
Premium Member
Premium Member
Posts: 123
Joined: Sat Jun 19, 2010 12:01 am
Location: Chicago

Data and Time for the sequential file.

Post 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
samyamkrishna
Premium Member
Premium Member
Posts: 258
Joined: Tue Jul 04, 2006 10:35 pm
Location: Toronto

Re: Data and Time for the sequential file.

Post 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
highpoint
Premium Member
Premium Member
Posts: 123
Joined: Sat Jun 19, 2010 12:01 am
Location: Chicago

Re: Data and Time for the sequential file.

Post by highpoint »

How are you generating DATE and TIME in user variable activity.

This should be generated during run time
samyamkrishna
Premium Member
Premium Member
Posts: 258
Joined: Tue Jul 04, 2006 10:35 pm
Location: Toronto

Re: Data and Time for the sequential file.

Post by samyamkrishna »

using functions the same you are doing above.
But instead of one variable create two variables and use them the file stage
highpoint
Premium Member
Premium Member
Posts: 123
Joined: Sat Jun 19, 2010 12:01 am
Location: Chicago

Re: Data and Time for the sequential file.

Post by highpoint »

Then time will have colon in it
samyamkrishna
Premium Member
Premium Member
Posts: 258
Joined: Tue Jul 04, 2006 10:35 pm
Location: Toronto

Re: Data and Time for the sequential file.

Post 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.
highpoint
Premium Member
Premium Member
Posts: 123
Joined: Sat Jun 19, 2010 12:01 am
Location: Chicago

Re: Data and Time for the sequential file.

Post by highpoint »

As mentioned above i am creating this in user variable activity.
samyamkrishna
Premium Member
Premium Member
Posts: 258
Joined: Tue Jul 04, 2006 10:35 pm
Location: Toronto

Re: Data and Time for the sequential file.

Post by samyamkrishna »

ar eyou using a transformer stage in the job?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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"))
Last edited by chulett on Fri Jun 10, 2011 4:38 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mobashshar
Participant
Posts: 91
Joined: Wed Apr 20, 2005 7:59 pm
Location: U.S.

Post 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!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Oconv(Date(), "D4YMD[4,2,2]" : @VM : "MCN") :  "_" : Oconv(Time(), "MTS" : @VM : "MCN") 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply