[TUHS] PL/I stuff - was: Book Recommendation

Paul Winalski paul.winalski at gmail.com
Fri Nov 26 02:35:13 AEST 2021

On 11/24/21, Douglas McIlroy <douglas.mcilroy at dartmouth.edu> wrote:
>> What, if any, features does PL/I have that are not realized in a modern
>> language?
> 7. Astonishingly complete set of implicit data conversions. E.g. if X
> is floating-point and S is a string, the assignment X = S works when S
> = "2" and raises an exception (not PL/I terminology) when S =  "A".

This could definitely be a buzz saw without safety shields.  Some of
the implicit conversion rules, particularly those dealing with fixed
point decimal arithmetic of mixed precision, had edge conditions that
yielded non-intuitive results.

I had a bug once that was due to a typo causing an unwanted implicit
conversion.  I had meant to type "IF A ~= B" (I'm using ~ here in
place of the PL/I "not" operator--the EBCDIC angle character), meaning
"IF A is not equal to B".  What I actually typed is "IF A =~ B". (if A
equals not-B).  Both A and B were character strings.  To apply the NOT
operator, B was converted to a bit string with '0' converted to a zero
bit and '1' to a one bit.  The NOT was performed, then the bit string
was converted back to a character string so that it could be compared
to A.  My clue as to the bug was a warning diagnostic from the
compiler:  "data conversion will be done by subroutine call".  This
almost always meant you'd accidentally invoked some kinky implicit
type conversion, as was the case here.

Here are some other PL/I features you don't see in modern languages.
Some of these were present in the early IBM PL/I compilers but dropped
from the ANSI standard:

1. Sterling pictures.  These provided a convenient way to do math on
and to display numbers representing pre-decimal British currency.
They had pounds, shillings, and pence fields.  This feature was
dropped even from the IBM compilers some years after the Commonwealth
nations all went decimal.

2. The DEFAULT statement.  This was Forran's IMPLICIT on steroids.  It
let you say things like "data items with names beginning with A-G are
decimal, I-N are binary, and O-Z are decimal".  There could also be
overlap between DEFAULT declarations.  So in addition to the rule I
just mentioned, you could say "A-J are fixed point and K-Z are
floating point."  With both of these rules in effect, identifier FOO
would be implicitly "fixed decimal", J would be "fixed biary, and KOOL
would be "float binary".

At our PL/I shop we considered DEFAULT to be a toxic language feature
that was banned.  The problem is that in the presence of a complicated
nest of DEFAULTs, when you see the declaration for an identifier it
can be next to impossible to tell what its complete data type actually

3. PL/I declarations cover the entire scope of the innermost BEGIN/END
block that contains them, regardless of where within that block the
declaration occurs.  Thus you can use variables before they are
declared.  This was mildly useful if you were composing a program at
the keypunch.  Some programmers would write down the declarations for
their variables as they punched the cards, then when they came to the
END statement for a block they would punch out the declarations.  At
our shop this, again, was considered a toxic language feature--we
required all declarations to be at the start of their containing

-Paul W.

More information about the TUHS mailing list