THE NORTON CHRONICLES PETER NORTON

PC MAGAZINE MAY 15, 1984

Norton rediscovers an old favourite, PL/I, in a new incarnation by Digital Research. This fully featured language makes his new loves, Pascal and C, look Spartan by comparison.

As many people know, I'm a programming language enthusiast. I love 'em, especially ones that satisfy my taste for structured languages, cleanliness of programming, and handy and powerful features. Whenever I've commented on programming languages for the PC, mail comes pouring in from those who feel that I've slighted Digital Research's family of languages, PL/I in particular. Today, by popular request, I sing a song of PL/I, my first love in programming.

History Lesson

The history of PL/I is an interesting one. In the old days of mainframe computing, there were two basic types, commercial people who programmed in COBOL and scientific folks who programmed in FORTRAN. And, IBM had quite different machines to fill the two needs. Everybody knew that this separation wasn't a very good idea, so IBM created a unified group of compatible computers, the famous System 360. (Now that IBM is spinning off our beloved PC into a whole line of compatible personal computers, the industry is saying, "IBM is doing another 360.") To go with this integrated line of 360 computers, IBM wanted to create an integrated programming language that would do the work of COBOL, FORTRAN, and more. The result was PL/I, which stands for "programming language one."

PL/I was a great idea, in many ways far ahead of its time. It wasn't until some years after PL/I's creation that the structured programming concept was developed, yet PL/I was a "structured" language from its very beginning. Unfortunately, PL/I didn't catch on too well in the mainframe world, partly because lots of deadheads really liked everything that was wrong with COBOL and FORTRAN, partly because PL/I was too complex for the average programmer to master, and partly because IBM's efforts to tell people how to program raised anti-IBM hackles. (Haven't you noticed that the success of the PC has brought lots of antiIBMers out of the closet again?)

Fortunately for us, the folks at Digital Research, who know a good thing when they see it, created a micro version of PL/I. It's been available for 8-bit computers for some time and lately for our PC as well.

PL/I's Features

What's PL/I like? In style and format, PL/I is somewhat similar to both Pascal and C - about as similar to them as the are to each other. Anyone who has learned to read either Pascal or C will be able to easily read PL/I programs. In fact, I'd say that it's easier on the whole for a beginner to read and understand a PL/I program than programs in most other languages because its design is both clean and flexible . This clarity is a plus: you can learn PL/I quickly by studying examples, and Digital Research's compiler comes with a ton of them.

What really sets PL/I apart from it competitors (which unquestionably Pascal and C) is that it is a language rich in features. It has so many features, in fact that it's hard to summarize them. I'll try to cover the most important ones to give you a more concrete idea of what PL/I's strengths are.

PL/I offers a great many data types with lots of numeric formats and good support for character strings. It gives us more ways to work with numbers than any other PC language that I know of. String handling is particularly good. PL/I makes it easy to define and manipulate both fixed- and variable-length strings. In Pascal and C, string handling is a weak addon, but in PL/I, it's defined into the language. PL/I has many powerful string handling functions such as SEARCH, REVERSE, and TRANSLATE. Its string features are as good as or better than those of any other language, and in my experience, programmers spend a lot of their time working with character strings.

PL/I also really shines in its input and output formatting. Many languages - especially C and Pascal - have rather weak, clumsy, and inflexible I/0 features. If anything, PL/I gives us too many powerful options and features for formatting data and performing I/0 functions.

In addition, PL/I has interrupt handling and error trapping features that neither Pascal nor C have. Among the commonly used PC languages, BASIC is the only other one to my knowledge that lets us write programs that can trap and act on errors and other special conditions. If you don't like programming in BASIC but want these features, you'll find them in PL/I.

PL/I's Components

The best way to understand PL/I's strengths and features is to understand what went into creating it. When I summarized PL/I's history, I mentioned that it resulted from an effort by IBM to satisfy the combined needs of commercial and scientific computer users. Actually that effort was far broader; roughly speaking, PL/I was built out of four parts: FORTRAN's calculations, COBOL's I/0 formatting, Algol's structure, and some new topics.

The traditional FORTRAN school contributed not only handy calculation-by-formula but also automatic calculation with whole arrays of data, one of the main virtues of the language APL. The COBOL camp contributed very powerful I/0 formatting, particularly through an option called PICTURE; formatting using the PICTURE option allows such nice things as floating dollar signs and commas in numbers (BASIC programmers have a crude form of this feature in the PRINT USING statement). The ALGOL language (which isn't widely known these days) contributed such features as a free format for program layout, and block structuring, which helps us make sure that one part of a program doesn't interfere with another. Anyone who is familiar with Pascal and C is accustomed to these virtues; they were not only uncommon when PL/I was created, but PL/I's versions of these features are probably better than those of any language created since. The final element, which I called new topics, consisted of several abilities that had not existed before in major programming languages. These included support of interrupts (similar to BASIC's ON KEY and ON ERROR statements), use of macros and program libraries, and other goodies of that ilk.

As you can see, PL/I is extraordinarily rich in useful features. It puts more power and more goodies into our hands than any other language. However, it also means that mastering PL/I is a much bigger undertaking than mastering other programming languages, not because PL/I is particularly hard to learn, but because there is so much to it. Its power is what's best and what's worst about PL/I.

PL/I for the PC

Digital Research's version of PL/I, called PLI-86, comes in both a CP/M-86 version and a DOS version, so we can use it in the PC's standard DOS environment. PL/I-86 is based on the popular Subset G of PL/I, a version of the language in which the grossly complicated features have been stripped off but the most useful ones retained.

My tests of DR's PL/I-86 showed that it was very nice. The compiler is nearly bug free (and I didn't find any bugs in it on my own). it compiles reasonably fast - in 2 minutes flat for a 28K source program and produces code and finished programs comparable to those in IBM and Microsoft's Pascal.

