[go: up one dir, main page]

Menu

#1127 USAGE BINARY-LONG UNSIGNED VALUE 0. COMPILE ERROR

GC 3.x
not-our-bug
nobody
None
5 - default
2025-06-29
2025-06-29
No

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 :-)

2 Attachments

Related

Bugs: #1127

Discussion

  • Vincent (Bryan) Coen

    • status: open --> not-our-bug
     
  • Vincent (Bryan) Coen

    N OT a bug -- your lines exceed cc 72.

     
  • Michael F Gleason

    OOPS. I did not notice that. I messed up doing the comments header. Made them too long.
    Sorry for my report.
    Michael :-(

     
    • Simon Sobisch

      Simon Sobisch - 2025-06-29

      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?

       
      • Vincent (Bryan) Coen

        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:

        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?


        [bugs:#1127] https://sourceforge.net/p/gnucobol/bugs/1127/ USAGE
        BINARY-LONG UNSIGNED VALUE 0. COMPILE ERROR

        Status: not-our-bug
        Group: GC 3.x
        Created: Sun Jun 29, 2025 03:17 AM UTC by Michael F Gleason
        Last Updated: Sun Jun 29, 2025 07:01 PM UTC
        Owner: nobody
        Attachments:

        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.

        |00090001CL-COUNTERS-AND-INDEXES.
        00100005CL-IDX1USAGEBINARY-LONGUNSIGNEDVALUE0.
        00110005CL-IDX2USAGEBINARY-LONGUNSIGNEDVALUE0.
        00120005CL-ARGUMENT-LENGTHPIC9(03)COMP-3.
        00130005CL-NUM-CMD-LIN-ARGSPIC9(09). 001400
        00150001CL-ARGUMENTPICX(108)VALUESPACE. 001600
        00170001CL-ARGUMENT-IN-FILESOCCURS10TIMES.
        00180005CL-INPUT-LENPIC9(03)COMP-3. 00190005CL-INPUT-FILESPICX(100).
        002000 00210001CL-ARGUMENT-OUT-FILESOCCURS10TIMES.
        00220005CL-OUTPUT-LENPIC9(03)COMP-3. 00230005CL-OUTPUT-FILESPICX(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 :-)


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/gnucobol/bugs/1127/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

         

        Related

        Bugs: #1127


Log in to post a comment.