ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Error with String Concatenation

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

  • Error with String Concatenation

    Hello all. I'm having a problem concatenating a string and I have no idea why. Everything looks fine to me. I have a procedure that is creating a few strings for use in some CL commands. Here is the code:

    Code:
    P SetCmdStrings   B
          *
         D SetCmdStrings   PI
         D  File                         10A
    
          /free
    
           CpyFCmdString = 'CPYF FROMFILE(' + %trim(LIBNAME) + '/' + %trim(File) + ') ' +
                           'TOFILE(' + %trim(LIBNAME) + '/' + %trim(File) + 'B)';
    
           DltFCmdString = 'DLTF FILE(' + %trim(LIBNAME) + '/' + %trim(File) + 'B)';
    
    
          /end-free
    
         P                 E
    For some reason I am getting the following errors:

    024300 CpyFCmdString = 'CPYF FROMFILE(' + %trim(LIBNAME) + '/' + %trim(File) + ') ' +
    ======> a
    *RNF0267 20 a 024300 Character literal has missing trailing apostrophe; trailing
    apostrophe assumed.
    *RNF5501 20 024300 The comment entry on a free-form calculation is not valid.
    024400 'TOFILE(' + %trim(LIBNAME) + '/' + %trim(File) + 'B)';
    ======> aaaaaaaaa
    *RNF5377 20 a 024400 The end of the expression is expected.



    As far as I can tell, everything looks ok. I can't think of what else to add to these lines to get it to compile. Can anyone help?

  • #2
    Re: Error with String Concatenation

    Well I just answered my own question. I didn't know that you can't have code past column 80 in free format. I fixed the code so that it doesn't go past column 80 and it compiled without a problem. I was using CODE/400 to write this program and noticed that the column numbering only goes up to column 80, and the code was extended beyond that. Is there a way to make the compiler recognize code past column 80, or is this a limitation we have to live with?

    Comment


    • #3
      Re: Error with String Concatenation

      I think you have to live with it. Cols 81+ are comments. If using lpex editor, you would have got an error right away, while entering the text. I thought CODE did that too, but I haven't used it for over 3 years.

      Comment

      Working...
      X