AS/400 query: Extract character between two characters

Tags:
AS/400
AS/400 Query
Is there a way to extract the number of character between 2 chars? I need to extract email addresses that are between <....@...> in a field that is 228 bytes long.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Something like this would find you the first starting position after your search variable.

Eval      Pos  = %SCAN('@':EMAILADDR) + 1

Discuss This Question: 2  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.
  • pdraebel
    Assuming that the @ character indicates an E-mail address, first check for the position of the @char, next look for the first 'b' (blank character) preceding the @ char, next look for the position of the first blank after the @. Extract text data from pos_bef + 1 to pos_after -1.
    7,545 pointsBadges:
    report
  • ToddN2000
    If you know the character you can use the built in functions like SCAN to do this easily. Try it and post your code if you are having problems and we can sort it out for you.
    129,715 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.

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

Following

Share this item with your network: