[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNU-COBOL] Procedure Division Format Question
Fred Mobach wrote:
> Laura Tweedy wrote:
>
> > Cobol Gurus!
> >
> > The standard claims the following are both valid format for the
> > procedure division:
> >
> > Format 1:
> > PROCEDURE DIVISION.
> > { section-name SECTION.
> > [ paragraph-name.
> > [sentence]... ]... }...
> >
> > Format 2:
> > PROCEDURE DIVISION.
> > { paragraph-name.
> > [sentence]... }...
An additional note on paragraph names.
Paragraph names must be unique in a section, but the same paragraph name can be
used in more sections. A reference without qualification to a multiple defined
paragraph name in a GO TO or PERFORM statement refers to the paragraph in the same
section, if it's in that section, otherwise an error must be signalled.
Example 1 : This is O.K.
SECTION-A SECTION.
PAR00.
IF condition
GO TO EOS
ELSE
statement ...
.
EOS.
EXIT.
SECTION-B SECTION.
PAR00.
IF condition
GO TO EOS
ELSE
statement ...
.
EOS.
EXIT.
This is normal practice and compilers on Siemens BS2000 and IBM MVS mainframes as
well as COBOL compilers on UNIXes and DOS support this. Note that EOS is short for
End Of Section.
Example 2 : This is NOT O.K. and also bad practice : sections should be performed
and not jumped into by a brach.
SECTION-A SECTION.
PAR.
IF condition
GO TO PAR00
* Error : PAR00 multiple defined.
.
EOS.
EXIT.
SECTION-B SECTION.
PAR00.
statement ...
.
EOS.
EXIT.
SECTION-C SECTION.
PAR00.
statement ...
.
EOS.
EXIT.
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.