Skip to content

COBOL syntax and wrap strings #229

@RiaanPretoriusRIP

Description

@RiaanPretoriusRIP

COBOL allows long text variables to be split over two or more lines. Note, this is not related to how Notepad++ wrap lines.

Example

            DISPLAY MESSAGE BOX
              "The following process must be applied to Earnings, Deduct
      -       "ions and Company Contributions separately."

                 STRING "Earning Budget Figures for the Financial Year 
      -          "Starting " CNT-BUD-TAX-YEAR(1:4)
                 DELIMITED BY SIZE  INTO REPTITLE
				 
           MOVE "***************************   T I T L E    P A G E   **
      -         "*************************" TO PRTITLE.		

It uses a “-” sign in column 7 to indicate a continuation. Note that the first line does not end with a quote to indicate end of the string. COBOL will take all the text up and including column 72 and concatenate that with the rest from the following line. There is no rule on where the opening quote on the second line should be. Also this can extend to a third line or more, although that is not very common, example

LP61A            DISPLAY MESSAGE BOX 
lp61b            "S*** strives to continually develop and improve its pr
LP61B -          "oducts and services to deliver more value to our custo
LP61B -          "mers." 

In COBOL column 1 to 6 is line numbers or can be used to mark changes. It is ignored during compile time.
Notepad++ get confused from the continuation and will show all the following lines as part of the string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cobolCaused by the COBOL lexer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions