Pliprogrammingla 00 Abra
Pliprogrammingla 00 Abra
Computing Laboratory
U.S.
Department
of Energy
The
PL/I
Programming Language
Paul
Abrahams
Research .\uc\ Development Re|X)rt Prepared under Contract EY-76-C-02-3077 with the Office of Energy Research
cVk\
Computing
UNCLASSIFIED
Courant Mathematics and Computing Laboratory
New York University
COO-3077-151
Paul Abrahams
March 1978
U.
S.
Department of Energy
Contract EY-76-C-02-3077
UNCLASSIFIED
This report
is to appear as an article
on the PL/I
11
TABLE OF CONTENTS
Page
1 6
9
9
Arithmetic Types String Types Pictured Types Pointers Areas and Offsets Files Labels Entries Formats Arrays Structures
,
11 13 19 20 22 23 24 25 26 29
DECLARATIONS
Manifest, Explicit, Contextual and Implicit Declarations Declarations of Statement-Names Attribute Consistency and Completeness Standard and User Defined Defaults The LIKE-Attribute
29 31
32 38 41
43
Prefix and Infix Expressions Builtin Functions Type Conversion Promotion The Assignment-Statement
STORAGE TYPES
Static Storage Automatic Storage Controlled Storage Based Storage The Refer-Option Lef t-to-Right Correspondence Allocation in Areas Parameter Storage Defined Storage Alignment Initialization
45 51 64 68 69
72
72 73 73 74 77 79 80 81 82 84 86
111
88
90 91
93
94
95
96
99
100
102
10 5 10 8 109 110
115
115 116 119 121 122
Conditional Statements The DO-Statement The GOTO-Statement The STOP-Statement and the Null-Statement
FILES AND RECORD INPUT-OUTPUT
File Attributes File Opening and Attribute Determination File Closing Operations on Record Files
STREAM INPUT-OUTPUT
Data Lists List-Directed Input-Output Data-Directed Input-Output Edit-Directed Input-Output
BIBLIOGRAPHY
IV
INTRODUCTION
PL/I is a large and powerful multipurpose prograiraning
language.
a
developed in 196 3 by
For a
early 1970'
novel
manner as
The version of PL/I described in this article is Standard PL/I. The design of PL/I drew heavily on the major languages
that existed in 1963:
Fortran, Cobol
The
The notion of
block structure was taken from Algol 60, while PL/I structures
However, a
great many features were added to PL/I that have no counterpart in its ancestor languages. An example of a PL/I program is given in figure
1.
,
A which
GET_DIGRAM.
In addition,
outer procedure
PROCEDURE- statement
The variables used in this program are given in the
DECLARE-statements.
an identifier)
In general, a variable
Not all
defaulting rules.
The extensive defaulting conventions were included, for a large part, to make it possible to write programs without
In the
version of PL/I
tute.
Figure
/*
1.
THIS PROGRAM READS IN A TEXT AND COUNTS THE NUMBER OF TIMES THAT EACH ALPHABETIC DIGRAM OCCURS. A DIGRAM IS A SEQUENCE OF TWO ADJACENT CHARACTERS. FOR INSTANCE, THE DIGRAMS IN 'GRUNGE" ARE GR, RU UN, NG AND GE
, ,
*/
DIGRAMS: PROCEDURE OPTIONS (MAIN) DECLARE COUNT(26,26) FIXED(4); /* COUNT (I, J) GIVES THE CURRENT COUNT OF OCCURRENCES OF THE DIGRAM FORMED FROM THE I-TH LETTER AND THE J-TH LETTER.
'
/*
DECLARE ALPH CHARACTER (26 INITIAL 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ); DECLARE (P1,P2) FIXED; /* ALPHABETIC POSITION OF LETTER */ DECLARE (L1,L2) CHARACTER 1 /* FIRST AND SECOND LETTERS OF DIGRAM */ DECLARE DONE BIT(l) INITIAL (' B) /* COMPLETION FLAG */
) (
'
COUNT =
RDLOOP:
0;
DO WHILE ('I'B); /* DO FOREVER */ CALL GET_DIGRAM(L1,L2,D0NE) IF DONE THEN GO TO PRINT; PI = INDEX (ALPH, LI P2 = INDEX (ALPH, L2)
)
/*
P2
>
PRINT:
DO PI = 1 TO 26; DO P2 = 1 TO 26; IF COUNT (PI, P2)>0 THEN /* DIGRAM APPEARED */ PUT EDIT(SUBSTR(ALPH,P1,1) SUBSTR(ALPH,P2,1) COUNT (PI ,P2)
,
(SKIP,
A(l)
X(2)
F(4))
END;
END
STOP;
/* END EXECUTION OF PROGRAM */
Figure
/* /*
1.
Continued
INTERNAL PROCEDURE TO EXTRACT THE NEXT PAIR FROM THE INPUT TEXT
GET_DIGRAM: PROCEDURE (LI L2 FLAG) /* LETTER PAIR */ DECLARE (LI, L2) CHARACTER 1 /* END-OF-DATA INDICATOR */ DECLARE FLAG BIT(l); /* INPUT LINE IMAGE */ DECLARE CARD CHARACTER 80 DECLARE POSN FIXED STATIC INITIAL(80); /* CHARACTER POSITION IN INPUT CARD */ DECLARE SYS IN RECORD INPUT FILE; /* INPUT READ FROM FILE SYSIN */ /* WHEN INPUT EXHAUSTED */ ON ENDFILE (SYSIN) GO TO INPUT_FINISHED; IF POSN > 79 THEN DO /* READ A CARD */ INTO(CARD); READ FILE(SYSIN) POSN =1; /* PROCESS FROM START OF CARD */
, ,
(
)
END; LI = SUBSTR(CARD, POSN, 1); L2 = SUBSTR(CARD, POSN+1,1); /* MOVE TO NEXT PAIR */ POSN = POSN+1; /* EXIT FROM THIS PROCEDURE */ RETURN;
/*
INPUT_FINISHED:
FLAG = 'I'B; /* SIGNAL COMPLETION TO CALLER */ RETURN END GET_DIGRAM;
END DIGRAMS;
Syntactic Conventions
ON- statement
line
nondelimiter.
Delimiters
operator
period
comma
left or right parenthesis
Nondelimiters
identifier arithmetic constant
string constant
isub [discussed below]
colon
semicolon
text inclusion
Two adjacent nondelim.iters
between them, and other than that adjacent tokens may have
any number of blanks between them.
DO IVAL = Q TO (A +
3)
D0IVAL=QT0(A+3)
The last example is in fact a valid PL/I statement with an
/*"
"
not containing
followed by
"
*/"
e.g.,
/* THIS IS A COMMENT */
"_"
e.g.,
P0PE_LE0_THE_15TH.
%INCLUDE textname
implementation defined.
programmers
Keywords can be used as identifiers; in this respect PL/I differs from COBOL, which treats keywrods as reserved words,
7
For example,
IF IF THEN THEN = ELSE
;
CTL for
ALEPH:
PROCEDURE;
DO;
BEIT:
BEGIN;
END BEIT;
END ALEPH;
The final END statement closes out both the leading PROCEDURE
DATA TYPES
The different kinds of data in PL/I can be classified
The avail-
An
below.
and
constants
A constant associates a naime with a single unchanging
where
general time-dependent.
program by DECLARE-statements
e.g.,
However, a
Arithmetic Types
The printable types consist of the arithmetic types and
the string types.
(binary or decimal)
the scale
(fixed or float)
the mode
(real or complex)
and
the preoision.
mode are permitted, there are eight arithmetic types, precision aside.
The precision of a fixed type consists of a
;
(the
it
and floating
FIXED is
sequence
e.g., - 17.76
e.g.,
4.832E+12.
except that only binary digits are used, and the number is
followed by the letter
3
X
B,
e.g.,
10. IB or 11E16B
(designating
10
String Types
The string types are aharaoter and bit, each of which
in turn may be varying or nonvarying
.
length.
VARYING describes
to 14 characters, the default)
8
NONVARYING (NONVARYING is
exactly
bits long.
written as
' '
e.g.,
'lOlOOl'B;
''B.
Bit
notation.
For instance,
(octal)
111100000000
'
B)
while 'A81'B4
are particularly useful, as they are the results returned by the PL/I comparison operators;
'I'B represents true and
'O'B
represents false.
a constant,
so that the
e.g.
(*)
or
12
Pictured Types
The pictured types are derived from similar types in COBOL,
that type.
pictured type.
pictured type is
DECLARE SALARY PICTURE
'
$$$ $$$V $$
,
.
'
'(5)$'.
picture.
in addition to the
Character
and X.
the character
Character
declaration
(or
blanks)
followed by a
single
or X.
DECLARE RPIC REAL PICTURE 'ZZZ'; DECLARE CPIC COMPLEX PICTURE 'ZZZ';
RPIC has an associated arithmetic type of REAL FIXED DECIMAL
(3
,
0)
FIXED DECIMAL(3,
sarily decimal.)
0)
If the
its associated
When a
14
arithmetic type.
Editing by means of
picture is illustrated
will be +0034.80.
character.
The
I,
R,
single character.
Sign-overpunching
on a keypunch,
12-row for
+)
Although
CR and
Z,
+,
-,
the character
blanked out.
its
15
the picture.
The
S,
+,
or -
in this
character.
When a variable
to edit both the real and imaginary parts of any complex value
16
Table
(a)
1.
Character-picture symbols
A
9
X
(b)
Numeric-picture symbols
9
Y
Z $ *
+
S
CR
DB
I
R T
,
B /
V
E K
digit digit with zero mapped to blank digit with zero-suppression drifting or inserted dollar sign drifting asterisk (check protection) drifting or inserted sign for positive values drifting or inserted sign for negative values drifting or inserted sign for all values credit symbol, inserted for negative values debit symbol, inserted for negative values digit with positive value indicated by overpunch digit with negative value indicated by overpunch digit with sign always indicated by overpunch inserted period inserted comma inserted blank inserted slash implied decimal point start of exponent, E inserted start of exponent, nothing inserted
17
Table
Picture
2.
Pointers, Areas and Offsets The nonprintable types of data in PL/I are pointers, areas,
offsets, files,
labels, entries, and formats.
A pointer can
However, pointer
only pointer constant is the null pointer, which does not point at anything and therefore does not corpare equal to any
is obtained
discussed below.
An area is
a
based variables
can be allocated.
in a single operation,
(though
copy may
exist elsewhere)
allocated in it.
19
etc.), e.g.,
(
of a given area.
can be overridden),
e.g.,
A dataset,
in turn,
20
operations.
a
or to
Input-output operations
connected to
number of contexts,
declarations.
PUT LIST(A,B)
If no declaration is
the file
Labels
program at the time when the block containing the label was
entered.
The environment is necessary because the address by
has been carried out (see the section "Entry Values and Environ-
ments" below)
Label constants are declared by the appearance of a label
as a statement-name
,
as in
(J)
In fact,
label
appearance as statement-names.
attribute
LABEL, e.g.,
22
declaration
It is quite
Entries
An entry is an entry point to a procedure
(see
"Procedures,
An entry
treated as
datum.
For
PROCESS_NAME:
declares
and the
passed as an argument.
(*)
Formats
dataset
e.g.,
,
(M)
A)
format constants
Format variables
Arrays
Two types of aggregates are provided in PL/I: and struGtures
.
arrays
A structure, on
different types;
aggregates to be
value
An array is characterized by a sequence of dimensions;
the dimensionality of the array is the number of its dimensions.
Each dimension has a lower bound and an upper bound, and these
can be arbitrary integers. For example, the declaration
declares MESH to be
two-dimensional array.
script has lower bound -100 and upper bound 100, while the
The
can also
be used in
of an array.
(3 ,*
designates
one-dimais ional
Any number
*
'
Structures
A structure is a collection of named elements, each of
An example of a two-level
DECLARE 1 EMPLOYEE_RECORD,
2
NAME,
2 2
FIRST CHARACTER (10) VARYING, MIDDLE_INITIAL CHARACTER 1) LAST CHARACTER (15) VARYING, 3 ID_NUMBER FIXED DECIMAL(9), SALARY FIXED DECIMAL 7 2)
3 3
(
(
26
structure
levels are always consecutively numbered. The organization of a structured value is just like that
of a structured variable.
number
referred to using
EMPLOYEE_RECORD
(itself a structure)
EMPLOYEE_RECORD.NAME
(itself a structure)
EMPLOYEE_RECORD
D_NUMBER
EMPLOYEE_RECORD SALARY
.
one object.
An example of such
nested
DECLARE
1
CAR (30)
2
(20)
VARYING,
other from
DEALERS.
CITY(*,17) designates
28
DECLARATIONS
declarations,
i.e.,
man-i ;'-r
^
''
declared.
29
be ex-plioitly declared.
declaration exists for that identifier, then a default declaration is created if possible.
The default declaration is placed
If the
identifier is used in such a way as to suggest what its attributes should be, it is said to be contextually declared;
identifier OUT has not been manifestly declared and the state-
ment
PUT FILE (OUT) LIST(VALX,VALY)
appears, then OUT will be contextually declared with the attri-
BUILTIN.
contextual declarations.
An implicit declaration
is created for an identifier
In
; ,
Declarations of Statement-Names
The appearance of an identifier as a statement-name
identifier
LABEL and
CONSTANT.
acquires an appropriate
DIMENSION-attribute
The implied declaration
of
When the parameter types are known, the entry constant can be
characterized completely.
if any,
declaration.
12)
VARYING)
DECLARE FN ENTRY (CHARACTER (*), POINTER) RETURNS (CHARACTER (12) VARYING) CONSTANT;
31
If a rectangle
3.
4.
5.
must be chosen.
A set of attributes is complete and consistent if it can be
attribute set
INTERNAL VARIABLE AUTOMATIC ALIGNED POINTER INITIAL
Starting from the node "consistent-set", a scope and a declaration-type must both be chosen.
or EXTERNAL;
a variable,
INTERNAL is chosen.
a named-constant,
etc.; it is chosen to be a
variable.
In that case,
The
o'
03
-P
0)
0)
4-1
XI
>-l
H
-U -P
<
4-)
C
0)
4-1
rH
U
c
rO
C o
0)
4-1
Q)
i-H
3
H
^1
E-
X
-a
(U
c
H
C o
(1)
S' Si ^1
Q W w
'
Eh
0.1
z o M
El
(1)
c c o
4-)
u
(N
0)
Oi
I
a:
ui
lui
I I
a.
4J
I
H _< 4J
(13
c o
1-1
CJ
-U
E O o
is chosen to be AUTOMATIC.
need not, contain DIMENSION; in this case it does not contain DIMENSION.
The data-description must also contain an alignment,
INITIAL is present
.
The data-type is
chosen to be noncomputational
shown up by reference
AUTOMATIC EXTERNAL
and the combination
Specific
3.
while the
Table
3.
A.
Attribute CHARACTER BIT AREA DIMENSION RETURNS PRECISION PICTURE GENERIC ENTRY with CONSTANT POSITION DEFINED LIKE
B.
Required Specification
length length size of area dimensionality type of returned value number-of-digits, possible scale-factor picture specification generic specification parameter types position count base variable likened variable
37
string
These attribute
consistent.
the parameters
dure.
The descriptor
);
Although
predicate and
Since procedures can accept structures as arguments and can return structures as values, the specification of a single parameter or of a returned value can contain more than one descriptor.
38
(or descriptor)
Inconsistency, in
2.
attri-
assume NONVARYING.
4.
an implementation-
If POSITION is present
the default
This rule differs from the one used in the well-known IBM implementation of PL/I.
39
7.
If EXTERNAL is present,
STATIC;
8.
If
VARIABLE INTERNAL
Similar constants
and d
Unlike DECLARE-statements
dependent.
RANGE
(*)
This rule does not apply to structures. The alignment of a structure, if given explicitly, is passed down to all elementary members of the structure unless a conflicting alignment is given at a lower level.
40
letter between al
and a2 inclusive,
with init.
For instance,
(AB)
I
DEFAULT (RANGE
FLOAT
&
""BINARY)
COMPLEX STATIC;
applied to
DECLARE XYZ FLOAT BINARY;
since the predicate is not satisfied.
The LIKE-Attribute
It is useful when a
For instance,
41
; ;
DECLARE 1 ASSEMBLY BASED, 2 NEXT_PART POINTER, 2 FIRST_COMPONENT POINTER, 2 DESCRIPTION, PART_NUMBER PICTURE X(5)9', 3 COST FIXED DECIMAL 6 2) 3 DECLARE 1 GROUP (20) STATIC LIKE ASSEMBLY;
(
DECLARE 1 GROUP (20) STATIC, 2 NEXT_PART POINTER, 2 FIRST_COMPONENT POINTER, 2 DESCRIPTION, PART_NUMBER PICTURE 'X(5)9*, 3 3 COST FIXED DECIMAL 6 2
( , )
(20)
42
literal constants
parenthesized expressions
function calls
prefix expressions
infix expressions
References to
An example of
reference
an operator
operators.
and
*,
When an
is enclosed in parentheses,
treated as a single
43
than as a variable.
A function call has two parts: function and the argument list.
members of structures.
function call is
A,B(3)
In this case, A,B(3)
(I, 'NEXT'
)
(X)
in this case,
and
argument list.
Thus
NEXT_SUIT(
44
F(E)
of its descendants.
Those opera-
+
II
&
I
Table
45
Table
4.
Infix Operators
exponentiation
*
multiplication
division
addition
/ +
subtraction
concatenation
equal
not equal
<
>
less than
greater than
less than or equal
<=
>=
-<
->
not greater
Prefix Operators
minus
plus
not
46
When a sequence of adjacent operators, all of the same precedence, appears, the
A*B/C**D**E
is interpreted as
(A * B)
(C
**
(D
** E)
Prefix operators are always applied first unless they conflict with the ** operator; in that case the ** is applied first,
so that
-
A **
is interpreted as
-
(A **
3)
even though
-
is interpreted as
(-
A)
addition
subtraction
*
multiplication
division
**
exponentiation
the operands must
Base
Scale
otherwise fixed
Mode
The operands need not have the same precision, however. The
(and,
of the result.
1)
m = min (N,p+r+l)
n = q+s
m = N n = N-p+q-s
more complicated.
formula
x ** y is being
48
computed.
If either x or y is float,
m=
(p +
*
1)
*y-l
n = q
real.
In certain cases,
= "=
< >
equal
not equal
less than
greater than
less than or equal to
<=
>=
"<
">
"> and
""<
operators return
one-bit value:
if it is not.
'O'B
The meanings of
these operators
perform ordered comparisons of character strings is particularly useful in applications that involve sorting names.
the
comparison is done bit-by-bit from the left with the rule that
a
one-bit
has an arithmetic type, but one has a character type and the
50
strings together.
is the string
'AVERAGE'.
for comparisons)
and
""
not
"""'
is a prefix operator,
strings
Builtin Functions
PL/I includes a large variety of builtin functions. A list
of these,
together with
does,
is given in Table 5.
It is useful
in
of a string passed as
string.
z)
is used to extract a
portion of
string.
is the number of
characters to be extracted.
If
z^
is extracted. The
statements
DECLARE CHARS CH ARACTER
CHARS =
'
TOM JONES
'
SUBSTR(CHAR8,2,5) = 'IMHA';
the resulting value of CHARS is
'TIM HANES
'
A builtin function
(x,^;)
does not
occur at all within x, the value of INDEX is 0. For example: value of INDEX
('
('
SYNCOPATION
SYNCOPATION
'COP')
= =
value of INDEX
'
'COPE')
52
Table
5.
FUNCTIONS
In the descriptions
arguments
1.
ABS(.r)
If x is complex,
ACOS(a')
- the arc
,
cosine of x.
KDT){x,y ,p
{p,q)
(p)
\q])
with precision
and with precision
or
(r.O)
4. 5.
ADDR(.t)
AFTER (sa,ca)
does not
occur within sa
6.
ALLOCATION
(x)
ASIN(j:)
ATAN
(j/
[,.r]
if x is given,
and of
9.
1/
otherwise.
,
ATAND(!/[
J-]
given, and of
10.
otherwise.
x and
must be real.
ATANH{x)
53
Table
11.
5.
Continued
BEFORE (sa,ea)
If
ca does not
BINARY
(x
,p
,(7]
length
14.
le if
,
is given.
BOOL{x ,y oa)
X must be complex.
16.
CHARACTER (sa,
[Z-e
COLLATE
as a character string.
18.
19.
20.
y.
COPY(sa,Ze)
concatenated together.
21. 22.
COS(a;)
-
the cosine of x.
the cosine of x, with x given in degrees.
COSD(a:)
DATE
54
25.
occurrence
three pieces
are to be
DECIMAL
{x
,p
,^]
DIMENSION
(x, n)
DIVIDE
(x,i/ ,p
[,q])
if it is float.
DOT{x,y
,p
,q] ])
EMPTY
ERF(x)
32.
ERFC(x)
tion of X.
33.
EVERY(x)
the value
EXP(x)
of x.
.r
35.
to fixed,
,.
and,
if it is given,
precision
(p)
55
37.
FLOOR(x)
X must be real.
38.
HBOUND(a:,n)
the array x.
39.
highest character
40. 41.
IMAG(a:)
INDEX (sa,c?a)
The value is
if oa
LBOUND(x,n)
the array x.
43.
LENGTH (sa)
LINENO(/n)
44.
(within a page)
of
46.
LOGIO
(x)
x must
not be complex.
47.
of x.
x must not
48.
LOW(Ze)
string of
le
MAX(x ,x
of the X.
,x
the largest of
50.
MIN
(x-
,x_,
of the X.
51.
11
.
,x
MOD(x,iy)
complex.
56
52.
MULTIPLY(x,
z/,p [,(^1
precision
53. 54.
(p)
if it is float.
NULL{
pt to an offset within
55.
ONCHAR
within the
ONCODE
on-unit
57.
ONFIELD
encountered
ONFILE(
ONKEY
ONLOC
ONSOURCE
When the
CONVER-
PAGENO(/>i)
63.
64.
PRECISION (x,p
[,(?]
precision
(p)
(p/C?)
or
(p,0)
if X is float.
-
65.
66.
PROD(x)
RE7U1.
(x)
67.
REVERSE (sa)
ROUND (x,n)
of x.
If
a;
69.
or -1 according to whether x is
positive
70.
71.
zero
or negative
72.
73.
SQRT(x)
STRING (sa)
SUBSTR(sa, st
[ ,
Ze]
st-th one.
Table
5.
Continued
SUBTRACT(x,
i/,p
,(7]
with
and
precision
{^ ,q)
or
(p)
(p,0)
with precision
78. 79. 80.
if it is float.
SUM(x)
TAN(a:)
81. 82.
TANH
(x)
TIME
where
gives
TRANSLATE (sa,ra
sa,
[,
pa]
each character of pa
.
of ra
If pa is omitted,
sequence
84.
TRUNC(x)
85.
UNSPEC(x)
VALID(f3a)
86.
the value
otherwise
87.
VERIFY
(8a,r!a)
of the
ir
within oa
If all
'
the string x that is not a character of the string y. the characters of x appear in y
,
If all
0.
For example:
'ABCDE')
)
= 5
'ABCDE'
(x)
example:
'
POLLAG
(the "(
)"
is a function of no arguments)
The builtin function COPY(x,n) creates n copies of the string x. For example,
3)
'CHACHACHA'
groups.
MULTIPLY, and DIVIDE that behave like the corresponding infix operators, except that the precision of the result is explicitly
specified.
For example,
MULTIPLY (Ml M2
,
with
the
specified precision.
DECIMAL(M1,4,2)
For instance,
the mode of
(and yields
z/ )
CHARACTER
X, ^)
either by truncating on
BIT behaves
listed in Table 6.
can
x
than one
possible range for the result value, and the choice of principal
value is specified in the table.
The function ATAN (arctangent) two arguments. can accept either one or
to
+tt
Since
tt/2
radians,
the sign of
accepts an array as
similarly.
The builtin
function BOOLix ,y
y
z
z)
of length 4.
y
.
bit of X
bit of
result
2?^
^2
23
1 1
lb.
62
Table
6.
Mathematical Builtin
Functions
PL/I Name
Mathematical Description
absolute value
arc cosine
Complex Arguments?
yes
ABS ACON
ASIN
arc sine
arc tangent
(one argument)
ATAN
ATANp
arc tangent of quotient (two arguments) arc tangent in degrees (one argument)
ATAND,
ATANDATANH
COS
arguments)
hyperbolic arctangent
cosine cosine in degrees
COSD
COSH
ERF
hyperbolic cosine
error function
ERFC
EXP
LOG
L0G2
logarithm
LOGIO
SIN
base 10 logarithm
SIND
SINH
hyperbolic sine
square root
SQRT
TAN
tangent
TAND
TANH
tangent in degrees
hyperbolic tangent
VALID
(j:)
Invalid values
validity check
EVERY
(x)
returns 'I'B if
if necessary)
SOME
(x)
For example, if A is
>
an array of arithmetic type, then the expression A be an array with a one-bit in each position
i
will
>
where A{i)
0.
Type Conversion
In PL/I it is possible to convert from any printable
may be illegal.
64
appropriately
ed types,
value.
is
73000000E+01+0I
obtained by truncating
towards
0,
may produce
When converting
is added, while
dropped
The conversion between bit and character is straightforward;
specifically, the
CONVERSlON-condition
A character string is
number.
NUMV
the string
']6]62
']6]62.13E1]6'
.13E1\6'
Ordinarily that
VARYING;
to NUMV.
plus three.
possible sign,
zero.
66
string.
'OOllOO'B, with an
(10,4),
point may
their value.)
Conversion from
In this case,
and the
.;:^.i
67
Promotion
The PL/I operators, and many of the builtin functions
also, can be applied to aggregates as well as to scalars. When
DECLARE A
(3, 4)
FIXED BINARY
A = B + C;
the assignment to A is accomplished by adding B(l,l)
to C{1,1),
B(l,2)
to C(l,2), etc.,
dimensionality (3,4).
is actually needed,
the elements of B and C one by one and place the result directly
in A. It is
first the
structure.
given by the
to each element of
The Assignment-Statement
The assignment-statement contains a left side, which is
a
expression.
value.
sion and then storing its value, after appropriate conversion, into the location designated by each target, in order from left to right.
For instance,
A,
the assignment-statement
,
B(I)
C=l;
causes
The targets of
For instance,
the assignment-statement
SUBSTR(TEXT,I,LEN)
WORD;
Similarly,
IMAG(Z) = SIN(X)
is
left undisturbed.
Since the type of the value obtained from the right side
of an assignment-statement may
If the target is
necessary.
conversion is usually done before In actual practice, the rather than after the promotion. The result is the same.
70
DECLARE
1
2 2
BLUE;
RED. BLUE = VIOLET, BLUE; RED. GREEN. ORANGE = VIOLET GREEN .ORANGE; RED. BLACK = VIOLET .BLACK
.
ignored.
71
STORAGE TYPES
PL/I provides a variety of ways to manage the storage
of variables.
be either parameter
The parameter
controlled
and based.
The
Static Storage
The static storage class is the simplest one.
When a
in FORTRAN.
72
Automatic Storage
Storage for an automatic variable is allocated on entrance
to the block where the variable is declared, and freed on exit
fresh gener-
In practice it sometimes
rely upon.
When an automatic
a
recursive procedure,
new
generation is created for each level of recursion, and remains associated with the variable at that recursion level until
the recursion level is terminated. Automatic storage resembles
the ordinary local storage of Algol
Controlled Storage
ment.
new generation
and the current value of the variable is always obtained from the generation at the top of the stack.
In other words,
the
generations follow
last-in-first-out rule.
declaration of
The expressions are evaluated when a new generation is allocated, and so the different generations need not all have the same
sizes.
For example,
(N)
CONTROLLED;
will create a stack consisting of two generations. The generation at the top of the stack will have length
'SECONDjzJ'
7
and value
,
while
statements
FREE CONTV;
Based Storage
Based variables are useful in creating linked data structures, and also have applications in record input-output. A
based variable does not have any storage of its own; instead,
the declaration acts as a template and describes a generation
of storage.
In order to use the variable to refer to a
74
In many cases,
pointer is
DECLARE ARRAY_ELT BASED, 1 2 ARRAY (10) FLOAT, 2 NEXT_ELT POINTER; DECLARE AP POINTER;
containing
reference
->
ARRAY
programmer's responsibility.
If subsequently
the statement
meantime)
the
less
element is
pointer is needed, and that pointer is provided by the NULL builtin function.
It is convenient to have to write a pointer with every
based reference.
ALLOCATE BFIX;
is equivalent to
FREE BFIX;
is equivalent to
ADDR(y)
As an
yields
pointer to
DECLARE BCOMP FLOAT COMPLEX BASED; DECLARE SCOMP FLOAT COMPLEX STATIC;
ADDR(SCOMP) -> BCOMP = 2E0 + 3E0I;
The Refer-Option
The string lengths and array bounds of a based variable can be specified by expressions as well as by constants. For
(M)
BASED;
will have
If a
exist, it
itself; both the string and the length are stored in a single
For
DECLARE STRING_STRUC BASED (STP), 1 2 LEN FIXED, 2 NEXT POINTER, 2 STRING CHARACTER LEN 1 REFER(LEN)); DECLARE STP POINTER;
(
different length.
the elements do not all have the same type, as in the following
example:
DECLARE 1 FLOAT_ELEMENT BASED (ELPTR) 2 ELTYPE FIXED, /* 1 FOR FLOAT */ 2 NEXT POINTER, 2 VALUE FLOAT; DECLARE 1 FIXED_ELEMENT BASED (ELPTR) 2 ELTYPE FIXED, /* 2 FOR FIXED */ 2 NEXT POINTER, 2 VALUE FIXED;
DECLARE 1 CHAR_ELEMENT BASED (ELPTR) 2 ELTYPE FIXED, /* 3 FOR CHARACTER */ 2 NEXT POINTER, 2 VALUE CHARACTER (24
)
necessary to
The
Thus it is
permissible to use
Even if
ELPTR is pointing at
elements necessarily
Allocation in Areas
A based variable can be allocated in
as in the following example:
a
specified area,
ALLOCATE BV IN
(A)
OFFSET(P,A)
The allocation can assign a value directly to an offset
(A)
ALLOCATE BVl IN
(A)
Parameter Storage
A variable acquires the parameter storage type by virtue
of its appearance in a parameter list of either a PROCEDURE-
statement or an ENTRY-statement
describes procedure
81
Defined Storage
The defined storage type, like the
type, is an alias.
parameter storage
defining is excluded.
There are three kinds of defining:
simple-defining
aliases, they are not allocated nor freed, nor are initial
An example of simple-defining is
DECLARE A
(5, 8)
FIXED;
(A (1 ,*))
except that the array bounds of the defined variable may be more
82
; ;
For instance,
ADEF(8,6)
refers to A(9,8).
ISUB, ISUB)
(C
3*
lSUB-1) +2SUB)
array C.
different
83
DECLARE CS CHARACTER 30 DECLARE 0DEF1{3) CHARACTER (5) POSITION DECLARE 1 0DEF2 DEFINED (CS) 2 OCSl CHARACTER (14 2 0CS2 PICTURE '$$$V.$$'; /*
( ) )
(10)
DEFINED(CS);
CHARACTER POSITIONS*/
ODEF(l)
ODEFl
(2)
of characters
.
of characters 20-24 of CS
The
way round
Alignment
The declaration of a variable can specify an alignment
An unaligned
84
cs
1[
2| 3|
4|
5|
6|
7|
8|
9p.0[Iip.2(I3(14|15[16[I7tI8tL9|20|21[2 2[23t24^5|26l27l28|29|30
ODEFl(l)
(a)
0DEF1(2)
ODEFlO)
CS
1|
2|
3|
4|
5|
6|
7|
8|
9tL0tLliL2tL3p.4|I5[L6tL7tl8ll9|20l21^2|23|24|25|26^7l28l29|30
OCSl
(b)
0CS2
Figure
3.
Example of Overlay-Defining
85
In most situations,
defining.
Initialization
It is possible to specify an initialization for a vari-
0)
The initialization
5) 4
3)
(-1 -2
,
B to be initialized to the
4-1-2-1-2-1-2
array, initializations are performed
For a multidimensional
Thus
6
)
- 2 = 4 - 6
For automatic
Parameters
with the
INITIAL-attribute
87
at the end.
entry points
possibly empty.
F(X+3, INVALID'
'
indicated explicitly by
PROCEDURE (QVAL, SIZE) RETURNS (FLOAT BINARY) DECLARE QVAL FLOAT BINARY; DECLARE SIZE FIXED DECIMAL(4); DECLARE J FIXED BINARY; DECLARE TOTAL FLOAT BINARY INITIAL (0); DO J = 1 TO SIZE; TOTAL = TOTAL + F(QVAL,J);
END;
P3:
RETURN (TOTAL) ENTRY (RVAL, RES, SIZE) DECLARE RVAL FLOAT BINARY; DO J = 1 TO SIZE; RES = RES + F(RVAL,J);
END;
RETURN END PI
This procedure has three entry points.
(but do not compare equal)
,
point returns
PI and
i.e., as compon-
ents of an expression.
e.g., by
the entry points need not have the same parameters, and if any
invalid to reference
89
procedure. For
dure.
RETURN (expr)
or the form
RETURN
If the procedure is called by a function reference,
then the
Conversely, if
expression is converted to the type specified in the RETURNSclause of the entry point where the
procedure was
entered.
fication
e.g.,
RETURNS (CHARACTER
length.
90
Execution of a RETURN-statement not containing an expression ends execution of the procedure and causes control to
in front
of it,
sequence of
(possibly
subscripted or name-qualified)
(2)
and
assignments to the
In all
a dummy.
That
dummy -- is set aside for the argument, and the value of the
argument disagrees with the type of the parameter, the argument is converted to the parameter type and the converted value
is assigned to the dummy.
discarded.
Constants
CALLER
PROCEDURE;
/* DUMMY CREATED,
;
SO Y IS UNCHANGED
/* DUMMY CREATED */
(X.)
(X)
IS
AN EXPRESSSION */
PROCEDURE
(P)
/* P IS THE PARAMETER*/
END CALLEE;
CHARACTER
where
e
(*)
will match
is any expression-
VARYING.
Options
A particularly
universal one)
is illustrated by
program
In general,
the information
procedure is compiled.
When a PL/I procedure references
a
procedure written in
would describe
a
93
; ,
Recursion
number of
tree, or null.
COUNTNODES PROCEDURE (NODEPTR) RECURSIVE RETURNS (FIXED) DECLARE (LCOUNT,RCOUNT) FIXED INITIAL(O); DECLARE 1 NODE BASED (NODEPTR) 2 LEFT_SON POINTER, 2 RIGHT_SON POINTER, 2 VALUE FIXED; DECLARE NODEPTR POINTER; DECLARE NULL BUILTIN; IF LEFT_SON "= NULL THEN LCOUNT = COUNTNODES (LEFT_SON) IF RIGHT_SON "= NULL THEN RCOUNT = COUNTNODES (RIGHT_SON) RETURN (LCOUNT+RCOUNT+1) END COUNTNODES;
considered to be recursive.
94
The GENERIC-Attribute
GENERIC-attribute allows
function
,
translated into
An asterisk indicates a
the attribute
Only data
DECLARE GF GENERIC (Gl WHEN (FIXED, FIXED) G2 WHEN (FIXED, *) G3 WHEN (*)
)
95
GF(X,X+1)
The reference
translates to
G1(X,X+1)
GF(X,Y+1)
translates to
G2(X,Y+1)
The reference
translates to
G3(X)
two
arguments
(1
20
BINARY),
In this case,
nested.
A name declared in a
an
ation of the name, working from the inside out, and starting
Another way
Figure
4.
There is an
imaginary outer block used to hold the declarations of the entry points of the external procedure
(A
97
declared
Identifiers declared to be
other.
automatically declared.
99
names denote.
S:
T:
PROCEDURE PROCEDURE (R, LEVEL) RECURSIVE; DECLARE R ENTRY; DECLARE LEVEL FIXED; IF LEVEL=10 THEN CALL R( ELSE IF LEVEL=6 THEN CALL Q(S,7) ELSE CALL Q(R,LEVEL+1) PROCEDURE; PUT DATA (LEVEL) STOP END S; END Q; PROCEDURE; END T; CALL Q(T,1) END P; ^QQ
) ;
On each call,
by
as a place-holder.
recursion, the
sive call on Q.
entry value
is passed as
In particular,
since
is internal to Q,
the current
value of LEVEL
On subsequent recursive
(cf.
the call
obtained
at level 6, and so
LEVEL
In fact,
it is possible
101
the
so-called ON-conditions
Using an ON-statement
the programmer
to be executed.
That response is
be possible for the program to continue where it left off after the ON-unit is executed.
are listed in Table
7.
ON-units is:
P
:
PROCEDURE
ON ENDFILE(SYSIN) GO TO PROCESS; DO WHILE 'I'B) READ FILE (SYS IN)
(
END;
PROCESS:
END P;
102
c u 3
-H
O
t/3
(/)
U) Q)
WW
d)
<])
w
O C
(U
(U
>i
>,
>,
>,
>,
c u
(U Q>
o
e
<
In this case,
be executed.
The ON-Statement
REVERT-Statement
and SIGNAL-Statement
actually executed.
GO TO TOOBIG;
When execution of
collection
105
The ON-unit itself can be either a BEGIN -block (delimited by BEGIN and END) or a single unconditional statement. In
DO-group or an IF-
procedure.
In particular, ON-units
Thus
ON SUBSCRIPTRANGE SYSTEM;
SUBSCRIPTRANGE-condition is raised.
It
or other debugging
a
condition is
106
discussed below.
The REVERT-statement can be used to cancel the effect of
an ON-statement
,
causes the ON-unit for each of these conditions to revert to what it was in the previously-executing block.
sequence:
ON ENDFILE(SYSIN) CALL ENDER; BEGIN; ON ENDFILE(SYSIN) GO TO ALT_END;
Thus, in the
REVERT ENDFILE(SYSIN)
END;
CALL ENDER;
to again be associated with the ENDFILE-condition for the file
SYSIN.
condition.
SIGNAL ZERODIVIDE;
107
to be invoked.
at least)
P:
(NOOVERFLOW)
Q = A + BTR
END;
108
For that
consequences
The statement
ON UNDERFLOW;
the null-statement is to be
executed.
109
to particular
arguments
The ONCODE builtin function has as its value an imple-
mentation-defined integer used to indicate why the active ONcondition was raised.
raised by a
SIGNAL-statement
can be broken
They are:
110
CONVERSION FIXE DOVE RFLOW OVERFLOW SIZE STRINGRANGE STRINGSIZE SUBSCRIPTRANGE UNDERFLOW ZERODIVIDE
The occurrence of one of these conditions usually means that a
bad result has been generated, and so the active computation
cannot be continued.
there is no way to
somewhat differently.
When this condition is raised, the programmer can modify the character string to be converted.
If a normal return takes
completes without
transfer of control,
'
'
1
'
END;
If the string to be converted does not consist entirely of ones
and zeros,
treatment.
string
Upon
normal return from the ON-unit, the string is truncated on the right to the required length.
in this case is to do nothing,
However, it can be used in either of two ways. If it is disabled, then the compiler need not produce code to check for string
112
overflow.
condition
The second group of ON-conditions is the input-output
conditions.
ENDPAGE ENDFILE
KEY NAME RECORD TRANSMIT UNDEFINEDFILE
with input-output.
The remaining conditions are more varied. These are:
the allocation is
reattempted.
113
ON-
For instance, a
CALL OVERFLOW_RECOVERY
and then, in some other part of the program, write:
IF T
The STORAGE-condition is
Since programs
114
Conditional Statements
The conditional statement is used in
order to test a
specifying
INDEX = INDEX+1;
to be executed if the condition Q <= QMAX is true, and the
statement
GO TO PART_7
to be executed otherwise.
or ELSE can itself be a conditional statement, of conditional statements can be built up.
Moreover, either
115
ELSE- statement
ELSE is paired with the nearest preceding unpaired IF, working from front to back.
The
string.
unnecessary.
The DO-statement has three main variants: the simple DO, the DO-WHILE, and the specified DO. The simple DO is used in
116
; ;
DC-
Statement- sequence
END;
The DO-WHILE
matching END-statement
The state-
the test fails, control is transferred to the statement following the group.
If the expression is initially false,
the group
DO WHILE (CVAL>0)
DVAL=DVAL+G(CVAL) CVAL=CVAL-DVAL
END;
statement followed by
statement.
DO M =
In this case the
TO 100 BY 2;
on each execution
117
the value 100 on the last execution of the group. Upon comple-
However,
If the TO-clause is
a
If the BY-
value of
On each
keyword DO)
or less than
.
If the
termination test
is satisfied by the
118
or
DO STRING='' REPEAT (STRING
I I
CHARS
(I)
variable.
DO M = 3,7,M+2 BY
TO 15,0;
12,
15,
0.
specifies
not be.
For instance,
it could be a
subscripted reference to
an array of statement-names,
119
In other words,
at the moment when the GOTO-statement is executed, there will be a hierarchy of active blocks, with the current block last
in the hierarchy.
named by the label value. A GOTO-statement whose destination is not in the same
Therefore the programmer is allowed to declare the LOCALattribute for a label variable.
The LOCAL-attribute consti-
120
STOP
response to
specified ON-condition
121
attributes takes place when the file is opened, i.e., associated with
a
dataset.
several
attribute.
If it does,
A direct
way to
linemarks , pagemarks ,
122
sive lines
A pagemark is meaningful
dataset that is to be printed, and indicates that the following line is to be overprinted, i.e., printed without advancing
the carriage.
with it.
any attributes
found,
the UNDEFINEDFILE-
For
123
TABLE
8.
STREAM STREAM STREAM STREAM RECORD RECORD RECORD RECORD RECORD RECORD RECORD RECORD
Note:
INPUT FILE OUTPUT FILE OUTPUT PRINT FILE INPUT SEQUENTIAL FILE INPUT SEQUENTIAL KEYED FILE INPUT DIRECT KEYED FILE OUTPUT SEQUENTIAL FILE OUTPUT SEQUENTIAL KEYED FILE OUTPUT DIRECT KEYED FILE UPDATE SEQUENTIAL FILE UPDATE SEQUENTIAL KEYED FILE UPDATE DIRECT KEYED FILE
124
both
evaluates to
has a name
file constant.
system) and so the file opening has to specify the name of the
CHANGENAME = '04 37' OPEN FILE (CHANGES) TITLE (CHANGENAME) STREAM INPUT; OPEN FILE(OLDSET) RECORD INPUT DIRECT;
cause the file CHANGES to be associated with the dataset C4 37,
and cause the file OLDSET to be associated with the dataset OLDSET.
125
OPEN-statement
For instance,
)
TAB 10 40 70
(
,
understanding
and tabstops
For instance,
if the
statement
PUT FILE (ANS) (M,N)
is executed and the file ANS is not
open,
opened
the
126
File Closing
statement, e.g.,
A file can be close! and later reopened with different attributes An attempt to open a file that is already open, or to close a
file that is closed, has no effect.
applied to it.
9,
and the
127
Table
9.
READ
read
dataset dataset
REWRITE
replace
WRITE
LOCATE
DELETE
delete
Table 10.
FILE
INTO
being read
FROM
KEY
KEYFROM
KEYTO
IGNORE
SET
specifies where to put the key associated with a record being read
pointer to a newly
128
< Q 3
to
the
or editing.
mentation.
gram,
this is not too difficult. The READ- statement causes a single record to be read
either by an INTO-clause or by
SET-clause.
If the INTO-
130
advantages.
First,
Second, operat-
buffer avoids
statement
READ FILE (EMPL)
INTO (EMPLOYEE_RECORD) KEY (EMP_NUMBER)
to one.)
does
read is assigned to the variable specified in the KEYTO-clause. This facility is necessary since the
the record itself.
causes the next record from EMPL (which must be keyed sequential)
to be read into EMPLOYEE_RECORD,
131
The IGNORE-
update files.
the new record is written at its end; otherwise the position of the
specifies the
is keyed.
132
the statements
the
another LOCATE-statement or
for the file.
WRITE-statement is executed
If the KEY-clause
133
can only
then the
134
STREAM INPUT-OUTPUT
between
On output, the
direction.
For instance,
the value
4
format to be used.
stream
few
pathological
cases,
information is written by
reading from
135
If the FILE-clause is
(a
>
on an input file.
blank)
variable STR.
Line and page skips can be specified in the GET-statement
and the PUT- statement
,
file. For
PUT SKIP
causes two lines to be
(2)
LIST(A,B);
causes a
The statement
136
PUTLINE(2) LIST{A,B);
causes the printer to be positioned to the second line on the
page before A and B are printed; it differs from SKIP in that
it selects an absolute page position rather than a page posi-
Data Lists
A GET-statement or a
one or
scalars,
e.g.
PUT-statement.
The it6ms in
TO FNLIMIT)
GET LIST(
(N, (COST(K)
DO K =
TO N)
TO 40));
with MIX declared as above will print out the elements of MIX with the last subscript varying most rapidly (since this is the
implicit order in storage, as defined by the rules of PL/I).
List-Directed Input-Output
The GET LIST-statement reads an unformatted sequence of
that was read, it is possible to read items from the same line
in succession. The
then enough items are read from the dataset to fill the aggregate.
means of
statement
138
GET LIST(M1,M2,M3)
agree with the types of the items in the data list; if there
is any disagreement,
value
ISN'T
The PUT LIST-statement writes a sequence of items onto
the
Successive items
a
arc
-d
at
139
a new line is
tabstops.
TO 10));
lines
3 8
4
12
6
7
10
Data-Directed Input-Output
The GET DATA- statement reads a sequence of variable names
and associated values, e.g.,
A=3
or commas
(as
B=12
D=0;
ended by a semicolon.
GET DATA;
The second form is easier to use, but it has the disadvantage
140
compiled program.
given in the same order as the variables in the list. Moreover, variables in the data list can be repeated or omitted
in the input stream.
For instance,
'JOE', A (4,
7) =
'SAM',
ST.COUV = 19.3;
contain
list.
PUT DATA;
Otherwise, the
listed variables
Unlike the
the PUT-statement
the
tabstops.
tabstops,
141
DECLARE 1 AGG(3)
2
(RED, BLUE)
FIXED DECIMAL(2);
PUT DATA(AGG)
is to print out the
lines
AGG.RED(l) = 4 AGG.BLUE(2)= -5
AGG.BLUE(l) = = AGG.RED(3)
8 7
= AGG.RED(2) AGG.BLUE(3) =
1;
Edit-Directed Input-Output
Edit-directed input-output is accomplished through the
GET and PUT EDIT-statements
.
When an item in
stored
value.
GET EDIT
(I, J)
(F(4),F(3));
of the stream)
Similarly,
142
(2F(7,2));
]6]625.00]6]6\63.14
In this case,
the
in
There
data formats.
control
PUT EDIT
(E(9),SKIP);
list,
then
143
Table 12.
(1)
Format Types
Data Formats
A(u) B(w) Bl(u) B2(u) B3(w) B4 (u)
F(w,d,s)
E{w,d,s)
P pia
C(fl,fl)
alphanumeric with field width u (w can be omitted on output) bitstring with field length w (w can be omitted on output; 32 indicates base 4, 31 indicates base 2, B3 indicates base 8, and B4 indicates base 16) fixed with field width w, d digits to right of decimal point, scaling s {d and s are optional) float with field width u, d digits to right of decimal point in mantissa, s digits in mantissa (d and s are optional) pictured according to picture pia complex with real part formatted using fl, imaginary part formatted using f2 fl if f2 omttted) {fl assumed the same as
(2)
Control Formats
X(w)
COLUMN
(n)
blank or ignore field of width w continue reading or writing at column position skip n tabstops skip n lines position at nth line of printed page start new printed page
(3)
Remote Format
R(ref)
144
Table 13.
Table 14.
beginning.
For instance,
are not limited to constants; they can be arbitrary expressions, as in the format list
(
(M)E(14,11-K)
,A{L+1)
))
PUT EDIT(A(*,3))
(A(*,4))
(SKIP,10E(14,DECPT)
(SKIP,6E(14,DECPT)
field width,
implicitly.)
the
within
field are
For the
The behavior of output formats is shown in Table 14. The output formats have behavior inverse to the input formats
The rules are not entirely inverse, however, since the input
For instance, an
Another difference
is that on output,
the A- format
and the B-formats need not contain field widths, since a field
i.e.,
.
statement-name of a FORMAT-statement
FORMAT- statement
of the statements
GET EDIT(A,B,C)
FF:
(F
3)
R (FF)
F { 2)
FORMAT
(F( 5)
148
GET EDIT(A,B,C)
(F
3)
F 5)
(
F 2)
(
The same
149
BIBLIOGRAPHY
1.
National Standard
Beech, D.
Surveys
3.
33-64.
Beech, D.
and Marcotty, M.
SIGPLAN Notices
4.
Frieburghouse,
"PL/I Language
IBM Corporation,
1970.
150
This report was prepared as an account of Government sponsored work. Neither the United States, nor the Administration, nor any person acting on behalf of the Administration:
A.
Makes any warranty or representation, express or implied, with respect to the accuracy, completeness, or usefulness of the information contained in this report, or that the use of any information, apparatus, method, or process disclosed in this report may not infringe privately owned rights; or
B.
any liabilities with respect to of, or for damages resulting from of any information, apparatus, or process disclosed in this
As used in the above, "person acting on behalf of the Administration" Includes any employee or contractor of the Administration, or employee of such contractor, to the extent that such employee or contractor of the Administration, or employee of such contractor prepares, disseminates, or provides access to, any information pursuant to his employment or contract with the Administration, or his employment with such contractor.
151