How to convert quote into double quote

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
skp
Premium Member
Premium Member
Posts: 135
Joined: Wed Dec 26, 2007 1:56 am
Location: India

How to convert quote into double quote

Post by skp »

Hi,

We have requirement that in one of the field we will get double quotes we need to convert each double quote into two double quotes.

Ex:
Input value: raj"esh"ran"ja

Output should be: raj""esh""ran""ja

Is there any possibility to convert single double quote into two double quotes for n number of occurances please.

Thanks,
skp.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Did you try using the EReplace function?

Also if you are writing to a text file, then you could use a Sequential File stage in a Server job or Server Shared Container within a Parallel job. It should do the double quote handling you described.
Choose a job you love, and you will never have to work a day in your life. - Confucius
skp
Premium Member
Premium Member
Posts: 135
Joined: Wed Dec 26, 2007 1:56 am
Location: India

Post by skp »

Hi qt_ky,

Thanks for your quick responce. I am not able to see option Ereplace in transformer and also how sequential file can convert single double quote into two double quotes please explain me.

Thanks,
skp
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

EReplace was added to the Parallel world in the 9.1 release, I do believe. So you could use a Server job (is it doing anything that requires PX?) or perhaps use a BASIC Transformer. Or you could find the C++ version called pxEReplace that users put together and posted here, give that one a shot although from what I recall reading it may have some... issues.
-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 »

Or you could use a loop in a Transformer stage, WHILE Index(InLink.TheField, '"', 1) > 0
Within the loop replace the double quote using substring techniques.
Perhaps make use of the LastRecordInGroup() function to constrain the output.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ssnegi
Participant
Posts: 138
Joined: Thu Nov 15, 2007 4:17 am
Location: Sydney, Australia

Post by ssnegi »

Refer to my solution :

viewtopic.php?t=152746
yugee
Participant
Posts: 34
Joined: Fri Feb 04, 2011 5:54 pm

Post by yugee »

you can try my solution explained in the post -
viewtopic.php?t=152903
Post Reply