[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] incorrect code being generated
From: |
David Korn |
Subject: |
[open-cobol-list] incorrect code being generated |
Date: |
Mon Aug 23 20:59:12 2004 |
The following program outputs
NOT ANY VAL= A
which is not correct.
====================PROG29.COB==========================
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG29.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Q232-DOC-FRMT-IND PIC X VALUE SPACES.
88 Q232-PAPER VALUE 'P'.
88 Q232-ALT-MEDIA VALUE 'A'.
88 Q232-PAPER-ALT-MEDIA VALUE 'Z'.
PROCEDURE DIVISION.
SET Q232-ALT-MEDIA TO TRUE
EVALUATE TRUE
WHEN NOT Q232-PAPER AND
NOT Q232-ALT-MEDIA AND
NOT Q232-PAPER-ALT-MEDIA
DISPLAY 'NOT ANY VAL= ' Q232-DOC-FRMT-IND
WHEN OTHER
DISPLAY 'VAL MATCHED= ' Q232-DOC-FRMT-IND
END-EVALUATE
GOBACK.
====================PROG29.COB==========================
The WHEN clause on line 11 generates
if (!(((cob_cmp (&f_5, &c_12) == 0) && !(cob_cmp (&f_5, &c_13) == 0)) &&
!(cob_cmp (&f_5, &c_14) == 0)))
whereas I think that it should be
if (!(cob_cmp (&f_5, &c_12) == 0) && !(cob_cmp (&f_5, &c_13) == 0) &&
!(cob_cmp (&f_5, &c_14) == 0))
since NOT binds higher than AND.
David Korn
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [open-cobol-list] incorrect code being generated,
David Korn <=