Subject: | |
From: | |
Reply To: | |
Date: | Sat, 14 Feb 2004 23:48:40 -0600 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
2004-02-14
[also posted to SIGCOBOL list]
I asked:
> HP COBOL provides two ways to return from a subprogram. EXIT PROGRAM
> is [1985] ANSI Standard COBOL. GOBACK is an extension.
> I'm curious to hear thoughts about whether people favor one statement
> over the other, and why.
Jeanette points out that GOBACK can be used in both subprograms and main
programs. In a subprogram, it returns to the calling program. In a main
program, it terminates execution. That's pretty convenient.
Glenn says that GOBACK has been available in all of the many COBOL compilers
he has used. It's obviously been a widely implemented extension.
Bruce points out that GOBACK was added to the COBOL 2002 standard. It's
convenient and widely available, so it made sense for the COBOL committee to
make it official.
Jeanette observes that the COBOL II/iX documentation says EXIT PROGRAM has
to be in its own paragraph, but Bruce points out that the compiler doesn't
enforce that requirement. That restriction is not in the COBOL 1985
standard, so I think it's an error in the HP manual. I'll submit an SR
against the manual and see if the HP COBOL lab agrees.
Bottom line: If you're a stickler for following the 1985 COBOL standard,
and you want a clean compile with $CONTROL STDWARN turned on, use EXIT
PROGRAM. It doesn't have to be in a separate paragraph, unless you want to
abide by the apparently mistaken reference manual.
On the other hand, GOBACK gives you the convenience of one statement that
works in both main programs and subprograms, it's widely implemented, and
it's blessed by the COBOL 2002 standard.
Thanks to all for your input.
Walter
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|