AS/400: Using %len and %trim

5 pts.
Trying to find examples on using %len and %trim functions in AS/400.

Software/Hardware used:
as400 rpgle

Answer Wiki

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

Check out the built in function info on IBM site here

Discuss This Question: 5  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.
  • TheRealRaven
    The documentation for %LEN() under IBM i 6.1 contains seven examples. For %TRIM() there are six examples. What examples do you need that aren't covered by the documentation?
    36,145 pointsBadges:
  • FabienDeladrome
    You can have this error message 'Built-in function %LEN not valid.' whatever the version 6.1 ... 
    Your comment is completely useless. Next time refrain yourself!
    10 pointsBadges:
  • ToddN2000
    If you want some simple examples

    Create a last name, comma, firstname field dropping blanks on the right side.


    This finds the length of the data in the work field dropping leading and trailing blanks.
    EVAL      DataLength = %len(%trim(WORKDATA)) 
    134,960 pointsBadges:
  • TheRealRaven
    @FabienDeladrome: Useless to you perhaps. Maybe you're unaware that the documentation exists.

    Posting examples here that essentially give the same info as the official documentation is useless. Without knowing what is missing from or confusing about the examples from IBM, there's no way to know how to answer. Answering is a waste of time in that case. The OP gains nothing and the responding member provides nothing new.

    Posting examples that show the same as the official documentation but simply with different variable names has no clear value. Posting more complex examples might do nothing but increase confusion.

    So, without knowing what the actual problem, it's all a waste of time for the OP, for the responding members and for future members who might search for this info.
    36,145 pointsBadges:
  • azohawk

    I will agree with TheRealRaven on this. The answer provided was correct.

    If the examples provided are not helpful in your particular situation, post the relevent code, the exact error messege (including the error ID), you OS release, and latest cumulative PTF level (if you can). This information helps provide a better specific answer.

    General questions will generate general answers. The more specific the question, the more specific answer you recieve.

    4,055 pointsBadges:

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.


Share this item with your network: