Re: PL/I exceptions

"Robin Vowels" <>
Sun, 30 Mar 2014 01:58:11 +1100

          From comp.compilers

Related articles
Re: Is multi-level function return possible? (2014-03-26)
Re: catch and throw, was Is multi-level function return possible? (2014-03-27)
Re: catch and throw, was Is multi-level function return possible? (Bakul Shah) (2014-03-26)
Re: catch and throw, was Is multi-level function return possible? (mac) (2014-03-28)
Re: PL/I exceptions, was catch and throw, was Is multi-level function (glen herrmannsfeldt) (2014-03-29)
Re: PL/I exceptions (Robin Vowels) (2014-03-30)
| List of all articles for this month |

From: "Robin Vowels" <>
Newsgroups: comp.compilers
Date: Sun, 30 Mar 2014 01:58:11 +1100
Organization: Compilers Central
References: 14-03-065 14-03-068 14-03-070 14-03-076 14-03-079
Keywords: history, PL/I
Posted-Date: 29 Mar 2014 13:59:41 EDT

From: "glen herrmannsfeldt" <>
> One I remember, but maybe no-one does anymore. You can use ON ENDPAGE
> to paginate output. When an attempt is made to print a line past the
> end of the page (an attribute of printable output files) the ENDPAGE
> ON unit is executed, which skips to the next page

It actually doesn't do that.
In the absence of an ON-unit, the standard system action is to start a new page.
With an ON-unit activated, PL/I does not "skip[] to a new page".
The code in the ON-unit may print a footer for the current page.
The code in the ON-unit must then execute PUT PAGE explicitly (or a PAGE option)
to start the new page, where a header (incorporating an automatically-generated page number
via PAGENO) can be printed.
When the ON-unit concludes, normal printing continues.

> and prints any page
> headers. Then return and let the output continue.
> ENDFILE, on the other hand, (on input files) most likely goes on to
> process the data. It might be that you could close the file, open a
> new one and continue on. I never tried that.

Yes, you can do that, or even re-read the same file.

> For CONVERSION, you can test the invalid character, and, if desired,
> replace it with a different one.

Or you can examine the entire field, and replace some or all of the entire field.
You probably also want to print the bad field.

> For SUBSCRIPTRANGE and STRINGRANGE there likely isn't much to do,
> maybe just print a message. You could go process something else, but
> usually not much point in trying again.

What is normally done for SUBSCRIPTRANGE is to include in the ON-unit some
PUT statements that print the values of variables that are used for subscripts,
and possibly some other variables, so that you don't have to re-run the program
to ask the same questions again.

With STRINGRANGE, it's usual to continue execution, because after displaying
an error message, PL/I forces the SUBSTRing arguments so as to confirm to the rules
(i.e., so that nothing is out-of-range, and nothing can be damaged).
It would also be usual to include a print statement in the ON-unit to print values of variables
used in SUBSTRing references.

STRINGSIZE warns you that the destination of an assignment etc is shorter than
the characters or bits assigned to it.

For serious errors, the ERROR condition also is raised following the raising of the
relevant condition (e.g., SUBSTRIPTRANGE, OVERFLOW, etc).

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.