PPPPPPPPP L / I P P L / I P P L / I P P L / I PPPPPPPP L / I P L / I P L / I P L / I P LLLLLLLLLL / I What is PL/I? --------------------------------------------------------------------------- For those of you who know little or nothing about PL/I, let's briefly review why PL/I is indeed the language of choice.

PL/I is a free-form, easy to learn and easy to use, highly-structured, high-productivity language with a wide variety of features that support scientific, engineering, commercial, and system programming tasks. It is designed to offer robustness, machine independence, structured programming constructs, powerful exception handling capabilities, dynamic storage management, extensive data types, data aggregates (arrays, structures, unions, and combinations thereof), extensive I/O capabilities, and built-in functions for string, mathematical, arithmetic, precision, array, storage control, condition handling, date/time, and other processing.

Free-form easy-to-learn

Unlike many other languages, PL/I is completely free-form and has no reserved keywords. PL/I determines the meaning of keywords from the context of use. The programmer can concentrate on program logic using meaningful names rather than having to worry about the use of words that may have a specific meaning in the language. For example, it is perfectly valid to declare a variable named AREA even though it is also a PL/I keyword. Defaults are provided such that you need not even be aware of other features (e.g. COMPLEX data).

Machine independent

PL/I defines its data types very precisely without regard for any hardware. For example, an "integer" is defined as having a mode of REAL or COMPLEX, base of BINARY or DECIMAL, along with the precision that you require. Therefore, FIXED BINARY(12) declares a binary integer of 12 data bits, whereas FIXED DECIMAL(3) declares a decimal integer of 3 decimal digits. You get precisely what you ask for. The implementers deliver even if the machine has no support for such data type or precision.

Program structure

PL/I is a block-oriented language, consisting of packages, procedures, begin blocks and statements.

PL/I's block structure allows you to produce highly-modular applications, because blocks can contain declarations that define variable names and storage class. Thus, programmers can restrict the scope of a variable to a single block or a group of blocks, or can cause it to be known throughout the compilation unit or a load module.

Structured programming constructs

PL/I provides many constructs that allow for program logic to be highly modular and well structured for greater reliability and easier development, maintenance, and extensibility. These include:

Combinations of these along with loop controlling statements, LEAVE and ITERATE, allow complex looping logic to be expressed in simple comprehensible terms.

Data types

A characteristic of PL/I that contributes to the range of applications for which it can be used is the variety of data types that can be represented and manipulated. Data types include:

Data arrays, structures, and unions

In PL/I, data items can be single data elements or they can be grouped together to form data aggregates that can be referred to either collectively or individually. Data aggregates can be arrays, structures, unions, arrays of structures or unions, structures or unions of arrays, and combinations thereof, providing a very rich foundation for the description and manipulation of any conceivable data.

For example, if an array of structures were used to hold meteorological data for each month of the 20th and the 21st centuries, it might be declared as follows:

Declare 1 Year(1901:2100), 3 Month(12), 5 Temperature, 7 High decimal fixed(4,1), 7 Low decimal fixed(4,1), 5 Wind&us.velocity, 7 High decimal fixed(3), 7 Low decimal fixed(3), 5 Precipitation, 7 Total decimal fixed(3,1), 7 Average decimal fixed(3,1), 3 * char(0); The weather data for July 1991 is contained in the element Year(1991,7) of the array of structures Year. Portions of this data can be referred to by Temperature(1991,7) or Precipitation(1991,7).

Data manipulation

Data may be manipulated as individual items or as an aggregate. For example, one invocation of the SQRT built-in function can take the square root of an entire 15-dimensional array, producing an identical array containing square root values in the corresponding elements.

Built-in functions

PL/I provides almost 200 built-in functions, pseudovariables, and subroutines that manipulate scalar and aggregate data. These functions cover:

Storage classes, control, and dynamic storage allocation

Four different storage classes: AUTOMATIC, STATIC, CONTROLLED, and BASED are provided.. Application objects' data type, representation, nature of use, etc. normally dictates the type of storage class used for each. Programmers can dynamically allocate and free based and controlled storage.

For all storage classes, data may be automatically initialized when it is allocated.

Condition handling

PL/I provides facilities to handle a variety of conditions that can arise during PL/I program execution. These conditions may be expected or unexpected and may be detected by the hardware (e.g ZERODIVIDE) or detected by PL/I (e.g. CONVERSION) or the operating system or other software. Using these facilities, you can indeed write applications in PL/I that can provide non-stop operations. No one comes close!

You can even handle user initiated attention interrupts and normal and abnormal program termination.

Program checkout

Conditions can be enabled in a variety of ways to have your program automatically diagnosed for

Input and Output

PL/I programs have the capability to process various sizes and type of records, access various devices, edit and validate various kinds of input and output data, and easily produce report files. Two types of I/O are provided:

While most mundane operations, such as file opening and closing, are automatically handled by PL/I, many capabilities are provided to allow the PL/I program to have precise control over I/O operations, file opening, closing, and status, and exceptional conditions. I/O condition handling features include:

Macro Facility

The macro facility permits conditional compilation and modification of PL/I source before the compilation. For example, a programmer might include specific code during development and testing, and exclude it from a production program.

PL/I was way ahead of its time when it was introduced in 1964. As you can see, it still is! Other languages still cannot grasp some of its concepts.

Copyright (c) by IBM. Reproduced courtesy of IBM.

For a formatted version on the www, visit the original at: What is PL/I? While you're here, why not also take a look at: About PL/I.