Results 1 to 6 of 6

Thread: Trim a variable in CL

  1. #1
    Analyst ruma's Avatar
    Join Date
    Jun 2005
    Location
    Posts
    78
    Rep Power
    769

    Trim a variable in CL

    Hi,

    Could anyone tell me how do you trim the trailing blanks from a CL variable? Any BIF??

    TIA

  2. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

  3. #2
    Analyst giri's Avatar
    Join Date
    May 2005
    Location
    Salt lake City, US
    Age
    33
    Posts
    247
    Rep Power
    1662

    Re: Trim a variable in CL

    Use *TCAT


    which joins two strings with the first string trimmed (without trailing blanks ), TCAT results in a string that has no embedded blanks no matter how many trailing blanks were found in the string
    Thanks,
    Giri

  4. #3
    Analyst ruma's Avatar
    Join Date
    Jun 2005
    Location
    Posts
    78
    Rep Power
    769

    Re: Trim a variable in CL

    Thanks Giri, but my problem is that i dont want to concatenate 2 strings, just remove the trailing blanks of a variable and send it as a parameter to some other program.

  5. #4
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12605

    Re: Trim a variable in CL

    Is this question hinting at another problem. Does this variable contain "garbage" when it reaches the called program....and is this parm Xtra long like 25 + Characters?
    If so then make this parameter the last in the plist.

    otherwise there is no need to trim the trailing blanks of a character field just clear it first
    and move your data into it.


    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  6. #5
    Analyst ruma's Avatar
    Join Date
    Jun 2005
    Location
    Posts
    78
    Rep Power
    769

    Re: Trim a variable in CL

    Hi Jamie,

    i am calling a standard program which already exists in the application so i cant change the sequence of the parameters. Also, it is only 10 char long.

    any ideas on how to fix the problem in the CL which i am making?

    Regards,
    Ruma

  7. #6
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12605

    Re: Trim a variable in CL

    Then we are back to giri post. if you are moving a constant into this field then use this:

    x = *blank

    chgvar &chr10 'ABCxxxxxxx'

    or

    chgvar &Chr10 'xxxxxxxxxx'
    CHGVAR VAR(%SST(&Chr10 1 3 )) VALUE('ABC')

    If possible lets post some of the code and let us know what is your true problem.

    Thank you
    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  8. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Age
    21
    Posts
    1,000,000
     

Facebook Comments


Similar Threads

  1. VBScript II using variable from SQL within ASP
    By jamief in forum PC programming as it relates to Iseries
    Replies: 1
    Last Post: December 8th, 2006, 05:23 PM
  2. Dynamically allocate the length of a variable
    By ris_skma in forum RPG/RPGLE
    Replies: 2
    Last Post: October 13th, 2006, 07:17 AM
  3. Variable values to Variable
    By persistance in forum RPG/RPGLE
    Replies: 2
    Last Post: February 28th, 2006, 01:05 AM
  4. Null Values and SQL Fetch
    By pjk in forum SQL
    Replies: 1
    Last Post: February 22nd, 2005, 11:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •