At chapter 7.8.9 COMPUTE the syntax diagram is as follows:
COMPUTE { identifier-1
~~~~~~~
[ ROUNDED [ MODE IS { AWAY-FROM-ZERO } ] } ...
~~~~~~~ ~~~~ { ~~~~~~~~~~~~~~ }
{ NEAREST-AWAY-FROM-ZERO }
{ ~~~~~~~~~~~~~~~~~~~~~~ }
{ NEAREST-EVEN }
{ ~~~~~~~~~~~~ }
{ NEAREST-TOWARD-ZERO }
{ ~~~~~~~~~~~~~~~~~~~ }
{ PROHIBITED }
{ ~~~~~~~~~~ }
{ TOWARD-GREATER }
{ ~~~~~~~~~~~~~~ }
{ TOWARD-LESSER }
{ ~~~~~~~~~~~~~ }
{ TRUNCATION }
~~~~~~~~~~
= | EQUAL arithmetic-expression-1
~~~~~~~~~
[ ON SIZE ERROR imperative-statement-1 ]
~~~~ ~~~~~
[ NOT ON SIZE ERROR imperative-statement-2 ]
~~~ ~~~~ ~~~~~
[ END-COMPUTE ]
~~~~~~~~~~~
We should add "boolean-expression-1" , so the syntax-diagram becomes as follows:
COMPUTE { identifier-1
~~~~~~~
[ ROUNDED [ MODE IS { AWAY-FROM-ZERO } ] } ...
~~~~~~~ ~~~~ { ~~~~~~~~~~~~~~ }
{ NEAREST-AWAY-FROM-ZERO }
{ ~~~~~~~~~~~~~~~~~~~~~~ }
{ NEAREST-EVEN }
{ ~~~~~~~~~~~~ }
{ NEAREST-TOWARD-ZERO }
{ ~~~~~~~~~~~~~~~~~~~ }
{ PROHIBITED }
{ ~~~~~~~~~~ }
{ TOWARD-GREATER }
{ ~~~~~~~~~~~~~~ }
{ TOWARD-LESSER }
{ ~~~~~~~~~~~~~ }
{ TRUNCATION }
~~~~~~~~~~
= | EQUAL arithmetic-expression-1 | boolean-expression-1
~~~~~~~~~
[ ON SIZE ERROR imperative-statement-1 ]
~~~~ ~~~~~
[ NOT ON SIZE ERROR imperative-statement-2 ]
~~~ ~~~~ ~~~~~
[ END-COMPUTE ]
~~~~~~~~~~~
In the descriptive part of this chapter 7.8.9 COMPUTE, the following could be added:
The COMPUTE verb can also be used to valuate boolean expressions (see 2.1.26 Boolean Expressions) . See following example:
>>SOURCE FORMAT IS FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTBOOLEAN.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A pic 9 comp-x value B'00000101'.
01 B pic 9 comp-x value B'00000011'.
01 c pic 9 value LOW-VALUE.
PROCEDURE DIVISION.
display space
display ' a b c a b c '
display ' --- ------ --- --- -------- -------- -------- --------'
display ' ' a ' initial ' b ' ' c ' ' FUNCTION BIT-Of(a) ' initial ' FUNCTION BIT-Of(b) ' ' FUNCTION BIT-OF(c)
display space display space
display ' a operator b c a operator b c '
display ' --- ------ --- --- -------- -------- -------- --------'
compute c = a B-AND b
display ' ' a ' AND ' b ' = ' c ' ' FUNCTION BIT-Of(a) ' AND ' FUNCTION BIT-Of(b) ' = ' FUNCTION BIT-OF(c)
compute c = a B-OR b
display ' ' a ' OR ' b ' = ' c ' ' FUNCTION BIT-Of(a) ' OR ' FUNCTION BIT-Of(b) ' = ' FUNCTION BIT-OF(c)
compute c = a B-XOR b
display ' ' a ' XOR ' b ' = ' c ' ' FUNCTION BIT-Of(a) ' XOR ' FUNCTION BIT-Of(b) ' = ' FUNCTION BIT-OF(c)
compute c = B-NOT b
display ' -' ' NOT ' b ' = ' c ' - ' ' NOT ' FUNCTION BIT-Of(b) ' = ' FUNCTION BIT-OF(c)
accept omitted
STOP RUN.
and in particular with the boolean "shift" operators, see the following example:
>>SOURCE FORMAT IS FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTBOOLEANSHIFT.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A pic 9 comp-x value B'00000001'.
01 B pic 9 comp-x value B'00000101'.
01 c pic 9 value LOW-VALUE.
PROCEDURE DIVISION.
display space
display ' a b c a b c '
display ' --- ------ --- --- -------- ---------- -------- --------'
display ' ' a ' initial ' b ' ' c ' ' FUNCTION BIT-Of(a) ' initial ' FUNCTION BIT-Of(b) ' ' FUNCTION BIT-OF(c)
display space display space
display ' a operator b c a operator b c '
display ' --- ------ --- --- -------- ---------- -------- --------'
compute c = a B-SHIFT-L b
display ' ' a ' B-SHIFT-L ' b ' = ' c ' ' FUNCTION BIT-Of(a) ' B-SHIFT-L ' FUNCTION BIT-Of(b) ' = ' FUNCTION BIT-OF(c)
compute c = a B-SHIFT-LC b
display ' ' a ' B-SHIFT-LC ' b ' = ' c ' ' FUNCTION BIT-Of(a) ' B-SHIFT-LC ' FUNCTION BIT-Of(b) ' = ' FUNCTION BIT-OF(c)
compute c = a B-SHIFT-R b
display ' ' a ' B-SHIFT-R ' b ' = ' c ' ' FUNCTION BIT-Of(a) ' B-SHIFT-R ' FUNCTION BIT-Of(b) ' = ' FUNCTION BIT-OF(c)
compute c = a B-SHIFT-RC b
display ' ' a ' B-SHIFT-RC ' b ' = ' c ' ' FUNCTION BIT-Of(a) ' B-SHIFT-RC ' FUNCTION BIT-Of(b) ' = ' FUNCTION BIT-OF(c)
accept omitted
STOP RUN.
Note #468 document binary operators ticket can be closed.
Diff:
Done but bug 468 is closed and has nothing to do with binary ops.
Sorry. It is a ticket in the Wish List.