PL/I

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search
PL/I
Paradigm procedural, imperative, structured
Appeared in 1964
Designed by IBM and the SHARE Language Development Committee
Developer IBM
Dialects PL/M, XPL, PL/P, PL/C, PL/S, PL/AS, PL/X, PL/8, EPL
Influenced by COBOL, Fortran, ALGOL
Influenced SP/k, B, REXX

PL/I ("Programming Language One", pronounced /ˌpiːˌɛlˈwʌn/, PEE-EL-WUN) is a procedural, imperative computer programming language designed for scientific, engineering, business and systems programming applications. It has been used by various academic, commercial and industrial users since it was introduced in the early 1960s, and is actively used as of 2010.[1][2][3]

PL/I's principal domain is data processing; it supports numerical computation, scientific computing,recursion, structured programming, linked data structure handling, character string handling, and bit string handling. The language syntax is English-like and suited for describing complex data formats, with a wide set of functions available to verify and manipulate them.

Contents

Early history

In the 1950's and early 1960s business and scientific users programmed for different computer hardware using different programming languages. Business users were moving from Autocoders via COMTRAN to COBOL, while scientific users programmed in FORTRAN. The IBM System 360 [4] (announced in 1964) was designed as a common machine architecture for both groups of user, superseding all existing IBM architectures. Similarly, IBM wanted a single programming language for all users. It hoped that FORTRAN could be extended to include the features needed by commercial programmers. In October 1963 a committee was formed [5] composed originally of 3 IBMers from New York and 3 members of SHARE, the IBM scientific users group, to propose these extensions to FORTRAN. Given the constraints of Fortran, they were unable to do this and embarked on the design of a “new programming language” labeled “NPL". This acronym conflicted with that of the UK’s National Physical Laboratory and was replaced briefly by MPPL[6] and, in 1965, with PL/I (with a Roman “I” like Fortran’s “IV”). The first definition appeared in April 1964[7],[8].

IBM took NPL as a starting point and completed the design to a level that the first compiler could be written: the NPL definition was incomplete in scope and in detail. Control[9] of the PL/I language was vested initially in the New York Programming Center and later at the IBM UK Laboratory at Hursley. The SHARE and GUIDE user groups were involved in extending the language and had a role in IBM’s process for controlling the language through their PL/I Projects. The experience of defining such a large language showed the need for a formal definition of PL/I. A project was set up in 1967 in IBM Vienna to make an unambiguous and complete specification [10]. This led in turn to one of the first large scale Formal Methods for development, VDM.

The language was first specified in detail in the manual “PL/I Language Specifications. C28-6571” written in New York from 1965 and superseded by “PL/I Language Specifications. GY33-6OO3” written in Hursley from 1967. IBM continued to develop PL/I in the late sixties and early seventies, publishing it in the GY33-6OO3 manual. These manuals were used by the Multics group and other early implementers.

The first compiler was delivered in 1966. The Standard for PL/I was approved in 1976.

Goals and principles

The Share 3by3 committee set these goals for “NPL”:

  • “Scope of usefulness to include that of current FORTRAN, extended to include additional applications - character strings and bit strings, extensive I/O operations, and dynamic response to trap conditions such as overflow and end-of-file.”
  • “Clarity of language. Arbitrary restrictions and unnatural punctuation that had plagued FORTAN users were to be removed. The resulting language would be easier to teach and easier to use.”
  • “Bring the language in line with current practice of machine use - I/O control systems, trap (i.e. exception) supervision, monitored operation and multiprogramming”. (This was not endorsed by other implementers, since their operating systems differed from IBM in these facilities)

These goals evolved during the early development of the language. Competitiveness with COBOL’s record handling and report writing capabilities was needed. The “scope of usefulness” of the language grew to include system programming and event-driven programming. The additional goals [11] for PL/I were:

  • Be Compilable, with run-time performance similar to Fortran IV
  • Be Extensible, for new hardware and new application areas
  • Improve the productivity and time scales of the programming process, transferring effort from the programmer to the compiler
  • Be machine-independent, and operate effectively across the main hardware and operating system ranges

To meet these goals PL/I borrowed ideas from other current languages while adding substantial new capabilities and casting it with a distinctive concise and readable syntax. A number of principles and capabilities combined to give the language its character and were key in meeting the goals:

  • Block structure, with underlying semantics (including recursion), a la Algol 60. PL/I passes the Don Knuth man or boy test. Arguments to be passed using call by reference, using dummy variables for values where needed (call by value).
  • Wide range of computational Data Types, program control Data Types, and forms of Data Structure. (strong typing).
  • Dynamic extents for arrays and strings, with inheritance of extents by procedure parameters.
  • Concise syntax for expressions, declarations and statements - with permitted abbreviations. Suitable for a character set of 60 glyphs, and sub-settable to 48.
  • An extensive structure of defaults in statements, options, and declarations - to hide some complexities, facilitate extending the language, and minimize keystrokes.
  • Powerful iterative processing (see For loop), with good support for structured programming.
  • No reserved words. New attributes, statements and statement options could be added to PL/I without invalidating existing programs.
  • Orthogonality - each capability to be independent of other capabilities and freely combined with other capabilities wherever meaningful. Each capability to be available in all contexts where meaningful - to exploit it as widely as possible and to avoid “arbitrary restrictions”. (Helps make the language "large").
  • Capabilities for controlling and intercepting exceptional conditions(exception handling) at run time.
  • Programs divided into separately compilable sections, with extensive compile-time facilities (a.k.a macros, not part of the standard, for tailoring and combining sections of source code into complete programs. External names to bind separately compiled procedures into a single program.
  • Debugging facilities integrated into the main language.

These principles inevitably resulted in a large language and would need compilers substantially more complex than those for COBOL or FORTRAN. This was not seen as a drawback since though the few - the compiler writers - would have more work, the many - the programmers - would have less.

Language summary

In this era of special purpose languages, e.g. SGML, C++, etc. it is difficult to conceive of a language designed to be all things to all programmers, but, as this summary shows, that is what PL/I was designed to be. The summary is extracted from ANSI PL/I Standard[12].

A Pl/I program consists of a set of procedures, each of which is written as a sequence of statements. The %INCLUDE construct is used to include text from other sources during program translation. All of the statement types are summarized here in groupings which give an overview of the language (the Standard uses this organization.)

Category of Statement
Structural PROCEDURE or PROC ENTRY BEGIN
DO END
Declarative DECLARE or DCL DEFAULT or DFT FORMAT
Flow of Control CALL IF GO TO
Null statement STOP
Statements for interrupt handling ON REVERT SIGNAL
Storage ALLOCATE or ALLOC FREE Assignment Statement
Input/Output OPEN CLOSE
Stream Input/Output GET PUT
Record Input/Output READ WRITE REWRITE
LOCATE DELETE

(Features such as multi-tasking and the Pl/I compile-time preprocessor not in the Standard but supported in the PL/I F compiler and some other implementations are discussed in the Language evolution section.)

Names may be declared to represent data of the following types, either as single values, or as aggregates in the form of arrays, with a lower-bound and upper-bound per dimension, or structures (comprising nested structure, array and scalar variables):

  • Arithmetic (expanded below)
  • CHARACTER
  • PICTURE for Arithmetic data
  • PICTURE for Character data
  • AREA
  • BIT
  • ENTRY
  • FILE
  • FORMAT
  • LABEL
  • OFFSET
  • POINTER

The arithmetic type comprises these attributes:

  • a base (BINARY or DECIMAL), and </code>
  • a scale (FIXED or FLOAT), and</code>
  • a mode (REAL or COMPLEX), and </code>
  • a PRECISION (number of digits, and for fixed point numbers, a scale factor)

The base, scale, precision and scale factor of the Picture-for-arithmetic type is encoded within the picture-specification. The mode is specified separately, with the picture specification applied to both the real and the imaginary parts.

Values are computed by expressions written using a specific set of operations and builtin functions, most of which may be applied to aggregates as well as to single values, together with user-defined procedures which, likewise, may operate on and return aggregate as well as single values. The assignment statement assigns values to one or more variables.

There are no reserved words in PL/I. A statement is terminated by a semi-colon. The maximum length of a statement is implementation defined. A comment may appear anywhere in a program where a space is permitted and is preceded by the characters forward slash, asterisk and is terminated by the characters asterisk, forward slash.
/*This is a comment. */
Statements may have a label-prefix introducing an entry name (ENTRY and PROCEDURE statements) or label name, and a condition prefix enabling or disabling a computational condition - e.g (NOSIZE)). Entry and label names may be single identifiers or identifiers followed by a subscript list of constants (as in L(12,2):A=0;).

A sequence of statements becomes a group when preceded by a DO statement and followed by an END statement. Groups may include nested groups and begin blocks. The IF statement specifies a group or a single statement as the THEN part and the ELSE part (see the sample program). The group is the unit of iteration - see For loop. The begin block (BEGIN; stmt-list END;) may contain declarations for names and internal procedures local to the block. A procedure starts with a PROCEDURE statement and is terminated syntactically by an END statement. The body of a procedure is a sequence of blocks, groups, and statements and contains declarations for names and procedures local() to the procedure or EXTERNAL to the procedure.

An on-unit is a single statement or block of statements written to be executed when one or more of these conditions occur:
a computational condition,

  • CONVERSION (CONV)
  • FIXEDOVERFLOW (FOFL)
  • OVERFLOW (OFL)
  • SIZE
  • STRINGRANGE (STRG)
  • STRINGSIZE (STRZ)
  • SUBSCRIPTRANGE (SUBRG)
  • UNDERFLOW (UFL)
  • ZERODIVIDE (ZDIV)

or an Input/Output condition,

  • ENDFILE(file)
  • ENDPAGE(file)
  • KEY(file)
  • NAME(file)
  • RECORD(file)
  • TRANSMIT(file)
  • UNDEFINEDFILE(file) (UNDF)

