Can we use TRIM in WRKQRY?

TRIM function
Work with Query
I am formatting up one field in Define Result Fields:
Here can I use TRIM function with x9jbus filed to avoid blanks If anybody knows, please let me know.

Answer Wiki

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

Yes, you use the VARCHAR function when defining your field

<pre>VARCHAR(x9jbno)||’/’||VARCHAR(x9jbus)||’/’||VARCHAR(x9jbnm) </pre>

Discuss This Question: 6  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.
  • Gilly400
    Hi, If you use VARCHAR you still get the blanks from your original field in your result field. If you try using LENGTH and then substring for the length of the command you also get the blanks. I don't think this is possible in normal Query/400 - maybe with QM Query? (afraid that's something I don't know too much about). Regards, Martin Gilbert.
    23,730 pointsBadges:
  • Pankaj2rmca
    Yes I agree with Martin as I have tried in my Query. One sample example I am giving you: When I am giving JOBNM varchar(x9jbno)||'/'||varchar(x9j bus)||'/'||varchar(x9jbnm) then result is coming as 043800 /Profile /LBULL10HUB that is blank after 1st and 2nd field that is not required. I have thousands of similar data Thanks and regards Pankaj MAHAJAN
    15 pointsBadges:
  • tarunraghu
    Hi, I need to avoid the blanks from field without substring. Is it possible? Example field length is 30 and data is first 2 characters or some times 3 characters and some times 4 characters. in this case how to avoid the blanks. Can anybody suggest I need it in QRY400 Only?
    10 pointsBadges:
  • GregManzo
    (a) this should be a new question.
    (b) you will need either trim() or substring(). If your data is ALWAYS just the first few characters followed by blanks then you can trim(Data) for what you want. If however you have other non-blank characters then then you will need to substring out the part you want.

    2,905 pointsBadges:
  • GregManzo
    Try something like:
    substring(Field, 1, scan(Field,' ')-1)
    that should get you everything up to (but not including) the first blank.
    2,905 pointsBadges:
  • ToddN2000
    I know this is an old question but I don't think you can do it with WRKRY as the question asks. You may be able to do it using WRKQMQRY. I no longer have access to that command to verify it though.
    127,470 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: