COBOL syntax highlighting stops working
I’m writing a COBOL app. The syntax highlighting works for about the first half of the program and then stops - highlighting just disappears after the first few lines of the PROCEDURE DIVISION.
I have cobol.xml and userDefinedLang.xml in my Notepad++\plugins\APIs folder.
Has anyone got a solution?
could you please download the date.zip cobol sample from >>> here <<<, extract it anywhere, and open
DATEP.COBin notepad++ (appx. 40kb).
scroll down to the end and compare if it looks like this screenshot:
if DATEP.COB does not look the same, we would need your debug info.
please go to
? > debug info... > copy debug info into clipboardand paste your contents here, as we still do not have your debug info yet, and it has been requested before.
if DATEP.COB looks the same, and you have a specific files that show this issue, we would need a sample .cob, to try to reproduce this, in addition to your debug info.
ps: could you please reply to one of your previous posts:
many of us have an elephant’s memory, and might otherwise refuse to answer future questions you might have ;-)
The DATEP.COB program certainly shows the highlighting as in the example, although the colours are different because I am using a different colour scheme. Sorry for not sending debug info before. I misread the post.
Notepad++ v7.5.9 (32-bit)
Build time : Oct 14 2018 - 15:02:52
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : ON
Local Conf mode : OFF
OS : Windows 7 (64-bit)
Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll AnalysePlugin.dll AutoSave.dll CodeAlignmentNpp.dll NppCCompletionPlugin.dll NppEditorConfig.dll NppEventExec.dll NppExec.dll NppFavorites.dll NppFTP.dll NppHorizontalRuler.dll PluginManager.dll SourceCookifier.dll
The program I am having difficulty with is shown below. The line where highlighting ceases is indicated by <<<<< Highlighting ceases
*> *************************************************************** $SET SOURCEFORMAT”FIXED” identification division. program-id. DCFApp. *> environment division. *> configuration section. special-names. cursor is curs-pos. repository. function all intrinsic. input-output section. file-control. *> select *> assign to *> organization is *> . data division. file section. *>fd . *> 01 . working-storage section. copy "screenio". 01 curs-pos. 03 curs-line pic 99. 03 curs-col pic 99. 01 input-numbers. 03 input-year pic 99. 03 input-outlay pic x(9). 03 input-benefits pic x(9). 03 input-opcosts pic x(9). 03 output-cashflow pic +++,++9.99. 01 calc-table. 03 inv-entries occurs 11 times. 05 inv-year pic 99. 05 inv-outlay pic 9(6)v99. 05 inv-benefits pic 9(6)v99. 05 inv-opcosts pic 9(6)v99. 05 inv-cashflow pic s9(6)v99. 05 inv-presvalue pic s9(6)v99. 01 discount-rate pic 9(3)v99. 01 year-sub pic 99. 01 posneg-flag pic x. 88 positiv value "p". 88 negativ value "n". 01 calc-results. 03 inv-netpresvalue pic s9(6)v99. 03 inv-IRR pic s99v99. *> local-storage section. *> linkage section. screen section. *> copy "dcfscrn.ss". procedure division. *> set in order to detect the PgUp, PgDn, PrtSc, Esc keys set environment 'COB_SCREEN_EXCEPTIONS' TO 'Y'. set environment 'COB_SCREEN_ESC' TO 'Y'. display "DCF Model - 10 Year Project" at 0119 background-color white foreground-color blue display "Year Outlay Benefits Operating Cashflow -" Present" at 0302 <<<<< Highlighting ceases display "Costs Value " at 0434 move 1 to year-sub input-year display " [ ] [ ] [ ] [ ]" at 0601 *> perform loop perform main-loop 10 times accept omitted stop run. *> sub-routines. main-loop. *> move 06 to curs-line display input-year at 0603 accept input-outlay at 0608 accept input-benefits at 0620 accept input-opcosts at 0633 move numval(input-year) to inv-year(year-sub) move numval(input-outlay) to inv-outlay(year-sub) move numval(input-benefits) to inv-benefits(year-sub) move numval(input-opcosts) to inv-opcosts(year-sub) perform calc-cashflow *>end-perform move inv-cashflow(year-sub) to output-cashflow evaluate true when inv-cashflow(year-sub) is positive set positiv to true display output-cashflow at 0645 foreground-color green when inv-cashflow(year-sub) is negative set negativ to true display output-cashflow at 0645 foreground-color red end-evaluate perform display-year-input *>end-perform add 1 to input-year. calc-cashflow. compute inv-cashflow(year-sub) = inv-benefits(year-sub)-((inv-outlay(year-sub) + inv-opcosts(year-sub))). display-year-input. display input-year at 0803 display input-outlay at 0808 display input-benefits at 0820 display input-opcosts at 0833 if positiv display output-cashflow at 0845 foreground-color green else if negativ display output-cashflow at 0845 foreground-color red. end-program. DCFApp.
this is because you have an odd number of three
"double quotes in line 69/70.
all strings have to have open and close quote or double quote pairs.
if you instert the missing quote like this, the highlighting will work:
display "Year Outlay Benefits Operating Cashflow -" Present"" at 0302 <<<<< Highlighting ceases
but i doubt that the cobol error correction will be able to run this code properly, as
Presentis no longer part of the string.
does it even run for you as it is ? with 3 double quotes and one closing double quote missing ?
note: if you want to use
"as part of a string, you will e.g. have to use
'single quotes as delimiters for the whole string.
display 'Year Outlay Benefits Operating Cashflow -" Present"' at 0302 <<<<< Highlighting ceases
The above leads to compilation errors. I have split the Display into two separate statements and have an acceptable result i.e. syntax highlighting is back.
I realised that I did not have the most recent version of Notepad++ (7.63). Installing this now means F6 correctly brings up the NppExec dialog.
Thanks for your help.