how to get quarter date format

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
pxraja
Participant
Posts: 142
Joined: Fri Mar 14, 2008 10:22 am

how to get quarter date format

Post by pxraja »

Hi all,

I want to get the quarter format like

for the input link

Inlink.field1 Inlink.field2
5848 May 08
5848 July 08

Outlink.field1 Outlink.field2
5848 2008Q2 for 2nd quarter
5848 2008Q3 for 3rd quarter

I tried for Oconv(Iconv(Inlink.field2,'D MY[A3,2]'),'DQYQ')

It's giving me result what I am not expecting (obivously, its returning again quarter value)

but how to get Q inserted inbetween year and quarter

any ideas are welcomed
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

StageVar: InternalDate = ICONV(Inlink.field2,'D MY[A3,2]')
Derivation: OCONV(InternalDate,'D4Y'):'Q':OCONV(InternalDate,'DQ')
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: how to get quarter date format

Post by chulett »

pxraja wrote:but how to get Q inserted inbetween year and quarter
In other words, you need to handle the 'Q' and insert it between the two other elements.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Simply apply the QUARTER.TAG transform. This gives yyyyQn (a standard format specified in ISO 8601).

If you require nQyyyy then something like the following will do it.

Code: Select all

Oconv(Iconv(InLink.TheDate,"DMY[A3,2]"),"DQY['Q']")
Or, if you require a two-digit year, the following.

Code: Select all

Oconv(Iconv(InLink.TheDate,"DMY[A3,2]"),"D2QY['Q']")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or that. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
pxraja
Participant
Posts: 142
Joined: Fri Mar 14, 2008 10:22 am

Post by pxraja »

ArndW wrote:StageVar: InternalDate = ICONV(Inlink.field2,'D MY[A3,2]')
Derivation: OCONV(InternalDate,'D4Y'):'Q':OCONV(InternalDate,'DQ') ...
Hi all,

Thanks for your ideas, either of two is working fine, QUARTER.TAG and the above quotes has resolved
truenorth
Participant
Posts: 139
Joined: Mon Jan 18, 2010 4:59 pm
Location: San Antonio

Post by truenorth »

I am facing the same situation here. I have a date type field. What is the syntax for QUARTER.TAG? Is it expecting a date type or internal? I am currently running a server job and the first lines in the job log in Director is a warning that QUARTER.TAG was passed a non-numeric value. Will the job still finish with the correct results?

Is there any way to pull this off in a parallel job? I tried using QUARTER.TAG, but got an error as soon as I entered it in Transformer.

Again, I have a date field. And I want to get the year and quarter in this format: 2010Q1

And I prefer to do everything in a parallel job rather than a server one.

Thanks in advance.
Todd Ramirez
Sr Consultant, Data Quality
San Antonio TX
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need to start your own post over in the PX / Enterprise Edition forum.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Vineet Pal Singh
Participant
Posts: 21
Joined: Mon Mar 16, 2009 3:59 am

Post by Vineet Pal Singh »

Oconv(Iconv(ASOF_DT[1,10] ,"D-YMD[4,2,2]"),"DQ")
Post Reply