DB2/iSeries clean up

344900 pts.
Tags:
AS/400
DB2
I'm trying to find and clean up line breaks, carriage returns, tabs and "SUB"-characters in a set of 400k string records but I'm having a ton of trouble with my DB2 environment.

After doing some searching, and I thought replacing with the "REPLACE()" and "CHR()" functions could work, but it's not available on our system. Here's what I'm working with:
DBMS = DB2
System = iSeries
Language = SQL
Encoding = Not sure, possibly EBCDIC
Any hints on what I could do?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    What is your OS release? Later releases have more potentially useful functions. The CHR() function isn't part of standard SQL, so it shouldn't be expected to exist. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    I see that CHR() has been added to DB2 iSeries in i 6.1. It might be tricky to use, though, since it performs its function with ASCII rather than EBCDIC encoding. -- Tom
    125,585 pointsBadges:
    report
  • philpl1jb

    Something like this?

    Update myfile

    Set myfield

          = case when substring( myfield,1,1) < ' ' then ' 'else substring(myfield,1,1) end

           + case when substring( myfield,2,1) < ' ' then ' 'else substring(myfield,2,1) end

            + case when substring( myfield,3,1) < ' ' then ' 'else substring(myfield,3,1) end  

    49,730 pointsBadges:
    report
  • TomLiotta
    It's hard to say because REPLACE() has been around since V5R3. If DB2 is older than that, the substringing will be needed. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following