gnucobol-users
[Top][All Lists]
Advanced

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

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


From: Fred Mobach
Subject: Re: [open-cobol-list] Has this PERFORM problem been reported already?
Date: Fri, 7 May 2010 20:40:53 +0200
User-agent: KMail/1.9.10

On Friday 07 May 2010 19:53:40 Jonathan Beit-Aharon wrote:
> 
> 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.

According to the 89 standard an imperative statement-1 is needed in a 
format 2 PERFORM statement (inline perform). As such a CONTINUE will 
do. :-)
-- 
Fred Mobach - address@hidden - address@hidden
website : https://fred.mobach.nl
 .... In God we trust ....
 .. The rest we monitor ..


reply via email to

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