Numeric to Date Conversion

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

Post by ray.wurlod »

You would have helped yourself by creating a written specification. Your input data is of the form "CD(m+n) yyyy" and what you want out of this is the month name corresponding to m. Is this correct?

Break down the specification into algorithmic steps.
1. Extract m from input value. This is the value to the left of the "+" and to the right of the "(".
2. Decode m to month name.

You can do each of these in stage variables (for example svMonthNum for the first piece), or construct a complex expression.

Code: Select all

svMonthNum  <==  Field(Field(InLink.TheValue, "(", 2, 1), "+", 1, 1)

Field("Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec", "|", svMonthNum, 1)
Last edited by ray.wurlod on Thu Aug 03, 2006 1:57 am, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kksr
Participant
Posts: 37
Joined: Fri Dec 30, 2005 5:57 am

Post by kksr »

Yes your correct Ray.
KKSR
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It has since occurred to me that step 1 (extraction of the month number) could readily be achieved with a MatchField() function.

Code: Select all

MatchField(InLink.TheValue, "0X'('0N'+'0X", 3)
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