About @DATE

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
puli.reddy
Participant
Posts: 28
Joined: Wed Jan 11, 2006 8:29 pm
Location: Singapore
Contact:

About @DATE

Post by puli.reddy »

Hi,

I am using @DATE function to populate current date value. When I was viewing DSDB2 column values using datastage after population, it shows values as 13914 (2006-02-03). In DB2 it shows in specific format 02/03/2006.
Why it is showing same value in two different ways?

How will I extract year and month values in the format "YYYYMM" from @DATE function

Thanks in advance.
Thnaks and Regards,
AnjiReddy.
srividya
Participant
Posts: 62
Joined: Thu Aug 25, 2005 2:31 am
Location: Ashburn,VA

Post by srividya »

@Date gives the Internal Date
13914 is the internal date of datastage
Did you check the DCode Function?

if not pls check it
it will help you with the all the Date conversions you need
and the answer for
How will I extract year and month values in the format "YYYYMM" from @DATE function
will also be there

is it mandatory that you extract YYYYMM from @Date only? There are lot other functions can give you the result

ex:@Year:@Month
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The DB/2 interface will automatically do the conversion from the internal date representation inside DataStage to the external date format for you. This is the one exception where you don't need to manually take care of this conversion.
puli.reddy
Participant
Posts: 28
Joined: Wed Jan 11, 2006 8:29 pm
Location: Singapore
Contact:

Post by puli.reddy »

Hi Vidya,

Thanks for ur response. I couldn't find any help on DCode function. Do u mean Iconv and Oconv or DCode is an independent one.

By using following expression I get YYYYMM format
Oconv(Iconv(@YEAR,"DY[2]"),"DY[4]") : Oconv(Iconv(@MONTH,"DM[2]"),"DM[2]")

I am curious to get by using @DATE
I was using the following expression to get
Oconv(@DATE,"DYM[4,2]")

but it gives a blank value between year and month.

Any help would be appreciated..
Thnaks and Regards,
AnjiReddy.
kcshankar
Charter Member
Charter Member
Posts: 91
Joined: Mon Jan 10, 2005 2:06 am

Post by kcshankar »

Hi Puli.reddy,

Code: Select all

I am curious to get by using @DATE 
I was using the following expression to get 
Oconv(@DATE,"DYM[4,2]") 
but it gives a blank value between year and month. 
try this to extract year and month values in the format "YYYYMM" from @DATE function

Oconv(@DATE, "D YM")

regards
kcs
srividya
Participant
Posts: 62
Joined: Thu Aug 25, 2005 2:31 am
Location: Ashburn,VA

Post by srividya »

Hi Angi garu

what did u mean by blank value?
The space coming between year and date?
the result for

Code: Select all

OConv(@Date,'DYM[4,2]')

will be 2006 02
the space,i guess., is the separator between year and month.Correct me if I'm wrong
to have a better idea., try this one

Code: Select all

OConv(@Date,'D-YM[4,2]')

it will give the result as 2006-02

I couldn't find any help on DCode function.
its D Code not DCode....search for D Code (Space between D and Code :) )
Sunshine2323
Charter Member
Charter Member
Posts: 130
Joined: Mon Sep 06, 2004 3:05 am
Location: Dubai,UAE

Post by Sunshine2323 »

Hi puli.reddy,

Try this,

OCONV(@DATE,"DY"):OCONV(@DATE,"DM[2]")

Hope this helps :)
Warm Regards,
Amruta Bandekar

<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This paper may also shed some light on date conversions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
puli.reddy
Participant
Posts: 28
Joined: Wed Jan 11, 2006 8:29 pm
Location: Singapore
Contact:

Thanks everyone

Post by puli.reddy »

It seems every one is keen in posting a solution. I like this approach from this site. I never got quick solution from any other forum other than this. Keep it up dsxchangers....

Thanks everyone ..

The solution from Amruta is working in my case Oconv(@DATE,"DY") : Oconv(@DATE,"DM[2]")

Yes vidya I mean to say a space was coming between year and month.

Sekhar, ur method nor did
Thnaks and Regards,
AnjiReddy.
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, "DYM[4,2]" : @VM : "MCN") 
is slightly more efficient.
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