or one of the conditions:

  • AREA, CONDITION(identifier), <code>ERROR, FINISH

A declaration of an identifier may contain one or more of the following attributes (but they need to be mutually consistent):

Data Attributes Input/Output Attributes Other Attributes
ALIGNED DIRECT AUTOMATIC or AUTO
AREA[( area-size)] ENVIRONMENT(options) or ENV... BASED[(reference)
BINARY [(precision)] or BIN... INPUT BUILTIN
BIT [(maximum-length)] KEYED CONDITION or COND
CHARACTER[(maximum-length)] or CHAR... OUTPUT CONSTANT
COMPLEX [(precision)] or CPLX... PRINT CONTROLLED or CTL
DECIMAL [(precision)] or DEC... SEQUENTIAL or SEQL DEFINED[( reference)] or DEF...
(dimension-attribute) STREAM EXTERNAL or EXT
ENTRY[(parameter descriptor list] UPDATE GENERIC(criteria list)
FILE RECORD INITIAL(value-list) or INIT...
FIXED [(precision)]</code> INTERNAL or INT
FLOAT [(number of digits)] LIKE unsubscripted reference
FORMAT LOCAL
LABEL OPTIONS(options)
MEMBER PARAMETER or PARM
NONVARYING or NONVAR POSITION [(expression)] or POS...
OFFSET[(reference)] STATIC
PICTURE picture-specification or PIC... VARIABLE
POINTER or PTR
</code>
STRUCTURE
UNALIGNED or UNAL
VARYING or VAR

Standardization

Language standardization began in April 1966 in Europe with ECMA TC10. In 1969 ANSI established a "Composite Language Development Committee", nicknamed "Kludge", which fortunately was renamed X3J1 PL/I [13]. Standardization became a joint effort of ECMA TC/10 and ANSI X3J1. A subset of the GY33-6OO3 [14] document was offered to the joint effort by IBM and became the base document for standardization. The major feature omitted from the base document were multi tasking and the features for program optimization (e.g. NORMAL and ABNORMAL).

Proposals to change the base document were voted upon by both committees. In the event that the committees disagreed, the chairs, initially Michael Marcotty of General Motors and C.A.R. Hoare representing ICL had to resolve the disagreement. In addition to IBM - Honeywell, CDC, Data General, Digital Equipment, Prime Computer, Burroughs, RCA, and Univac served on X3J1 along with major users, Eastman Kodak, MITRE, Union Carbide, Bell Laboratories, and various government and university representatives. Further development of the language occurred in the standards bodies, with continuing improvements in structured programming and internal consistency, and with the omission of the more obscure or contentious features.

As language development neared an end, X3J1/TC10 realized that there were a number of problems with a document written in English text. Discussion of a single item might appear in multiple places which might or might not agree. It was difficult to determine if there were omissions as well as inconsistencies. Consequently, David Beech (IBM), Robert Freiburghouse (Honeywell), Milton Barber (CDC), M. Donald MacLaren (Argonne Nat'l Laboratory), Barry Folsom (Data General), Lois Frampton (Digital Equipment), and editor, D.J. Andrews of IBM undertook to rewrite the entire document, each producing one or more complete chapters. The standard is couched as a formal definition [15] using a "PL/I Machine" [16] to specify the semantics. It was the first, and possibly the only, programming language standard to be written as a semi-formal definition.

A "PL/I General-Purpose Subset" standard was issued by ANSI in 1987 [17]. The General Purpose subset was widely adopted as the kernel for PL/I implementations.

Implementations

IBM PL/I F and D compilers

PL/I was first implemented by IBM, at its Hursley Laboratories in the United Kingdom, as part of the development of System/360. The first production PL/I compiler was the PL/I F Compiler for the OS/360 Operating System, built at the Hursley in the UK. Release 1 shipped in 1966. OS/360 was a real-memory environment and the compiler was designed for systems with as little as 64kBytes of real storage – F being 64k in S/360 parlance. To fit a large compiler into the 44kByte memory allowed on a 64kByte machine, the compiler consisted of a control phase and a large number of compiler phases (approaching 100). The phases were brought into memory from disk, and released, one at a time to handle particular language features and aspects of compilation.

Aspects of the language were still being designed as PL/I F was implemented, so some were missed out until later releases. PL/I RECORD I/O was shipped with PL/I F Release 2. The list processing functions[18] - Based Variables, Pointers, Areas and Offsets and LOCATE-mode I/O - were first shipped in Release 4. In a major attempt to speed up PL/I code to compete with Fortran object code, PL/I F Release 5 did substantial program optimization of DO-loops facilitated by the REORDER option on procedures.

A version of PL/I F was released on the TSS/360 timesharing operating system for the S/360 Model 67, adapted at the IBM Mohansic Lab. The IBM Nordic Lab developed “Language Conversion Programs” to convert Fortran, Cobol, and Algol programs to the PL/I F level of PL/I. The PL/I D compiler, using 16 kilobytes of memory, was developed by IBM Germany for the DOS/360 low end operating system. It implemented a subset of the PL/I language requiring all strings and arrays to have fixed extents, thus simplifying the run-time environment.It was shipped within a year of PL/I F.

Multics PL/I and derivatives

Compilers were implemented by several groups in the early 1960s. The Multics project at MIT, one of the first to develop an operating system in a high level language, used Early PL/I (EPL), a subset dialect of PL/I, as their implementation language in 1964. EPL was developed at Bell Labs and MIT by Douglas McIlroy, Robert Morris, and others. The influential Multics PL/I compiler, described on the "Multicians" website [[2]], was the source of compiler technology used by a number of manufacturers and software groups.

It is claimed (Ref please) that the Honeywell PL/I compiler (for Series 60?) was an implementation of the full ANSI X3J1 standard. Stratus Technologies PL/I was an ANSI G implementation

IBM PL/I optimizer and checkout compilers

The PL/I Optimizer and Checkout compilers produced in Hursley supported a common level of PL/I language[19] and aimed to replace the PL/I F compiler. The performance objectives set for the compilers are shown in an IBM presentation to the BCS [20].

The PL/I Optimizing compiler took over from the PL/I F compiler and was IBM’s workhorse compiler from the 1970s to the 1990s. Like PL/IF, it was a multiple pass compiler with a 44kByte design point, but it was an entirely new design. A second-time around design, it succeeded in eliminating the annoyances of PL/I F such as cascading diagnostics [21]. It was written in S/360 Macro Assembler. Macros were defined to automate common compiler services and to shield the compiler writers from the task of managing real-mode storage - allowing the compiler to me moved easily to other memory models. The gamut of program optimization techniques developed for the contemporary IBM FORTRAN H compiler were deployed: the Optimizer equaled FORTRAN execution speeds in the hands of good programmers. Announced with the IBM S/370 in 1970, it shipped first for the DOS/360 operating system in Aug 1971, and shortly afterward for OS/360, and the first virtual memory IBM operating systems OS/VS1 and MVS and VM/CMS. It supported the batch programming environments and, under TSO and CMS, it could be run interactively. This compiler went through many versions covering all mainframe operating systems including the operating systems of the Japanese PCMs.

The PL/I Checkout compiler [22], [23] announced in August 1970 was designed to speed and improve the debugging of PL/I programs. The three-pass design cut the time to compile a program to 25% of that taken by the F Compiler. It was run from an interactive terminal, converting PL/I programs into an internal format, “H-text”. This format was interpreted by the Checkout compiler at run-time, detecting virtually all types of errors. Pointers were represented in 16 bytes, containing the target address and a description of the referenced item, thus permitting "bad" pointer use to be diagnosed. In a conversational environment when an error was detected, control was passed to the user who could inspect any variables, introduce debugging statements and edit the source program. Over time the debugging capability of mainframe programming environments developed most of the functions offered by this compiler and it was withdrawn (in the 1990s?)

DEC PL/I

Perhaps the most commercially successful implementation outside of IBM's was Digital Equipment's 1988 release of the ANSI PL/I 1987 subset. The implementation, whose front end was designed by Robert Freiburghouse, has a code generator implemented by Dave Cutler, who managed the design and implementation of VAX/VMS. It runs on VMS on VAX and ALPHA and on ALPHA UNIX. It is currently(2010) supported by Kednos Corporation [24].

Other PL/I subset implementations

  • In 1972 Gary Kildall implemented a subset "PL/M" for Intel. PL/M, was used to write the CP/M operating system proper - and much application software running on CP/M and MP/M. Digital Research sold a PL/I compiler[25] for the Personal Computer written in PL/M. PL/M was used to write much other software at Intel for the 8080, 8085, and Z-80 processors during the 1970s.
  • In 1974 Burroughs Corporation announced PL/I for the B7700. UNIVAC released a UNIVAC PL/I, and in the 1970s also used a variant of PL/I, PL/I PLUS, for systems programming. In 1980 Data General provided PL/I on its Transaction Processing Monitoring System (is the ECLIPSE?). CDC delivered PL/I for Cyber 70, 170 and 6000 series.
  • IBM delivered PL/I for OS/2[26] (1980s).
  • Micro Focus, formerly Liant, implement Open PL/I [27] for UNIX systems.
  • IBM shipped a PL/I subset for the Series/1 process control computer. It was originally designed in the Boeblingen Lab as a subset optimizing compiler for a new S/370 low end operating system.
  • A subset of PL/P, was used to write new portions of Prime Computer PRIMOS at all rings of protection in its later revisions.
  • PLAGO, created at the Polytechnic Institute of Brooklyn, used a simplified subset of the PL/I language and focused on good diagnostic error messages and fast compile times.
  • PL/8 (or PL.8), so-called because it was about 80% of PL/I,[28] was a simplified variant of PL/I, having fewer data types and much more limited input/output. A version was used on IBM mainframes as a development tool for software that was being designed for the AS/400, as well as to write the S/390 microcode.

PL/I dialect implementations

  • PL/S, a dialect of PL/I, initially called BSL was developed in the late 1960s and became the IBM systems programming language. Almost all IBM mainframe system software in the 1970s and 1980s was written in PL/S. It differed from PL/I in that there were no data type conversions, no run-time environment, structures were mapped differently, and assignment was a byte by byte move. All strings and arrays had fixed extents, or used the REFER option. IBM uses an improved and renamed PL/S for internal work on current operating systems, OS/390 and now z/OS.
  • A subset compiler named CORC, developed at Cornell University for teaching a dialect called PL/C, had the unusual capability of never failing to compile any program, through the use of extensive automatic correction of many syntax errors and by converting any remaining syntax errors to output statements.
  • XPL is a dialect of PL/I targeted at the development of aerospace applications. HAL/S is a real-time aerospace programming language, written in XPL, best known for its use in the Space Shuttle program. It was designed by Intermetrics in the 1970s for NASA.
  • IBM and various subcontractors also developed another variant in the early 1970s to support signal processing for the Navy called SPL/1.

Usage

PL/I implementations were developed for mainframes from the late 1960s, mini computers in the 1970s, and Personal Computers [29]in the 1980s and 1990s. Although its main use has been on mainframes, there are PL/I versions for DOS, Microsoft Windows, OS/2, AIX, OpenVMS, and Unix.

It has been widely used in business data processing [30] and for system use for authoring operating systems on certain platforms. Very complex and powerful systems have been built with PL/I:

  • The SAS System was initially written in PL/I; the SAS data step is still modeled on PL/I syntax.
  • The pioneering online airline reservation system Sabre, primarily written in IBM 7090 assembler, later used PL/I and a custom compiler for some high-level tasks.
  • PL/I was used to write a formal definition

[31]to interpret IBM's System Network Architecture


PL/I did not fulfill its supporters' hopes that it would displace FORTRAN and COBOL and become the major player on mainframes. It remained a minority but significant player. There cannot be a definitive explanation for this, but some trends in the 1970s and 1980s militated against its success by progressively reducing he territory on which PL/I enjoyed a competitive advantage.

  • First, the nature of the mainframe software environment changed. Application subsystems for Data Base and Transaction processing (CICS and IMS and Oracle on System 370) and application generators became the focus of mainframe users' application development. Significant parts of the language became irrelevant because of the need to use the corresponding native features of the subsystems (such as tasking and much of input/output). FORTRAN was not used in these application areas, confining PL/I to COBOL’s territory; most users stayed with COBOL. But as the PC became the dominant environment for program development FORTRAN, COBOL and PL/I all became minority languages overtaken by C++, Java and the like.
  • Second, PL/I was overtaken in the Systems Programming field. The IBM system programming community was not ready to use PL/I; instead, IBM developed and adopted a proprietary dialect of PL/I for system programming. – PL/S[32]. With the success of PL/S inside IBM, and of C outside IBM, the unique PL/I strengths for system programming became less valuable.
  • Third, the development environments grew capabilities for interactive software development that, again, made the unique PL/I interactive and debugging strengths less valuable.
  • Fourth, COBOL and FORTRAN added features such as structured programming, character string operations, and object orientation, that further reduced PL/I's relative advantages.

On mainframes there were substantial business issues at stake too:

  • IBM’s hardware competitors had little to gain and much to lose from success of PL/I. Compiler development was expensive, and the IBM compiler groups had an in-built competitive advantage.
  • Many IBM users wished to avoid being locked into proprietary solutions. With no early support for PL/I by other vendors it was best to avoid PL/I.

Evolution of the PL/I language

This article uses the PL/I standard as the reference point for language features. But a number of features of significance in the early implementations were not in the Standard; and some were offered by non-IBM compilers. And the de facto language continued to grow after the standard, ultimately driven by developments on the Personal Computer.

Significant features omitted from the Standard

Multi tasking was implemented by PL/I F, the Optimizer and the newer AIX and Z/OS compilers. It comprised the data types EVENT and TASK, the TASK-option on the CALL-statement (Fork), the WAIT-statement (JOIN), the DELAY(delay-time), EVENT-options on the record I/O statements and the UNLOCK statement to unlock locked records on EXCLUSIVE files. Event data identify a particular event and indicate whether it is complete ('1'B) or incomplete ('0'B): task data items identify a particular task (or process)and indicate its priority relative to other tasks.

The Compile time preprocessor was built by the IBM Programming Center in Cambridge, Mass, and shipped first in the PL/I F compiler. Elements of the language were supported by other groups. The %INCLUDE] statement was in the Standard, but the rest of the features were not. The preprocessor treats the written source program as a sequence of tokens, copying them to an output source file or acting on them. When a % token is encountered the compile time statement is executed, and when an identifier token is encountered and the identifier has been DECLAREd, ACTIVATEd, and assigned a compile time value, the identifier is replaced by this value. Tokens are added to the output stream if they do not require action (e.g. +), as are the values of ACTIVATEd compile time expressions. Thus a compile time variable PI could be declared, activated, and assigned using %PI='3.14159265'. Subsequent occurrences of PI would be replaced by 3.14159265.

The data type supported are FIXED DECIMAL integers and CHARACTER strings of varying length with no maximum length. The structure statements are

  • %[label-list:]DO iteration: statements; %[label-list:]END;
  • %procedure-name: PROCEDURE (parameter list) RETURNS (type); statements...;* <code>%[label-list:]END;
  •  %[label-list:]IF...%THEN...%ELSE..

and the simple statements, which also may have a [label-list:]

  •  %ACTIVATE(identifier-list) and %DEACTIVATE
  • assignment statement
  •  %DECLARE identifier-attribute-list
  •  %GO TO label
  •  %INCLUDE
  • null statement

The feature allowed programmers to use identifiers for constants - e.g product part numbers or mathematical constants - and was superseded in the standard by named constants for computational data. Conditional compiling and iterative generation of souce code, possible with compile-time facilities, was not supported by the standard. Several manufacturers implemented these facilities.

Structured programming additions were made to PL/I during standardization but were not accepted into the standard. These features were the LEAVE-statement to exit from an iterative DO, the UNTIL-option and REPEAT-option added to DO, and a case statement of the general form: SELECT (expression) {WHEN (expression) group}... OTHERWISE group

It is believed these were implemented in several non-IBM compilers (citation?).

PL/I F had offered some debug facilities that were not put forward for the standard but were implemented by others - notably the CHECK(variable-list) condition prefix, CHECK on-condition and the SNAP option. The Optimizer and Checker added additional features appropriate to the conversational mainframe programming environment (e.g. an ATTENTION condition) that may have been copied.

Significant features developed since the Standard

(This subsection needs help)

Several attempts had been made to design a structure member type that could have one of several datatypes (CELL in early IBM). With the growth of classes in programming theory, approaches to this became possible on a PL/I base - UNION, TYPE etc have been added by several compilers.

PL/I had been conceived in a single byte character world. With support for Japanese and Chinese language becoming essential, and the developments on International Code Pages, the character string concept was expanded to accommodate wide non-ASCII/EBCDIC strings.

TIME and DATE handling were overhauled to deal with the millenium problem.

Criticisms

Implementation Issues

In the discussions on this Article, these issues were raised:

  • Though the language was easy to learn and use, implementing a PL/I compiler was difficult and time-consuming.
  • A language as large as PL/I needed subsets that most vendors could produce and most users master. This did not happen until "ANSI G" was published.
  • Some argued that PL/I was unusually hard to parse [33], a problem solved by later compilers.
  • The compile time facilities, unique to PL/I, took added implementation effort and additional compiler passes.
  • It has been claimed that a PL/I compiler was two to four times as large as comparable Fortran or COBOL compilers, and also that much slower - fortunately offset by gains in programmer productivity.
  • The effort needed to produce good object code was perhaps underestimated during the initial design of the language. Program optimization (needed to compete with the excellent program optimization carried out by available Fortran compilers), was unusually complex due to side effects and pervasive problems with aliasing of variables. Unpredictable modification can occur asynchronously for ABNORMAL data, or in exception handlers, which may be provided by "ON statements" in (unseen) callers. Together, these make it difficult to reliably predict when many of the program's variables might be modified at runtime.
  • It contained many rarely used features, such as multitasking support, which added cost and complexity to the compiler, and its co-processing facilities required a multi-programming environment with support for non-blocking multiple threads for processes by the operating system.

Programmer Issues

In the discussions on this Article, these issues were raised:

  • Many programmers were slow to move from COBOL or Fortran due to a perceived complexity of the language and immaturity of the PL/I F compiler.
  • Programmers were sharply divided into scientific programmers (who used Fortran) and business programmers (who used COBOL), with significant tension and even dislike between the groups. PL/I syntax borrowed from both COBOL and Fortran syntax. So instead of noticing features that would make their job easier, Fortran programmers of the time noticed COBOL syntax and had the opinion that it was a business language, while COBOL programmers noticed FORTRAN syntax and looked on it as a scientific language.
  • Both COBOL and FORTRAN programmers viewed it as a "bigger" version of their own language, and both were somewhat intimidated by the language and disinclined to adopt it.
  • Another factor was pseudo-similarities to COBOL, FORTRAN, and ALGOL. These were PL/I syntax statements that looked similar to one of those languages, but worked differently in PL/I. Such frustrations left many experienced programmers with a jaundiced view of PL/I, and often an active dislike for the language.
  • On the positive side, full support for pointers to all data types (including pointers to structures), recursion, multi tasking, string handling, and extensive built-in functions PL/I was indeed quite a leap forward compared to the programming languages of its time. However, these were not enough to convince a majority of programmers or shops to switch to PL/I.
  • The PL/I F compiler's compile time preprocessor was unusual, perhaps unique, in using its target language's syntax and semantics (e.g. as compared to the C preprocessor's "#" directives).


Special Topics in PL/I

Variable names

The PL/I language has no reserved words - which allows a new keyword to be added without invalidating older programs that used the keyword as the name of a variable. Not even simple keywords such as DO, IF, ELSE and THEN are reserved, therefore they can be used as variable names. Given that the same symbol ('=') is used both for checking equality of variables and for assignment, the following extreme statements are valid:

DECLARE IF, THEN, ELSE ;/* DONT TRY THIS AT HOME*/
IF IF = THEN THEN THEN = ELSE; ELSE ELSE = IF;

Some existing compiler implementations, however, choose not to support this feature of the language, which simplifies the lexical analysis phase of compilation.

Storage classes

PL/I provides several 'storage classes' to indicate how the lifetime of variables' storage is to be managed, called: 'AUTOMATIC', 'STATIC', 'CONTROLLED' and 'BASED'. The simplest of these is 'STATIC', which indicates that memory is allocated and initialized at load-time, as is done in COBOL "working-storage" and FORTRAN IV. But this is not the default in PL/I. PL/I's default storage class for variables is AUTOMATIC, similar to that of other block-structured languages influenced by ALGOL, like the "auto" storage class in the C language, and default storage allocation in Pascal and "local-storage" in IBM COBOL. Storage for 'AUTOMATIC' variables is allocated upon entry into a 'BEGIN' block, procedure, or "on block". The compiler and runtime system allocate memory for a stack frame to contain them and other housekeeping information. If a variable is declared with an 'INIT' specification, then the machine code generated to set it to an initial value is executed at this time. Care is required to manage the use of initialization properly. Large amounts of code can be executed to initialize variables every time a scope is entered, especially if the variable is an array or structure. Since 'AUTOMATIC' variables values' are not retained after block exit, other storage classes like 'STATIC', 'CONTROLLED' or 'BASED' are used to retain variables' contents between invocations of a procedure. 'CONTROLLED' storage is managed on a stack, like that of 'AUTOMATIC', but the pushing and popping of allocations on the stack is explicitly managed by the programmer, using 'ALLOCATE' and 'FREE' statements. Storage for 'BASED' variables is managed similarly, but instead of a stack, these allocations have independent lifetimes and are addressed through 'OFFSET' or 'POINTER' variables.


Sample programs

Hello world program

Hello2: proc options(main);
     put list ('Hello, world!');
end Hello2;

Search for a string

/* Read in a line, which contains a string,
/* and then print every subsequent line that contains that string. */

find_strings: procedure options (main);
   declare pattern character (100) varying;
   declare line    character (100) varying;
   declare (line_no, end_file) fixed binary;

   end_file = 0;
   on endfile (sysin) end_file = 1;

   get edit (pattern) (L);
   line_no = 1;
   do while (end_file = 0);
      get edit (line) (L);
      if index(line, pattern) > 0 then
         put skip list (line_no, line);
      line_no = line_no + 1;
   end;

end find_strings;

Notes

  1. PL/I Resources. http://members.dodo.com.au/robin51/resource.htm,
  2. Kednos PL/I for HP OpenVMS VAX and Alpha http://www.kednos.com/,
  3. PL/I for IBM mainframe, Linux on zSeries and Windows. http://www-01.ibm.com/software/awdtools/pli/
  4. IBM's 360 and Early 370 Systems, Emerson W. Pugh, Lyle R Johnson, John H Palmer, MIT Press, 1991
  5. The committee actually had 8 members at the time the report was released. They were:
    • Hans Berg, Lockheed Burbank
    • George Radin, IBM
    • James Cox, Union Carbide
    • Bruce Rosenblatt, Standard Oil of California
    • Douglas McIlroy, Bell Laboratories
    • Robert Sheppard, Proctor & Gamble
    • C.W. Medlock, IBM
    • Bernice Weitzenhoffer, IBM.
  6. "MultiPurpose Programming Language"
  7. Report II of the SHARE Advanced Language Development Committee, June 25, 1964
  8. Highlights of a New Programming Language, G.Radin and Y.Paul Rogaway CACM V8 No 1, Jan 1965
  9. Control of the language was vested in a dedicated Language Control group and a Language Control Board that included representatives of the compiler groups (6 by 1973) in three countries. Daily communication was by telex. Changes and extensions were made through a Language Log that reached several thousand detailed points. A management level Language Review Board resolved issues escalated to it by the Control Board.
  10. The Universal Language Document (ULD). Technical reports TR25.081, TR25.082, TR25.083, TR25.0S4, TR25.085, TR25.086 and TR25.087, IBM Corp Vienna Austria June 1968
  11. IBM's 360 and Early 370 Systems, Emerson W. Pugh, Lyle R Johnson, John H Palmer, MIT Press, 1991
  12. ANS Programming Language PL/I. X3.53-1976,
  13. Reacting to IBM's involvement, a number of manufacturers had been reluctant to endorse an effort on a Standard. The initial remit of CLDG/X3J1 was to investigate whether PL/I was a suitable candidate for standardization. The joint effort processed over 3500 proposals for language or textual changes.
  14. “PL/I Language Specifications. GY33-6OO3”
  15. ANS Programming Language PL/I. X3.53-1976,
  16. The PL/I machine defined in the standard is covered in The Definition Mechanism for Standard PL/I. Michael Marcotty, Frederick G Sayward. http://www.cs.yale.edu/publications/techreports/tr75.pdf.
  17. ANSI X3.74-1987 (R1998) Information Systems - Programming Language - PL/I General-Purpose Subset
  18. These were designed in 1966 for an early Optimizing compiler, written in PL/I and to be bootstrapped starting with the PL/I F compiler
  19. OS PL/I Checkout and Optimizing Compilers: Language Reference Manual. GC33-0009 1970
  20. A.M.Krasun. The first 35+ years of Hursley software 1958-1993 with some hardware asides. BCS, The Chartered Institute for IT, Advanced Programming Specialist Group. October 2006 http://www.bcs.org/server.php?show=conWebDoc.16684
  21. For an entertaining description, see "My First PL/I Program" by Jim Horning. http://horningtales.blogspot.com/2006/10/my-first-pli-program.html]]
  22. A Conversational Compiler for Full PL/I R.N.Cuff The Computer Journal.1972; 15: 99-104
  23. The design of a checkout compiler, B.L.Marks, IBM Systems Journal Volume 12, Number 3, Page 315 (1973)
  24. http://www.kednos.com/
  25. THE NORTON CHRONICLES PETER NORTON, PC MAGAZINE MAY 15, 1984 http://members.dodo.com.au/~robin51/norton.htm This article is enthusiastic towards PL/I
  26. IBM PL/I for OS/2 http://portal.acm.org/citation.cfm?id=227717.227724
  27. Micro Focus Open PL/I
  28. Cocke, John; Markstein, V. (January 1990). "The evolution of RISC technology at IBM" (PDF). IBM Journal of Research & Development (IBM) 34 (1): 4–11. http://www.research.ibm.com/journal/rd/341/ibmrd3401C.pdf. Retrieved 2008-03-06. 
  29. THE NORTON CHRONICLES PETER NORTON, PC MAGAZINE MAY 15, 1984 http://members.dodo.com.au/~robin51/norton.htm. This article is enthusiastic towards PL/I
  30. The Artcle http://www.highbeam.com/doc/1G1-17813799.html about Liant (now Micro Focus) Open PL/I estimated that in 1995 20% of mainframe legacy applications were in PL/I, with 60% in COBOL: there were 300,000 PL/I programmers worldwide.
  31. Schultz, G.; D.Rose, C.West, J.Gray, (April 1980). "Executable description and validation of SNA". IEEE Xplorer. http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1094695. 
  32. In his slides on IBM Operating System/360 Fred Brooks says OS/360 should have been written in PL/I not PL/S and Assembler. The article is a great summary of the OS/360 program. http://www.de.capgemini-sdm.com/download/sdm-konf2001/d_4_brooks.pdf 2001.
  33. The compiler (and human readers) had no way of telling whether a statement was a declaration or an executable statement until encountering the ending semicolon, which could be several lines later.(This has been disputed). * The PL/I keywords were not reserved; programmers could use them as variable or procedure names in programs. Thus each time the compiler encountered a keyword, it had to determine if it was being used as a language keyword or as a name. Because the PL/I F compiler attempted auto-correction, when it encountered a keyword used in an incorrect context, it often assumed it was a variable name. This led to "cascading diagnostics" [1])

References

Textbooks

  • Barnes, R.A. (1979). PL/I for Programmers. North-Holland. 
  • Hughes, J.K. (1986). PL/I Structured Programming (3rd ed.). Wiley. ISBN 0-8053-0051-1. 
  • Groner, G.F. (1971). PL/I Programming in Technological Applications. Books on Demand, Ann Arbor, MI. 
  • Anderson, M.E. (1973). PL/I for Programmers. Prentice-Hall. 
  • Stoutemyer, D.R. (1971). PL/I Programming for Engineering & Science. Prentice-Hall. 
  • Ziegler, R.R. & C. (1986). PL/I: Structured Programming and Problem Solving (1st ed.). West. ISBN 0-314-93915-6. 
  • Sturm, E. (2009). The New PL/I ... for PC, Workstation and Mainframe. Vieweg-Teubner, Wiesbaden, Germany. ISBN 978-3-8348-0726-7. 
  • Vowels, R.A.. Introduction to PL/I, Algorithms, and Structured Programming (3rd ed.). ISBN ISBN 0-9596384-9-0. 

Standards

  • ANSI ANSI X3.53-1976 (R1998) Information Systems - Programming Language - PL/I
  • ANSI ANSI X3.74-1987 (R1998) Information Systems - Programming Language - PL/I General-Purpose Subset
  • ECMA 50 Programming Language PL/1, 1st edition, December 1976
  • ISO 6160:1979 Programming languages -- PL/1
  • ISO/IEC 6522:1992 Information technology -- Programming languages -- PL/1 general purpose subset


See also

External links

Personal tools

Served in 0.861 secs.