MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Multiple STRIP or TRIM function call

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
agredell
Beginner


Joined: 04 May 2006
Posts: 27
Topics: 6

PostPosted: Thu Jun 08, 2006 9:26 am    Post subject: Multiple STRIP or TRIM function call Reply with quote

I have data where the users put double quotes around a character field. I am selecting the data fields to their full lengths, and want to strip data like this:

User entered a 40 byte char field as:

"COOK, MIDDLE"

and padded (not varchar) out to 40 bytes. Since the full field is 40 bytes, and terminated by spaces, the function STRIP(FIELDNAME,B,'"') is NOT stripping the latter double-quote. I tried embedding the above strip inside of another strip, as in CHAR(STRIP(STRIP(FIELDNAME,B,'"'),L),40), but the results are the same. Is there a way to strip both the trailing spaces and the ending double quotes, so that the field winds up looking like this:

COOK, MIDDLE

Thanks!
_________________
Alan Gredell
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Jun 08, 2006 9:43 am    Post subject: Reply with quote

agredell,


Try this

Code:

STRIP(REPLACE(fieldname,'"',' '),B,' ')


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
agredell
Beginner


Joined: 04 May 2006
Posts: 27
Topics: 6

PostPosted: Thu Jun 08, 2006 9:54 am    Post subject: Reply with quote

Many thanks, Kolusu, that worked perfectly!
_________________
Alan Gredell
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group