sponsored links

Collapse

Announcement

Collapse
No announcement yet.

CAT command in RPG

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 Files

  • #2
    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

    Comment


    • #3
      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 

      Comment

      sponsored links

      Collapse

      Working...
      X