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
sujaoschin
Premium Member
Premium Member
Posts: 102
Joined: Tue Jan 31, 2006 4:13 am

Date conversion

Post by sujaoschin »

My input column 'AC_COMPLETED' is in the date format of '20060801'. How to convert this string into the date format of '01/08/2008'
Sujatha K
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

Search the forum for OCONV or look into help for OCONV
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Going that route, you'd need both IConv and OConv. First convert the data to internal format and then back to external format using the desired mask.

If your date is consistent, meaning always 8 digits, you can also go the substring route:

Code: Select all

Link.AC_COMPLETED[7,2] : '/' : Link.AC_COMPLETED[5,2] : '/' : Link.AC_COMPLETED[1,4]
-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 »

Did you mean '01/08/2006'? If not, what is your business rule for date arithmetic?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sujaoschin
Premium Member
Premium Member
Posts: 102
Joined: Tue Jan 31, 2006 4:13 am

Post by sujaoschin »

Ray,

Incoming date is in the format of 20081001 and business wants to see in the format of '01/10/2008'.

Chulett,

I did as per your suggestion as the incoming date is always having 8 digits. It is working fine. Thank you so much.

DEFAULT.AC_COMPLETED[7,2]:'/':DEFAULT.AC_COMPLETED[5,2]:'/':DEFAULT.AC_COMPLETED[1,4]
Sujatha K
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Date conversion

Post by ray.wurlod »

sujaoschin wrote:My input column 'AC_COMPLETED' is in the date format of '20060801'.
This was the cause of my question, of course.
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