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

SEARCH and Conditional Statement (was RE: gnubol: Braiding #1 #2 #3



> -----Original Message-----
> From: owner-gnu-cobol@wallace.lusars.net
> [mailto:owner-gnu-cobol@wallace.lusars.net]On Behalf Of Tim Josling
  <snip>
>
>
> Bill,
>
> 1. Cen you quote where it says search can have nested conditionals - I
> have
> 'searched' in vain (I found it for IF OK) both in the standard and the
> two
> updates even CD1.7. I don't have the clarifications with me, and my wife
> has
> already read too many of them out to me over the phone.
>

It is a "tad obscure" (and it would nice if it were a Syntax Rule - not a
General Rule) but, what I remembered was GR1a which states (page VI-123),

"The scope of a SEARCH statement may be terminated by any of the following:

 a. An END-SEARCH phrase at the same level of nesting
 b. A separator period
 c. An ELSE or END-IF phrase associated with a previous IF statement.

(See page IV-40, Scope of Statements)"

What this means (I think - and the way I think most vendors have implemented
it) is that

  If A = B
    Search XYZ
     When X = Y
       Read Abc
          At End
             Display "OK"
  Else
    Display "Foo"
  End-IF

*is* OK (conforming) because the ELSE terminates the SEARCH which means that
the READ is made "imperative" (VERY implicitly - by the end of the "scope" of
the SEARCH).

NOTE WELL:  There is no other verb (statement) - other than IF - that I know
of that has any similar wording to support "nested" conditionals.


Bill Klein
  wmklein <at> ix.netcom.com


--
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.