The entire original confusion had to do with the fact that the 1st question 
involving HiGH-VALUE was not processed as expected because the AND took 
precedent over the OR.

I don't remember exactly how COBOL does X = 'A' OR 'B', If NATURAL, this would 
be X = 'A' OR = 'B", The "OR =" is the operator required by the language syntax.

Personally, if I was writing this in COBOL,  I'd probably use the full, 
unambiguous     SMOD (IND1) = 'B' OR SMOD (IND1) = 'R'

>-----Original Message-----
> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On
> Behalf Of Paul Gilmartin
> Sent: Friday, June 05, 2020 1:33 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: COBOL Question
> 
> On Fri, 5 Jun 2020 20:17:06 +0000, Gibney, Dave wrote:
> 
> >Using OP
> >         IF TVOLL (IND1) NOT = HIGH-VALUE
> >         AND SMOD (IND1) = 'B' OR 'R'
> >
> >I would do
> >         IF TVOLL (IND1) NOT = HIGH-VALUE
> >              IF SMOD (IND1) = 'B' OR 'R'
> >                  Do the stuff
> >
> I have (almost) never coded COBOL, so I have trouble wrapping my head
> around:
>     SMOD (IND1) = 'B' OR 'R'
> 
> Does it mean:
>     ( SMOD (IND1) = 'B' ) OR 'R'  or
>     SMOD (IND1) = ( 'B' OR 'R' )  or (implied Distributive Law):
>     SMOD (IND1) = 'B' OR SMOD (IND1) = 'R'
> 
> I'd have even more trouble with:
>     SMOD (IND1) NOT = 'B' OR 'R'
>     SMOD (IND1) NOT = 'B' OR SMOD (IND1) NOT = 'R'
> 
> ... which seems to be a verbose expression for TRUE.  I've seen programmers
> fall into that trap.
> 
> -- gil
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send email to
> lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to