This would not be an extension.  It is part of the COBOL 2002 and COBOL 2014 
ISO standards.  It's up the the implementer to define the behavior.  I am 
suggesting the behavior.

Is it worth spending time/money on?  Well, that's a different question.  ;)

Frank

________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
John McKown <john.archie.mck...@gmail.com>
Sent: Thursday, August 10, 2017 6:04 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: COBOL STOP RUN enhancement

On Wed, Aug 9, 2017 at 6:43 PM, Frank Swarbrick <frank.swarbr...@outlook.com
> wrote:

> I am curious to hear opinions on something.  The current COBOL standard
> has an enhancement to the STOP RUN statement.  There are two new options,
> the ERROR phrase and the NORMAL phrase.  My first thought is that the
> NORMAL phrase could replace the RETURN-CODE special register, which is a
> non-standard IBM extension, for setting register 15 and thus the return
> code back to the OS.  An example is:
>
> STOP RUN WITH NORMAL STATUS 16
>
> This would set R15 to a value of 16 and then terminate the run-unit
> normally.  Essentially the same as moving 16 to RETURN-CODE and then doing
> a STOP RUN.  The advantage to it, other than being supported by the COBOL
> standard, is that the RETURN-CODE special register can be unintentionally
> set (usually back to zero) if you do a CALL statement after setting
> RETURN-CODE.
>
> My further thinking is that perhaps the ERROR phrase of STOP RUN could
> cause an intentional abend.
>
> STOP RUN WITH ERROR STATUS 1234
>
> This could cause a U1234 abend (or possibly a specific user abend with the
> 1234 being the "reason code"), which in turn would cause the run unit to
> "abnormally terminate" and do whatever abend processing your shop does.
>
> Currently I believe the recommendation is to call the CEE3ABD routine (or
> CEE3AB2), and in the past one might call ILBOABN0.  Or in the case of our
> shop (I don't know the history/reasoning behind this) do an intentional
> data exception or division by zero.
>
> Anyway it seems to me that an "official" COBOL method of doing this could
> be worthwhile.  I don't know if other languages such as C or PL/I have
> something similar.  All thoughts are welcome (preferably agreeing with me
> <grin>).
>
>
PL/I has the STOP statement. But it is like COBOL's STOP RUN in that it
does not have any specification for a return code. C can use the exit()
function, which can take an integer value which is the return code. But
nothing has the equivalent of the 'ERROR STATUS' functionality that you
mentioned.

In IBM speak "how much are you will to pay for this feature and what other
improvements are you willing to abandon or delay to implement this
instead?" IBM tends to not look favorably upon extending ANSI COBOL unless
there is a real need or money to be made.

Oh, and it does seem like a good idea to me. That and around $10 might get
you a cheap cuppa at Starbucks.


--
If you look around the poker table & don't see an obvious sucker, it's you.

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to