Please help me with the problem below.
I don’t understand why it entered the WHEN FUN-BNC AND NOT EVT-BNC code when both FUN-BNC and EVT-BNC are false.
I think it is related with the compilations warnings, that I didn’t understand as well. :/
000218 01 FUN-INCORPORADO PIC 9(001) VALUE 0.
000219 88 FUN-NAO-INCORPORADO VALUE 0.
000220 88 FUN-BESC VALUE 1.
000221 88 FUN-BEP VALUE 2.
000222 88 FUN-BNC VALUE 3.
000224 01 EVT-INCORPORADO PIC 9(001) VALUE 0.
000225 88 EVT-NAO-INCORPORADO VALUE 0.
000226 88 EVT-BESC VALUE 1.
000227 88 EVT-BEP VALUE 2.
000228 88 EVT-BNC VALUE 3.
001102 DISPLAY 'FUN-INCORPORADO ' FUN-INCORPORADO
001103 DISPLAY 'EVT-INCORPORADO ' EVT-INCORPORADO
001104 EVALUATE TRUE
001105 WHEN FUN-NAO-INCORPORADO AND NOT EVT-NAO-INCORPORADO
001106 MOVE 'some text
001107 - 'more text.' TO TX-ERROR
001108 PERFORM GRAVAR-ERRO-E-ENCERRAR
001109 WHEN FUN-BESC AND NOT EVT-BESC
001110 MOVE 'some text
001111 - 'more text.' TO TX-ERROR
001112 PERFORM GRAVAR-ERRO-E-ENCERRAR
001113 WHEN FUN-BEP AND NOT EVT-BEP
001114 MOVE 'some text
001115 - 'more text.' TO TX-ERROR
001116 PERFORM GRAVAR-ERRO-E-ENCERRAR
001117 WHEN FUN-BNC AND NOT EVT-BNC
001118 MOVE 'it displays this message
001119 - 'more text.' TO TX-ERROR
001120 PERFORM GRAVAR-ERRO-E-ENCERRAR
001121 * Incorporados Optantes
001122 WHEN NOT (EVT-BESC OR EVT-BEP OR EVT-BNC)
001123 MOVE 'some text
001124 - 'more text.' TO TX-ERROR
001125 PERFORM GRAVAR-ERRO-E-ENCERRAR
001126 END-EVALUATE
000219 88 FUN-NAO-INCORPORADO VALUE 0.
000220 88 FUN-BESC VALUE 1.
000221 88 FUN-BEP VALUE 2.
000222 88 FUN-BNC VALUE 3.
000224 01 EVT-INCORPORADO PIC 9(001) VALUE 0.
000225 88 EVT-NAO-INCORPORADO VALUE 0.
000226 88 EVT-BESC VALUE 1.
000227 88 EVT-BEP VALUE 2.
000228 88 EVT-BNC VALUE 3.
001102 DISPLAY 'FUN-INCORPORADO ' FUN-INCORPORADO
001103 DISPLAY 'EVT-INCORPORADO ' EVT-INCORPORADO
001104 EVALUATE TRUE
001105 WHEN FUN-NAO-INCORPORADO AND NOT EVT-NAO-INCORPORADO
001106 MOVE 'some text
001107 - 'more text.' TO TX-ERROR
001108 PERFORM GRAVAR-ERRO-E-ENCERRAR
001109 WHEN FUN-BESC AND NOT EVT-BESC
001110 MOVE 'some text
001111 - 'more text.' TO TX-ERROR
001112 PERFORM GRAVAR-ERRO-E-ENCERRAR
001113 WHEN FUN-BEP AND NOT EVT-BEP
001114 MOVE 'some text
001115 - 'more text.' TO TX-ERROR
001116 PERFORM GRAVAR-ERRO-E-ENCERRAR
001117 WHEN FUN-BNC AND NOT EVT-BNC
001118 MOVE 'it displays this message
001119 - 'more text.' TO TX-ERROR
001120 PERFORM GRAVAR-ERRO-E-ENCERRAR
001121 * Incorporados Optantes
001122 WHEN NOT (EVT-BESC OR EVT-BEP OR EVT-BNC)
001123 MOVE 'some text
001124 - 'more text.' TO TX-ERROR
001125 PERFORM GRAVAR-ERRO-E-ENCERRAR
001126 END-EVALUATE
Output of the two displays above:
FUN-INCORPORADO 0
EVT-INCORPORADO 0
GRAVAR-ERRO-E-ENCERRAR displays the message in TX-ERROR and exits the program.
The compilation gave me these warnings:
0 WHEN FUN-BNC AND NOT EVT-BNC
0 MOVE '...
W CODE FROM "MOVE (LINE 1902.01)" TO "MOVE (LINE 1902.01)" CAN NEVER BE
EXECUTED AND WAS THEREFORE DISCARDED.
It gave this warning for all WHEN conditions, except for the first and last one.