month from date

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
consulting
Participant
Posts: 50
Joined: Fri Dec 21, 2007 3:24 am

month from date

Post by consulting »

Hi
I have date column like 20070203
20070912
........the format is yyyymmdd in text file i want to split month only ie 02
09...

How to achive it in parallel? what function should be used?


thanks
Balaji G
balaji
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

From your examples i would assume that the input is always 8 characters long. So a simple substring like In.Col[5,2] in a transformer stage would do.
It is our choices that show what we truly are, far more than our abilities - J.K.Rowling
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you have a Date column is does NOT have a format: your Sequential File stage specifies the date format in the file and the import operator looks after it. If it's a Char or VarChar data type then the format is important.

There are date conversion functions both for the Modify stage and for the Transformer stage for extracting components from dates.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
consulting
Participant
Posts: 50
Joined: Fri Dec 21, 2007 3:24 am

Post by consulting »

Thanks
In server we can use substring. How about in Px?
balaji
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

consulting wrote:Thanks
In server we can use substring. How about in Px?
you can use substring in PX too.

Code: Select all

datecolumn[5,6]
Regards,
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

ONLY if it is a string. If it is a date, you need to apply a date to string conversion function first.

There are other functions available that will extract date components directly from dates.
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