Reg. 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
wittyme
Premium Member
Premium Member
Posts: 151
Joined: Tue Sep 15, 2009 2:03 pm
Location: Chicago

Reg. Date

Post by wittyme »

I have the date format from the source like YYYYMM
and I want to change it to YYYY0MM

How to append a 0 in btw. for a column :?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What is your field's data type? If a string, then "In.Col[1,4]:'0':In.Col[5,2]" would do the trick.
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

Post by agpt »

if this is a date... use MonthFromDate and YearFromDate function to get values of yyyy and mm and use the function which arndw suggested.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not quite; MonthFromDate() returns a TinyInt which may only have one digit. That would need to be padded.

Code: Select all

YearFromDate(InLink.TheDate) : Right("000":MonthFromDate(InLink.TheDate),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