Discussion:
COBOL STOP RUN enhancement
Add Reply
Frank Swarbrick
2017-08-09 23:42:14 UTC
Reply
Permalink
Raw Message
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>).

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
John McKown
2017-08-10 12:02:54 UTC
Reply
Permalink
Raw Message
Post by Frank Swarbrick
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
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 ***@listserv.ua.edu with the message: INFO IBM-MAIN
David W Noon
2017-08-10 15:39:03 UTC
Reply
Permalink
Raw Message
On Thu, 10 Aug 2017 07:04:02 -0500, John Mckown
(***@GMAIL.COM) wrote about "Re: COBOL STOP RUN
enhancement" (in
[snip]
Post by John McKown
Post by Frank Swarbrick
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.
PL/I has the PLIRETC() built-in subroutine that is directly analogous to
MOVE nn TO RETURN-CODE in COBOL. Moreover, the STOP statement adds 1000
to the return code. Thus,

CALL PLIRETC(16);
STOP;

will terminate the step normally with a return code of 1016.

One can also use SIGNAL FINISH to terminate without adding to the return
code.
Post by John McKown
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.
The exit() function poses problems when using C++, as it bypasses static
destructors.

To set a return code more safely in C/C++, one should use a return
statement in the main() function with a numeric value:

int main(void)
{
...
return 16;
}

The return type of "int" is mandatory in this case.
--
Regards,

Dave [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
***@googlemail.com (David W Noon)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Frank Swarbrick
2017-08-10 17:12:37 UTC
Reply
Permalink
Raw Message
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-***@LISTSERV.UA.EDU> on behalf of John McKown <***@GMAIL.COM>
Sent: Thursday, August 10, 2017 6:04 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: COBOL STOP RUN enhancement
Post by Frank Swarbrick
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
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 ***@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
John McKown
2017-08-10 17:17:44 UTC
Reply
Permalink
Raw Message
On Thu, Aug 10, 2017 at 12:13 PM, Frank Swarbrick <
Post by Frank Swarbrick
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.
​Hum, is there a place on the Web to read these standards? Preferably ​for
free.
Post by Frank Swarbrick
Is it worth spending time/money on? Well, that's a different question. ;)
Frank
--
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 ***@listserv.ua.edu with the message: INFO IBM-MAIN
Farley, Peter x23353
2017-08-10 17:42:08 UTC
Reply
Permalink
Raw Message
Nope. ISO charges for everything, and it is not usually cheap either.

BTDTGTTS

The only possible "free" place I can think of might be a university or college CS department that already paid for it and makes it available to CS students. But non-students/faculty might not have access even then.

And most such programs aren't teaching COBOL any more. Or even caring anything at all about it.

Peter

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of John McKown
Sent: Thursday, August 10, 2017 1:19 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: COBOL STOP RUN enhancement
Post by Frank Swarbrick
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.
​Hum, is there a place on the Web to read these standards? Preferably ​for free.
Post by Frank Swarbrick
Is it worth spending time/money on? Well, that's a different
question. ;)
Frank
--

This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Frank Swarbrick
2017-08-10 17:55:22 UTC
Reply
Permalink
Raw Message
Unfortunately not for free. You can buy it from ISO, ANSI, or other standards site for your country.

ISO: https://www.iso.org/standard/51416.html - CHF 198

ANSI: https://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2FISO%2FIEC+1989%3A2014+%5B2014%5D - USD 133

IBM has already implemented a couple of "ISO 2002 COBOL" features: floating comments (with COBOL V5), dynamic storage allocation (with COBOL V6), and enhanced INITIALIZE statement (also with COBOL V6).
________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of John McKown <***@GMAIL.COM>
Sent: Thursday, August 10, 2017 11:18 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: COBOL STOP RUN enhancement

On Thu, Aug 10, 2017 at 12:13 PM, Frank Swarbrick <
Post by Frank Swarbrick
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.
Hum, is there a place on the Web to read these standards? Preferably for
free.
Post by Frank Swarbrick
Is it worth spending time/money on? Well, that's a different question. ;)
Frank
--
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 ***@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Allan Staller
2017-08-10 12:58:05 UTC
Reply
Permalink
Raw Message
Both methods would need to be supported. How many COBOL programs exist with "MOVE x to RETURN-CODE. STOP RUN."
So what (other than standards "compliance") is the benefit to IBM to implement?



-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of Frank Swarbrick
Sent: Wednesday, August 9, 2017 6:43 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: COBOL STOP RUN enhancement

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

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


::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------

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