[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnubol: IBM - Conditionals and Scope Terminators (implicit or otherwise)



(Tom or Robyn - can you comment on my view in the following. Obviously, if -
as this coming from the GNU project - it makes this a "conflict of
interest" - please do not comment - but it is an issue of what YOUR
documentation means.)

I believe (but won't swear to it) that taken together, what these 3
paragraphs mean is:

1) The following is illegal

Add 1 to A
   On Size Error
     Add 1 to B
       On Size error
         Display "illegal"
   .

Because the nested statement is conditional - where an imperative is REQUIRED
(the period does not change the nature of the NESTED statement).

2) If you have

 If A = B
   Add 1 to A
      On Size Error
         Display "OK"
 Else
    Display "OK"
 .

it is EQUIVALENT to

 If A = B
   Add 1 to A
      On Size Error
         Display "OK"
   End-Add
 Else
    Display "OK"
 .

because an "implicit scope terminator" is inserted before the ELSE (phrase
from containing statement) to terminate the conditional statement WHERE IT IS
ALLOWED by the Standard.

3) The following *IS* illegal

 If A = B
   Add 1 to A
      On Size Error
         Add 1 to B
           On Size Error
              Display "illegal"
 Else
    Display "It's a no-no"
 .

because the 2nd add is STILL a conditional (where an imperative is required)
and that even adding a SINGLE "END-ADD" before the Else wouldn't solve the
problem *IF* it were matched with the 1st nested IF (not the 2nd - which is
what would happen by the "implicit scope terminator rule).

  ***

Does this agree with either of you?  Does it make sense (from the
documentation referenced?)

Bill Klein
  wmklein <at> ix.netcom.com

> -----Original Message-----
> From: owner-gnu-cobol@wallace.lusars.net
> [mailto:owner-gnu-cobol@wallace.lusars.net]On Behalf Of Michael McKernan
> Sent: Saturday, December 04, 1999 5:31 PM
> To: gnu-cobol@lusars.net
> Subject: gnubol: an IBM Interpretation
>
>
> Bill and Randall,
>
> A few weeks ago, Bob Rayhawk cited this passage from an on-line IBM
> manual.
>
> http://www.s390.ibm.com/bookmgr-cgi/bookmgr.cmd/BOOKS/IGYLR201/6%2e
1%2e7%2e5?S
>
>   Bob> "6.1.7.5 Implicit Scope Terminators
>
>   Bob> "At the end of any sentence, an IMPLICIT SCOPE TERMINATOR is a
>   Bob> separator period that terminates the scope of all previous
>   Bob> statements not yet terminated.
>
>   Bob> "An unterminated conditional statement cannot be contained by
>   Bob> another statement. However, a scope terminator will be assumed
>   Bob> just prior to the next phrase of the containing statement.
>
>   Bob> "Note: Except for nesting conditional statements within IF
>   Bob> statements, nested statements must be imperative statements,
>   Bob> and must follow the rules for imperative statements. You
>   Bob> should not nest conditional statements. "
>
> Take a look at the middle paragraph.  Bob and I disagreed about what
> it meant, but it seems to mean something.  What's your take?
>
>
>
> --
> This message was sent through the gnu-cobol mailing list.  To
> remove yourself
> from this mailing list, send a message to majordomo@lusars.net with the
> words "unsubscribe gnu-cobol" in the message body.  For more information on
> the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.


--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.