Language Summary
The language is designed to be all things to all programmers. The summary is extracted from ANSI PL/I Standard. and the ANSI PL/I General-Purpose Subset Standard.
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 | Statement |
---|---|
Structural | PROCEDURE (or PROC )ENTRY BEGIN DO END |
Declarative | DECLARE (or DCL )DEFAULT (or DFT )FORMAT |
Flow of control | CALL IF SELECT GO TO RETURN STOP Null statement |
Interrupt handling | ON SIGNAL REVERT |
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 preprocessor are not in the Standard but are 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):
|
|
|
The arithmetic
type comprises these attributes:
|
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. 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,
|
|
|
or an Input/Output condition,
|
|
or one of the conditions:
AREA
,CONDITION(identifier),
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 |
ENVIRONMENT(options) or ENV... |
BASED[(reference) |
BINARY or BIN... |
INPUT |
BUILTIN |
BIT |
KEYED |
CONDITION or COND |
CHARACTER or CHAR... |
OUTPUT |
CONSTANT |
COMPLEX or CPLX... |
PRINT |
CONTROLLED or CTL |
DECIMAL or DEC... |
SEQUENTIAL or SEQL |
DEFINED or DEF... |
(dimension-attribute) |
STREAM |
EXTERNAL or EXT |
ENTRY |
UPDATE |
GENERIC(criteria list) |
FILE |
RECORD |
INITIAL(value-list) or INIT... |
FIXED |
INTERNAL or INT |
|
FLOAT |
LIKE unsubscripted reference |
|
FORMAT |
LOCAL |
|
LABEL |
OPTIONS(options) |
|
MEMBER |
PARAMETER or PARM |
|
NONVARYING or NONVAR |
POSITION or POS... |
|
OFFSET |
STATIC |
|
PICTURE picture-specification or PIC... |
VARIABLE |
|
POINTER or PTR |
||
STRUCTURE |
||
UNALIGNED or UNAL |
||
VARYING or VAR |
Current compilers from Kednos, Micro Focus, and particularly that from IBM implement many extensions over the standardized version of the language. The IBM extensions are summarised in the Implementation sub-section for the compiler later. Although there are some extensions common to these compilers the lack of a current standard means that compatibility is not guaranteed.
Read more about this topic: PL/I
Famous quotes containing the words language and/or summary:
“The language of Friendship is not words, but meanings. It is an intelligence above language.”
—Henry David Thoreau (18171862)
“I have simplified my politics into an utter detestation of all existing governments; and, as it is the shortest and most agreeable and summary feeling imaginable, the first moment of an universal republic would convert me into an advocate for single and uncontradicted despotism. The fact is, riches are power, and poverty is slavery all over the earth, and one sort of establishment is no better, nor worse, for a people than another.”
—George Gordon Noel Byron (17881824)