Results 1 to 3 of 3

Thread: CAT command in RPG

  1. #1
    Experienced Forum Member
    Join Date
    Jul 2006
    Location
    Malaysia
    Posts
    88
    Rep Power
    693

    CAT command in RPG

    I wish to concatenate a few strings into a string using RPG/400.
    Some of the strings have ended with blanks. Can anyone suggest me a way as i fail to do it with CAT.

    The strings line are:
    'FB'
    '/'
    'ASPAC '
    '/'
    'ADHI '
    '/'
    '2008'
    '/'
    '0001'

    I hope to join it becomes FB/ASPAC/ADHI/2008/0001 without any empty space in between.

    Thank you.
    Attached Images Attached Images  

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

  3. #2
    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: CAT command in RPG

    I guess I can pick the low hanging fruit.

    Code:
    variable1 *char 5
    variable1 = 'ADHI '
     mystring = 'FB' + '/' + 'ASPAC ' + '/' + %trim(variable1) +  '/' + '2008' + '/' + '0001'
    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

  4. #3
    Analyst
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    1,588
    Rep Power
    9577

    Re: CAT command in RPG

    Hi,

    if you are still stucking with RPGIII, try to add :0 to factor2.

    PHP Code:
    C           MYVAR1    CAT  MYVAR2:0  MYVAR3    
    C           MYVAR3    CAT  MYVAR4
    :0  MYVAR5 
    An other way would be to use embedded SQL in your RPGIII program:

    PHP Code:
    C/EXEC SQL
    C
    SET  MYRES TRIM(MYVAR1CONCAT TRIM(MYVAR2CONCAT
    C
    +              TRIM(MYVAR4)
    C/END-EXEC 

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

Facebook Comments


Similar Threads

  1. Googlefree
    By Marc_d in forum Other useful websites
    Replies: 6
    Last Post: August 22nd, 2008, 07:56 AM
  2. The best training for a new RPG programmer
    By WLE in forum RPG/RPGLE
    Replies: 4
    Last Post: August 20th, 2008, 07:14 AM
  3. Replies: 7
    Last Post: August 1st, 2008, 08:42 AM
  4. Problem to change RPG to SQLRPG
    By IroCorp in forum SQL
    Replies: 12
    Last Post: July 30th, 2008, 09:07 AM
  5. Please i need RPG program for make test
    By jma in forum RPG/RPGLE
    Replies: 6
    Last Post: June 20th, 2008, 10:18 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
  •