gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] Has this PERFORM problem been reported already?


From: Jonathan Beit-Aharon
Subject: [open-cobol-list] Has this PERFORM problem been reported already?
Date: Fri, 7 May 2010 13:53:40 -0400

Hi,
I hope this is the correct forum for reporting a problem -- kindly direct me if it isn't.

It is fairly common for empty PERFORM loops to be written in order to set an index into an array or a string.
The following example program fails because Open COBOL fails to translate empty PERFORM statements, and recovers from them very poorly (dropping all prior Procedure Division statements).

Test program:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. PERFTEST.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 A PIC S9(2) VALUE 2.
       PROCEDURE DIVISION.
       MAIN SECTION.
           GO TO PASS.
           PERFORM VARYING A FROM 3 BY 1 UNTIL A > 4
               *> CONTINUE *> Activate this line for the program to work correctly.
           END-PERFORM.
           GO TO FAIL.
       PASS.
           DISPLAY "PERFTEST SEEMS TO HAVE PASSED.  A SHOULD BE 2, A=" A.
       FAIL.
           STOP RUN.


There is an easy work-around: insert a single CONTINUE into the statement list.   However, finding a dozen such PERFORM statements among hundreds of other PERFORM statements in an 18000 line program can be a bear.

Regards,
Jonathan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]