The manual that comes with PL/I-86 is fat, thorough, and easy to understand. It's as good and as attractive to read as any I've used. On all these tests PL/I-86 scores high.

|===========================| | What really sets PL/I | | apart from its | | Competitors is that it | | is a language rich in | | features. | |===========================| PL/I-86 has one minor quirk that you ought to be aware of if you are considering it. Most DOS compilers are designed to use DOS's own linker to combine programs and library modules. That linker isn't in DR's style, however. PL/I-86 comes with its own DRstyle linker and libraries, which means that we can't develop PL/I-86 programs the same way that we do in standard PC languages. While I'm not fond of that quirk, I'd rate it as a minor nuisance at worst; DR's style of linking is easy to master once you've used the DOS linker, and PL/I-86 comes complete not only with a linker but also an assembler that allows us to write assembly interface modules compatible with the PL/I-86's linker. In addition, PL/I-86 comes with a subroutine librarian program. Hallelujah! A librarian is sorely missed in PCDOS - when IBM wrote PC-DOS, it cheated us of the one that normally comes with MS-DOS.

All in all, I find Digital Research's PL/I a very good product. Now, should you use it? That depends on your perspective.

Another Language?

Although I may sound like Scrooge, I say that we already have too many programming languages and that we'd all be better off with fewer for roughly the same reasons that we'd be better off with fewer spoken languages. I'd like the Tower of Babel to be shorter, not taller. From this perspective, PL/I is like an unwelcome extra guest at an already- crowded party.

But for those who believe in letting a thousand flowers bloom,

I say PL/I-86 is terrific. The language is wonderfully rich and powerful, and the compiler seems excellent. For its strong features alone, PL/I should be considered by anyone who wants the closest thing to the ultimate in programming.

================================================================ | Although I may sound like Scrooge, we already have too many | | programming languages and we'd all be better off with fewer. | ================================================================ I'm a true believer in structured programming, which I think is the most reliable way to write programs. For good structured programming, you ought to be using a well-structured language. Pascal and C qualify, but PL/I adds significantly to our range of choices because it has so many programming goodies. C is a very lean and austere language with few features, and although Pascal is less austere, it's still a language for feature Spartans.

If you are choosing among these three languages, start by considering Pascal, a sound, solid language with excellent safety features. If lean and mean programs are what you are after and you don't mind a few extra programming errors, look north to C. If super flexibility and powerful features are what you are after, at the expense of longer programs, look south to PL/I.

And if you still love BASIC, don't look to me for advice.