Transformation help required in Transformer

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
harman
Participant
Posts: 8
Joined: Tue Apr 12, 2016 12:51 pm

Transformation help required in Transformer

Post by harman »

Hi,

i need below transformation help in transformer

LAST_DAY(Current_Date - 1 MONTH)

please help me on this.
SUKH
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... in other words... you need to find the last day of the previous month?
-craig

"You can never have too many knives" -- Logan Nine Fingers
harman
Participant
Posts: 8
Joined: Tue Apr 12, 2016 12:51 pm

Post by harman »

Yes chulett last day of previous month
SUKH
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Please clarify what is meant by minus 1 month... is it meant as "previous month" or subtract 30 days, etc.?
Choose a job you love, and you will never have to work a day in your life. - Confucius
harman
Participant
Posts: 8
Joined: Tue Apr 12, 2016 12:51 pm

Post by harman »

minus 1 month means previous month

values
LAST_DAY(Current_Date - 1 MONTH) i ran this statement in db2 and got the result
2016-03-31 same i need through datatstage
SUKH
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

That's pretty straight forward these days with a couple of parallel transform functions: one to subtract a month and another to get the number of days in a month.

What I don't remember though... in what version was the DaysInMonth function added? It's relatively new and I don't remember if it existed in version 9.

Mike
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Last day of previous month is a one day (-1 day) offset from the first day of the current month.

Therefore the easiest solution is to build the first day of the current month by subtracting the current day number in the month from the current date.

Functions are DateFromDaysSince() and MonthDayFromDate(). The rest is simple arithmetic.
Last edited by ray.wurlod on Wed Apr 13, 2016 5:10 pm, 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.
harman
Participant
Posts: 8
Joined: Tue Apr 12, 2016 12:51 pm

Post by harman »

Thanks Ray for reply.

can you please help me by providing the transformation i can use in transformer
SUKH
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I provided you with the needed functions - please experiment with these as a learning experience.

I prefer to teach you to fish rather than to give you a fish.
If I give you a fish that's consulting, and you pay for my time.
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