Menu

Continuation in column 7 using dash "-" - error: invalid line continuation

2020-06-30
2020-07-06
  • Dave Davidson

    Dave Davidson - 2020-06-30

    Hi,

    More trouble from my older source code. Is there a compiler directive to handle this? I can edit this one but there are 10s more created in parts of the code that is used for screen layouts.

    251294-    ", (M)ale, or (F)emale :M:".
    
    
    error: invalid line continuation
    
     
    • Vincent (Bryan) Coen

      On 30/06/2020 21:00, Dave Davidson wrote:

      Hi,

      More trouble from my older source code. Is there a compiler directive
      to handle this? I can edit this one but there are 10s more created in
      parts of the code that is used for screen layouts.

      251294- ", (M)ale, or (F)emale :M:".

      error: invalid line continuation
      IF you have hyphens in cc7 I have to 'ASSUME' that it is a Fixed format
      program so just compile with the default settings should do the jon if
      you like to be sure just use
      cobc -x -fixed program.cbl

      If it is  free format then this line looks like an error so convert it
      to free format.

      etc.

      Vince

       
  • Simon Sobisch

    Simon Sobisch - 2020-06-30

    No, continuation lines are a standard COBOL feature. They tell the compiler to either continue literals of the previous code line (which then has a starting but not ending quote) or COBOL-words.

    But this can all be misleading - continuation lines really need some context - a single line is nothing anyone can "debug", just guess...

     
  • Dave Davidson

    Dave Davidson - 2020-06-30

    I jumped to the conclusion that it was a legacy compatibility issue causing it to not accept the continuation. The issue is not as simple as that as contunuations elsewhere work as I expect. Sorry for that lack of clarity, I'm out of practice.

    I can work around by editing the line to a single line. However a lot of this is generated by another COBOL program so to fix it nicely I need to look at how the generator would choose not to need a continuation, which seems like a problem too far if I can avoid it.

    Here's a better example from the list output . The continuation line full stop should complete the declaration statement. The generator got to column 80 and started a continuation to add the full stop. It is lonely (but usually functional) on the following line.

    000054             03  SD-0701 PIC X(030) VALUE " ABCDEFGHIJ             KLMN :"
    error: syntax error, unexpected end of file, expecting EXTERNAL or
         + EXTERNAL-FORM or GLOBAL or IDENTIFIED
    000055        -    .
    error: invalid line continuation
    

    I'm using -fixed as columns 1-6 are used for comments. column 1 often used to comment the whole line, column 7 is mostly continuation.

    Thanks for your help.

     

    Last edit: Dave Davidson 2020-06-30
    • Anonymous

      Anonymous - 2020-06-30

      So is the code inbounds ? Columns 7 thru 72 inclusively.
      You mentioned Column 80.
      73 - 80 are not inbounds.

       
  • Anonymous

    Anonymous - 2020-07-01

    Re inbounds. My description didn't state that the generator program outputs 80 column lines to the generated copy file but it writes spaces into the information area (73-80).

    This code compiled with MF COBOL last time I wanted to compile.
    The code snippet in my 2nd example can be made to work if I replace x(030) with x(30) and use the saved column to put the full stop on the line avoiding the need for the continuation.

    I am very out of date, the standards for continuation may make this construction invalid now. It may even have been invalid and just compiler tolerated back then.

     
    • Anonymous

      Anonymous - 2020-07-01

      Are all of the syntax errors related to the continuation only being a . (dot / period) ?
      Hard to tell without more example code.
      MF would not care that the declaration is not terminated with a period - as long as the next statement can be "lexed", for instance a level number.

      I'll recreate your example and run it thru MF, IBM, and Fujitsu.
      See what happens :-)

       
  • Dave Davidson

    Dave Davidson - 2020-07-05

    Thanks to everyone that's contributed to this project the compiler is a great piece of work.

    I managed to get my program running. The program itself is mostly 40 years old.

    The issues with continuation errors weren't continuation specifically - mostly it was all sorts of things that the old compilers had allowed past a syntax check but were being picked up now. If code that were generated had issues in the templating. I was surprised how many errors there were in the old code. Missing fullstop, missing quotes, and fullstop as the only character on the continued line.

     

    Last edit: Dave Davidson 2020-07-05
    • Simon Sobisch

      Simon Sobisch - 2020-07-06

      Good to know. Thank you for the update - and the fixed program would very likely to also compile on the old environment when you've fixed these issues.

       

Anonymous
Anonymous

Add attachments
Cancel