I have a copy book that I have used for a few years. I changed two items that were defined as COMP-3 VALUE 0 to USAGE BINARY-LONG UNSIGNED VALUE 0.
See CL-IDX1 & CL-IDX2.
000900 01 CL-COUNTERS-AND-INDEXES.
001000 05 CL-IDX1 USAGE BINARY-LONG UNSIGNED VALUE 0.
001100 05 CL-IDX2 USAGE BINARY-LONG UNSIGNED VALUE 0.
001200 05 CL-ARGUMENT-LENGTH PIC 9(03) COMP-3.
001300 05 CL-NUM-CMD-LIN-ARGS PIC 9(09).
001400
001500 01 CL-ARGUMENT PIC X(108) VALUE SPACE.
001600
001700 01 CL-ARGUMENT-IN-FILES OCCURS 10 TIMES.
001800 05 CL-INPUT-LEN PIC 9(03) COMP-3.
001900 05 CL-INPUT-FILES PIC X(100).
002000
002100 01 CL-ARGUMENT-OUT-FILES OCCURS 10 TIMES.
002200 05 CL-OUTPUT-LEN PIC 9(03) COMP-3.
002300 05 CL-OUTPUT-FILES PIC X(100).
I get the following
GET-COMMAND-LINE-FILES-WS.CPY:11: error: syntax error, unexpected Identifier
9 | 000900 01 CL-COUNTERS-AND-INDEXES.
10 | 001000 05 CL-IDX1 USAGE BINARY-LONG UNSIGNED VALUE 0..
11 > 001100 05 CL-IDX2 USAGE BINARY-LONG UNSIGNED VALUE 0..
12 | 001200 05 CL-ARGUMENT-LENGTH PIC 9(03) COMP-3.
13 | 001300 05 CL-NUM-CMD-LIN-ARGS PIC 9(09).
GET-COMMAND-LINE-FILES.CPY: in paragraph '850-GET-COMMAND-LINE-FILES':
GET-COMMAND-LINE-FILES.CPY:45: error: 'CL-IDX2' is not defined 43 | 004300 44 | 004400 MOVE ZERO TO CL-IDX1 45 > 004500 MOVE ZERO TO CL-IDX2 46 | 004600 PERFORM CL-NUM-CMD-LIN-ARGS TIMES 47 | 004700 ADD 1 TO CL-IDX1
If I remove the VALUE 0, the compile is happy.
One thing I noticed is there are two periods following the VALUE 0 in the error message.
I'm running Windows 11 and compiling with Chuck H's cobc
GnuCOBOL 3.3.0 (Jun 16 2025 13:11:34), (MinGW) "15.1.0"
GMP 6.3.0, libxml2 2.12.10, JSON-c 0.18.0, PDCursesMod 4.5.1, BDB 18.1.40
The attached are the copy books that pertain to this problem.
Michael :-)
N OT a bug -- your lines exceed cc 72.
OOPS. I did not notice that. I messed up doing the comments header. Made them too long.
Sorry for my report.
Michael :-(
No problem, we all mess up a bit from time to time.
Now: you may want to enable column indicators (or color highlighting depending on columns) in your editor.
That's at least possible with vscode, vim, emacs, notepad++,...
... and if something looks strange, compile once with -Wextra, which in this case should raised a clean warning on the column overflow. If you don't put markers/comments there you can raise that to an error for your normal build -Werror=column-overflow (or similar).
That works, doesn't it?
OR - if you really insist on using a fixed length format type change it
to VARIABLE which extended beyond cc72 to cc250.
OR again change all code to use free format and delete cc 1 - 6 and
change any " " in cc7 to ">"
On 29/06/2025 22:08, Simon Sobisch wrote:
Related
Bugs:
#1127