Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String reading 1

Status
Not open for further replies.

julen

Programmer
Mar 26, 2006
27
ES
Hi!

I have a problem.

I have some strange characters in a string and I want
to replace them. My version of O/S is the 5.2 and I don't
have the sentence 'replace', so i have to do it reading each character and comparing them. If they are the same, changing them with a blank.


How can I do?

Thanks
 
Hi Julen,

Do you know what the characters you need to replace are, or are they random characters?

How long is the string that you are retrieving from the DB2 table?

Marc
 
Try the translate function. For example, if you wanted to replace end of line characters with spaces, you could use the following:
TRANSLATE ( SOURCE , ' ' , X'0D25' )
X'0D25' is AS400's code for end of line character. If you wanted to do something simpler like replacing a ^ with a space, it would be:
TRANSLATE ( SOURCE , ' ' , '^' )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top