Greg Shirey wrote:
Hello all, I'd appreciate some help interpreting COBOL. A programmer was updating a program which contained the following: IF WC-FUNC (SUB) = ("X" OR "Z") AND (WC-AMTUSE (SUB) + WC-AMT-PENDING (SUB)) < 0 GO TO G100-FIND-CREDIT-X.

I _never_ use abbreviated combined conditions: there
is too much chance of mis-interpretation. For example,
I think your programmer meant:

If wc-func(sub) = "X" or wc-func(sub) = "Z"
     if (wc-amtuse(sub) + wc-amt-pending(sub)) < 0
          go to g100-find-credit-x
     end-if
end-if





and the compiler spit out: IGYPS2048-S An invalid abbreviated relation condition was found. The statement was discarded.
The programmer's first issue was that this program compiled "clean" back
in 2006.
Our research discovered APAR PK27765 which says: "The Enterprise COBOL
compiler did not correctly diagnose
an incorrect IF statement."   and  "The Enterprise COBOL is changed to
correctly diagnose an abbreviated IF statement missing a required
logical operator with message IGYPS2048-S."  The date on this APAR was
late 2006.
My interpretation is that the COBOL IF statement was incorrect in 2006,
but the compiler did not correctly flag it, and that error has now been
fixed.

The programmer's second issue became - so what's wrong with the IF
statement anyway?
I'm kind of stuck on that one.  I'd appreciate any feedback.

Regards,

Greg Shirey
Ben E. Keith Co.

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-393-8716
http://www.trainersfriend.com

  z/OS Application development made easier
    * Our classes include
       + How things work
       + Programming examples with realistic applications
       + Starter / skeleton code
       + Complete working programs
       + Useful utilities and subroutines
       + Tips and techniques

==> Check out the Trainer's Friend Store to purchase z/OS  <==
==> application developer toolkits. Sample code in four    <==
==> programming languages, JCL to Assemble or compile,     <==
==> bind and test.                                         <==
==>   http://www.trainersfriend.com/TTFStore/index.html    <==

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to