Menu

#1231 ACCEPT at wrong position

GC 3.x
accepted
nobody
4
2026-05-12
2026-05-11
No

The following program should execute an ACCEPT at position 0201: accept wTEST at 0201 ...
The program instead executes an ACCEPT at position 2210 !?!?
This is the position of the statement
not on exception display 'not exception' at 2210 end-display

See attached screenshot.
I think it's a bug.
I'm using SuperBOL's AIO compiler.

        >>SOURCE FREE
ID DIVISION.
PROGRAM-ID. TESTACCEPTSIMPLE.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 wTEST PIC X(5) value space .
01 wLine pic 99   value zero.
01 wCol  pic 99   value 01.
PROCEDURE DIVISION.
main01.
    display '....+....1....+....2....+....3....+....4....+....5' at 0101
    display '....+....1....+....2....+....3....+....4....+....5' at 0501
    display '....+....1....+....2....+....3....+....4....+....5' at 1101
    display '....+....1....+....2....+....3....+....4....+....5' at 1501    
    perform 24 times
        add 1 to wLine
        display wLine at line wLine col wCol
    end-perform

    accept wTEST at 0201 with prompt '_' auto  
            on exception display 'exception'     at 2010 end-display
        not on exception display 'not exception' at 2210 end-display
    end-accept 
    display 'end-accept' at 2501 
    accept omitted
    STOP RUN.
1 Attachments

Discussion

  • Simon Sobisch

    Simon Sobisch - 2026-05-11
    • labels: --> ACCEPT, parser
    • status: open --> accepted
    • Group: GC 3.2 --> GC 3.x
    • Priority: 5 - default --> 4
     
  • Simon Sobisch

    Simon Sobisch - 2026-05-11

    I can at least say that the MF result is different - accepting at 0201 as excepted.
    ... and I can tell that 3.3-dev still has the same behavior.

    Note that this seems to be a parser issue as the codegen results in cob_accept_field (&f_17, 524304, "pP\000", (cob_field *)&c_6, (cob_field *)&c_7); with the position being static const cob_field c_6 = {4, (cob_u8_ptr)"2210", &a_2};.

    It is most likely related to not using an internal positional argument but the static var line_column in the parser, which is overwritten within the exception phrases.

     
    • Eugenio Di Lorenzo

      There's another problem to report.
      When the program stops on ACCEPT OMITTED, if you press ENTER, the program continues normally, i.e., terminates.
      If you press any other key (a letter, TAB, ESC, etc.), the program stops and doesn't proceed any further. It doesn't perform a normal end of program.

       

Log in to post a comment.

MongoDB Logo MongoDB