Change the string to specific date format in User variable

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
bgudapati
Premium Member
Premium Member
Posts: 3
Joined: Sat Sep 10, 2011 1:41 pm

Change the string to specific date format in User variable

Post by bgudapati »

We need to change the string to specific date format in User Variable Activity.

One option would using OCONV function
Input string coming in as 20120731
Expected Output : 31-AUG-2012

Can you please let me know what format do I need use in the function
Oconv(Inputvalue, format)

What are other options available to convert string to date in User variable activity

Thanks
bgudap
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There are actually 2 step involved, first you need to parse the string value into the internal date format, then output that internal date as a string

Code: Select all

OCONV(INCONV(UserVariable[1,4]:'-':UserVariable[5,2]:'-':UserVariable[7,2],'D4-YMD'),'D4-DMY[2,A3,4]')
I'm not at a PC where I can check the syntax, but it should be close enough and the descript can be found at http://publib.boulder.ibm.com/infocente ... ction.html
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Are you looking for the end of the next month or the corresponding day (date) in the next month?

I don't believe Arnd's parsing is necessary; Iconv("20120731","D4YMD") should work correctly. After that, something like the MONTH.LAST Transform might be what you are looking for.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

OConv in parallel jobs ?
- Zulfi
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

zulfi123786 wrote:OConv in parallel jobs ?
No. In a UserVariables-Activity (Sequence).
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
Post Reply