2

How can I get COBOL comments to use proper syntax highlighting in Notepad++ when line numbers are filled in columns 1-6?

I am a developer who is using Notepad++ to code in COBOL. I use the built-in COBOL syntax highlighting, which works under most conditions, but has a particular issue.

COBOL comments are indicated by an asterisk as the 7th character in a line - ordinarily, this works correctly. However, if the 6th character in the line immediately preceding the asterisk is also filled in, the line will incorrectly fail to register as a comment.

Example:

      * THIS SHOWS AS A COMMENT
SH0819* THIS DOES NOT SHOW AS A COMMENT
     9* NEITHER DOES THIS

In COBOL, lines 1-6 are used for "line numbers", or alternatively, initials and dates as a form of primitive manual version control. It is common to have these characters filled in, and they should not interfere with the syntax in any way. Is there a way to prevent the 6th character from impacting the syntax highlighting of the 7th character?

1
  • First case: begin coding in col 1 and will be treated like col 7 (Notepad++ works good) Case #1

  • Second case: begin coding in col 8, and will be treated like standard editor COBOL. Case #2

  • When col 6 is coding, then Notepad++ assumes line as case 1. *(Remarks don't work in this case).

| improve this answer | |
  • I use SPFLite. This editor works as ISPF on Mainframe. – Eduardo A. Palmeyro Jul 29 at 0:40
  • Unfortunately, I am working almost exclusively with old, pre-existing code as opposed to writing new code, so I don't think this is a practical solution for me. – Southpaw Hare Jul 29 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.