Some C programmers are fond of if (7 == foo) rather than the more conventional if (foo == 7) because if one gets in the habit of doing so and then accidentally codes if (7 = foo) one gets a compile error rather than unexpected behavior.
For those not familiar with C, foo == 7 is a relational expression, foo = 7 is an assignment, and if (foo = 7) ... compiles as though one had coded foo = 7; if (foo != 0) /* which will be true of course */ ... which is not at all what was presumably intended. 7 = foo is always a compile-time error; you can't assign a variable to a constant. Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Paul Gilmartin Sent: Monday, July 15, 2019 11:40 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: JCL COND Parameter On Mon, 15 Jul 2019 16:51:43 +0100, CM Poncelet wrote: >If '//STEP000 EXEC PGM=IEFBR14' is commented out, then 'STEPA030' will >execute with CC=00 instead of NXEQ'd.* >* Of course you're right. I was misled by a strong habit I have. When coding tests, I try to put the notional variable on the left; the notional constant on the right. I'd code in most other languages: IF ( CC < 7 ) never: IF ( 7 > CC ) ... but JCL wouldn't allow my habitual: //STEPA040 EXEC PGM=IEFBR14,COND=(STEP010,LT,7)) or, especially: //STEPA030 EXEC PGM=IEFBR14,COND=(LT,7) So I misunderstood: //STEPA030 EXEC PGM=IEFBR14,COND=(7,GT) //STEPA040 EXEC PGM=IEFBR14,COND=(7,GT,STEP010) Where languages allow it, do other programmers generally code the variable on the left or the right? I find it jarring to see: IF ( 7 > CC ) (... but my habits were not formed by the syntax of JCL COND or CLI.) ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN