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

Re: [GNU-COBOL] Yet Another Grammar question



Laura Tweedy wrote:

> [The example in question]
>
> > ADD 5 TO FOO
> >         ON SIZE ERROR ADD 3 TO BAR
> >                       ACCEPT BAZ
> >                       ADD 9 TO OTHER
> >         NOT ON SIZE ERROR PERFORM SOME-PAR
>
> > I seem to have overlooked the hard part.  This is a truly nasty
> > example and is more than worthy of official clarication.  The problem
> > is that the NOT ON SIZE ERROR phrase in your second example would
> > seem to legitimately belong to ADD 9 ...
>
> As I read the standard, the ADD statement can only appear in the SIZE
> ERROR clauses (and other imperative-statement locations) when it appears
> "Whithout the optional ON SIZE ERROR and NOT ON SIZE ERROR phrases".
> So, the NOT ON SIZE ERROR PERFORM SOME-PAR can only be matched with the
> very first ADD, that being ADD 5 TO FOO.

Exactly, that's the way it works.

> A lot about the sentence vs. statement has been cleared up, but I guess
> I should state my reason for asking about imperative-statement in the
> first place.  I would *really* like there to be a terminator at the end
> of any statements that are to be executed when the ON SIZE ERROR
> condition occurs.  That is, I would much rather have the above example
> look like:
>
> ADD 5 TO FOO
>          ON SIZE ERROR ADD 3 TO BAR
>                        ACCEPT BAZ
>                        ADD 9 TO OTHER.  <- or END-ADD
>          NOT ON SIZE ERROR PERFORM SOME-PAR

It's a pity, but in Cobol a sentence is composed of one or more statements and
is terminated with a period. And the END-ADD (in COBOL85) is optional and only
needed if one or more conditional clauses are used in a structured sentence. I
understand why you would like a terminator in those places but it's not
conforming the COBOL syntax.

Regards,

Fred Mobach
fred@mobach.nl




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