GC33-0009-4 PLI Checkout and Opt Compiler Lang Ref Oct76
GC33-0009-4 PLI Checkout and Opt Compiler Lang Ref Oct76
OS
PL/I Checkout and
Optimizing Compilers:
Program Product Language Reference Manual
This publication is planned for use as a Part II, "Rules and Syntactic
reference book by the PL/I programmer. It Descriptions," provides a quick reference
is not a tutorial publication, but is to specific intormation. It includes less
designed for the reader who already has a information about interrelationships, but
knowledge of the language and who requires i t is organized so that a particular
a source of reference material. question can be answered quickly. Part II
is organized purely from a reference point
The publication is in two parts. Part I of view; it is not intended for sequential
contains discussions of concepts of the reading.
language. Part II contains detailed rules
and syntactic descriptions.
For example, a programmer would read
Although implementation information is chapter 5, ·statement Classification" in
included, the book is not a complete Part I for information about the
description of any implementation interactions of different statements in a
environment. In general, it contains program; but he would look in section J,
information needed to write a program that "Statements" in Part II, to find all the
will be processed by the os PL/I Optimizing rules for the use of a specific statement,
Compiler or the as PL/I Checkout Compiler. its effect, options allowed, and the forma~
It does not contain all the information in which it is writ~en.
needed to execute programs. For further
information on executing a program refer to In the same manner, he would read
the appropriate programmer's guide (for chapter 4, "Expressions and Data
batch processing only) or the Time Sharing Conversions" in Part I for a discussion of
Option or CMS publications (for processing the concepts of data conversion, but he
in conversational mode). would use section F, "Data Conversion and
Expression Evaluation" in Part II, to
In order to execute programs processed determine the exact results of a particula~
by these compilers, subroutine libraries type of conversion.
are required. The subroutines are provided
by the OS PL/I resident library (optimizing An explanation of the syntax language
compiler only) and the OS PL/I transient used in this publication to describe
library (both compilers). elements of PL/I is contained in section A,
"Syntax Notation" in Part II.
Programs that have been compiled by the
PL/I Optimizing Compiler and which utilize
PL/I multitasking facilities can be
executed only under the MVT or VS2 version Requisite Publications
of the operating system.
iii
Recommended Publications Availability of Publications
iv
Contents
Contents v
BEGIN Statement • • • • • • • 53 Programmer-defin~d Defaults for
END Statement • • • • • • • • 53 Parameter Descriptors • • 85
FETCH and RELEASE Statements 53 Programmer-defined Default for
Storage Control Statements ••••• 53 the RETURNS Option 85
ALLOCATE and FREE Statements 53 Restrictions of the Use of the
Control statements 54 DEFAULT Statement • • • • • • • 85
GO TO Statement • • • • 54
IF Statement • • 54 CHAPTER 8: STORAGE CONTROL • • 87
SELECT Statement • 55 Static storage • • • • 87
DO Statement • • 55 Automatic Storage • • • • • 87
Noniterative DO Statements . 58 Effect of Recursion on Automatic
LEAVE Statement . • • • • • 58 Variables • • • • •• • • • • 88
CALL, RETURN, and END Statements • 59 Controlled storage • • • • • • 88
STOP and EXIT Statements • 59 ALLOCATE Statement for Controlled
HALT statement • • • • • • • 59 Variables • • • • • • 89
Exception Control Statements 59 FREE Statement for Controlled
ON Statement • • • • 59 Variables • • • • • • • • • • 89
REVERT Statement • • • • • • • • • 60 Implicit Freeing • • • • • • • • 90
SIGNAL statement • • 60 Multiple Generations of Controlled
Preprocessor Statements 60 Variables • • • • • 90
Listing Control statements 60 Asterisk Notation • • • • 90
Diagnostic Statements • . • 61 Controlled Structures 91
CHECK and NOCHECK statements • 61 ALLOCATION Built-in Function 91
FLOW and NOFLOW statements • 61 Based storage • • . • . • . . • • • • 91
PUT Statements • • • • • • • 61 Based Variables 91
Locator Qualification 91
CHAPTER 6: PROGRAM ORGANIZATION 63 Pointer Variables • • • • 92
Blocks • • • • 63 Pointer Expression • • • • • • • 92
Procedure Blocks • • • • • • 63 Setting Pointer Variables 92
Begin Blocks • • • • • • • • 63 ADDR Built-in Function • • • 93
Internal and External Blocks • 64 Based Variables and Input/output • 93
Use of the END Stat.ement • 64 READ with SET Statement • • • • 94
Activation of Blocks 65 LOCATE Statement • • • • • • • • 94
Termination of Blocks • . • 67 self-defining Data (REFER Option) 95
Begin Block Termination 67 List Processing • • • • 96
Procedure Termination 68 ALLOCATE Statement for Based
Program Termination 69 Variables • • • • • • • • • • 97
Dynamic Loading of External FREE Statement for Based Variables 97
Procedure • • • • • • • • • • • 69 Multiple Generations of Based
storage Allocation • • • • • • 70 Variables • • • • • • . • • • • • 97
Reactivation of an Active Procedure NULL Built-in Function • 98
(Recursion) ••••• 71 Types of List • • • • 98
prologues and Epilogues 72 Areas • • • • • . • . . • . • 98
Prologues 72 Area Variables • • 99
Epilogues • • • • • 73 Offset Variables • • • •• 99
Locator Conversion • • • • • 99
CHAPTER 7: RECOGNITION OF NAMES 75 Offset Expressions • • 100
Explicit Declaration • • • • • • • • 75 ALLOCATE Statement with the IN
Scope of an Explicit Declaration • 76 Option • • • • • • • 100
Contextual Declaration • • • • • • • 76 FREE statement with the IN
Scope of a Contextual Declaration 76 Option • • • • • • 101
Implicit Declaration • • • • • • • • 77 EMPTY Built-In Function • 101
Examples of Declarations • • • • 77 Area Assignment • • • • •• 101
INTERNAL and EXTERNAL Attributes 78 AREA ON-Condition •• 101
scope of Member Names of Input/output of Areas •••• 102
External Structures • • • • 80 Multiple Locator Qualification • • 102
Multiple Declarations and Ambiguous Levels of Locator Qualification 102
References • • • • • • • • • • 80
Default Attributes • • • • • • 81 CHAPTER 9: SUBROUTINES AND FUNCTIONS 105
Processes in the Application of Entry points of Subroutines and
Attributes • • • • • • • • 81 Functions • • • • • • • • • 106
Application of Standard Defaults • 81 ENTRY Attribute • • • • • • 106
Problem Data • • • • • 82 Exit-points of Subroutines and
Program Control Data • • • • • • 82 Functions • • • • • • • • • 106
Default statement • • • • • • • • • • 83 RETURNS Attribute and RETURNS
Restoring standard Defaults 84 Option • • • • • 106
Scope of the DEFAULT Statement • 84 Subroutines • • • • • • 107
Factored Default Specification • 85 Functions • • •• • • • • • • • • 108
Contents vii
Variable-length Records • 164 Direct Access • • • • • • • 190
Undefined-length Records • • 165 Regional(3) Organizatipn • • • • • 190
RECSIZE Option • • • • • • • 165 Dummy Records 190
BLKSIZE Option • • • • • • • 166 creating a Data set • • 190
Record Format Defaults • 167 sequential Access • 191
Buffer Allocation • 167 Direct Access • • • • • • • • • 191
BUFFERS Option • • • • • • 167 VSAM Organization • • • • • • • • 192
Data Set Organization • 168 Keys for VSAM data sets 192
CONSECUTIVE Data Sets • 168 Keys for Indexed VSAM Data Sets 192
INDEXED Data sets • 168 Relative Byte Addresses (RBA) • 192
REGIONAL Data Sets • • 168 Relative Record Numbers • 192
VSAM Data Sets • • • • 168 Entry-Sequenced Data Sets . • • • 193
PASSWORD Option • • • • • • • • • 169 Loading an ESDS • • • • • • 193
SKIP and SIS Options • • 169 Sequential Access • 193
BKWD Option • 170 Key-Sequenced Data sets • • 193
REUSE Option • • • • • • • • • • • 170 Loading a KSDS • • • • • 193
BUFND Option • • 170 sequential Access • • 193
BUFNI Option • • 170 Direct Access • • • • • 194
BUFSP Option • • • • • • • 170 Use of the SKIP option • 194
Optimization of Input/Output Use of the SIS option • • • 194
Operations • • • • • • • • • • • 1 70 SAMEKEY Built-In Function 194
Teleprocessing Data Sets • • • • 171 Relative Record Data Sets • • 194
Magnetic Tape Handling Options • • 171 Loading an RRDS • • 194
LEAVE and REREAD Options • 171 sequential Access . • • • 196
printer/punch Control Direct Access 199
(CTL360/CTLASA) • • • • • • • 172 Teleprocessing • • • • • • • 199
Data Interchange (COBOL) • • • 173 ENVIRONMENT Attribute 199
In-line Code Optimization (TOTAL) 174 TRANSIENT Attribute • • 202
Data Management Optimization Error Handling • • • • • • • • • 202
(INDEXAREA/NOWRIT /ADDBUFF) • • • 174 statements and Options • • • 203
Key Classification (GENKEY) • 174 Summary of Record-oriented
Number of Channel Programs lNCP) • 175 Transmission • • • • • • • • • • • • 204
Track Overflow (TRKOFL) • 175 Examples of Declarations for Record
Varying-length string Option Files • • • • • • • • • • • 205
(SCALARVARYING) • • • • • • • 175
Key Length Option (KEYLENGTH) 176 CHAPTER 13: EDITING AND STRING
Key Location Option (KEYLOC) • 176 HANDLING • • • • • • • • 207
DCB Subparameters • • • • • • • 176 Editing by ASSignment • • • • • 201
Device-associated Files (IBM 3525 Altering the Length of String Data 201
Card Punch) • • • • 176 Other Forms of ASSignment • • 208
ASCII Data Sets • • • • • • • 171 Input and output Operations 208
ASCII Option • • • • • • • • 171 STRING Option in GET and PUT
BUFOFF option and Block Prefix Statements • • • • • • • • • • 208
Fields • • • • • • • • • • • • 178 Picture Specification • • • • • • 209
D-format and DB-format Records • 178 Numeric Character Specifications 209
Default Rules • 178 Picture Character '9' in Numeric
Consecutive organization • 178 Character Specifications • • • 210
Sequential Update • 179 Picture Characters Z * . . . . . 210
Indexed Organization • 179 Picture Character V • • • • • • 211
Keys • • • • • • • Insertion Picture Characters B •
Embedded Keys
•
• • • • • •
179
180 , / ............ • • 211
Dummy Records • 183 Picture Character $ •• • • 211
Creating a Data set • 183 Sign SpeCification in Numeric
sequential Access • 183 Character Specifications • 212
Direct Access • • • • • 183 overpunched Sign Specification
Regional Organization • • 184 Characters, T I R • • • • • 212
Keys • • • • • • • • • 184 Other Numeric Character
Types of Regional organization • • 185 Facilities • • • • • • • • 212
Regional(l) Organization • • • • • 185 Character-String Picture
Dummy Records • • • • • • • • • 185 Specifications • 212
Creating a REGIONAL(l) Data set 185 Bit-string Handling • • • • • • • 213
sequential Access • 187 String Built-in Functions • • • • 214
Direct Access • • • • • 187
Regional(2) Organization • 188 CHAPTER 14: EXCEPTIONAL CONDITION
Source Keys • • • • • 188 HANDLING AND PROGRAM CHECKOUT • 217
Dummy Records • • • • • • 189 Enabled Conditions and Established
Creating a Data Set • 189 Action • • • • • • • • • • • 217
Sequential Access • 1.89 Condition Prefixes • • • • • • • 217
Contents ix
Environment • • • • • • • • • • 294 Tables for Comparison Operations •• 350
Interrupt Handling • • • • • • • 294
GO TO statement • • • • . 296 SECTION G: BUILT-IN FUNCTIONS AND
Termination of FORTRAN and COBOL PSEUDO VARIABLES • • • • • • . 353
Routines • • 296 Classification of Built-in
Multitasking • • • • 297 Functions • • • • • • • • 353
COBOL Interface 297 String-handling Built-in
FORTRAN Interface • 297 Functions • • • • • • • 353
Compile-Time Return Codes • 299 Arithmetic Built-In Functions • 353
Execution-Time Return Codes • 301 Mathematical Built-In Functions 353
Array-Handling Built-In
PART II: RULES AND SYNTACTIC Functions • • • • • • • • • 354
DESCRIPTIONS • •••• · 303 Condition-handling Built-In
Functions • • . • • • . • 354
SECTION A: SYNTAX NOTATION • 305 storage Control Built-In
FUnctions • • • • • • • • • 354
SECTION B: CHARACTER SETS WITH Multitasking Built-In Functions 354
EBCDIC AND CARD-PUNCH CODES • • • • 307 Input/Output Built-In Functions 354
60-character Set • 307 preprocessor Built-In Functions 354
48-character Set • • • • • • • • 308 Miscellaneous Built-in Functions 354
Conversion of Arguments • • 354
SECTION C: KEYWORDS AND KEYWORD String-handling Built-In
ABBREVIATIONS • • • • • • • • • 309 Functions • • • • • • • 355
Arithmetic Built-In Functions • 355
SECTION D: PICTURE SPECIFICATION Mathematical Built-In Functions 355
CHARACTERS • • • • • • • • • • • • • 315 Array-handling Built-In
Picture Characters for Character- Functions • • • • • • • • • 355
string Data • • • • • • • • • • • • 315 Accuracy of the Mathematical
Picture Characters for Numeric Functions • • • • • 355
Character Data • • • • • • • • • 316 Aggregate Arguments • • • • 356
Digit and Decimal-point Specifiers 317 Null Arguments • • • • • • • • 356
Zero suppression Characters • • • 317 Non-Preprocessor Built-in
Insertion Characters • • • • • • • 318 FUnctions • • • • • • • • • 356
Signs and Currency Symbol • 319 Preprocessor Built-in Functions 356
Credit, Debit, overpunched, and Pseudovariables • • • • 356
Zero Replacement Signs • • • 322
Exponent Specifiers • • • •• 324 SECTION H: ON-CONDITIONS. 383
scaling Factor • • • • • . 324 Condition Codes (ON-codes) 383
ERROR Condition Code • • • • • • 384
SECTION E: EDIT-DIRECTED FORMAT FINISH Condition Codes 384
ITEMS • • • • • · • • 325 ERROR Condition Code • • • • 384
Data Format Items • • 325 NAME Condition Codes • • 384
Control Format Items • 325 RECORD Condition Codes • 384
Remote Format Item • • • • • • 326 TRANSMIT Condition Codes • 384
Use of Format Items • • • 326 KEY Condition Codes • • • 384
Alphabetic List of Format Items • 326 ENDFILE Condition Code • • • • • 384
A-Format Item • • • • • • • • • 326 UNDEFINEDFILE Condition Codes • 384
B-Format Item • • • 326 ENDPAGE Condition Code • • • 385
C-Format Item • • • 327 PENDING Condition Code • • 385
COLUMN Format Item • • • 327 STRINGSIZE Condition Code • • • 385
E-Format Item • • • • • • • 328 OVERFLOW Condition Code • • • • 385
F-Format Item • 329 FIXEDOVERFLOW Condition Code • • 385
LINE Format Item • 330 ZERODIVIDE Condition Code • 385
P-Format Item • • • • • 330 UNDERFLOW Condition Code • • • • 385
PAGE Format Item • • • • 330 SIZE Condition Code 385
R-Format Item • • • • • • • 331 STRINGRANGE Condition Code • • • 386
SKIP Format Item • 331 AREA Condition Codes • • • 386
X~Format Item • • • • • 331 ATTENTION Condition Code • 386
Table of CEIL values 333 CONDITION Condition Code • • 386
CHECK Condition Codes • 386
SECTION F: DATA CONVERSION AND SUBSCRIPTRANGE Condition Code • 386
EXPRESSION EVALUATION • 335 CONVERSION Condition Codes • • • 386
Example of Use of the Conversion Multiple Interrupts • • • • • • • 391
Rules • 336 List of Conditions • • • • • • 392
Step 1 • • • 336 Classification of Conditions • • • • 392
Step 2 • • • 336
Step 3 • • 336 SECTION I: ATTRIBUTES • • 405
Tables for Arithmetic Operations • • 349 ALIGNED and UNALIGNED • 405
Contents xi
Example of structure Mapping • • • 489
Record Alignment • • • • • • • • 502
GLOSSARY • 511
INDEX • • 525
Figures xiii
Figure 19.2. COBOL-PL/I data built-in functions with extended-
equivalents • • • • • • • • • 298 preCision floating-point arguments • 363
Figure 19.3. Declaration of a data Figure H.1. Output for CHECK
aggregate in COBOL and PL/I • 298 condition • • • • • • • • • • • • • 395
Figure 19.4. FORTRAN-PL/I data Figure I.1. Classification of
equivalents • • • • • • • • • • 299 attributes according to data types • 406
Figure 19.5 (Part 1 of 2). Return Figure I.2. File declarations (files
codes produced by PL/I data types • 300 associated with non-VSAM data sets) 407
Figure 19.5 (Part 2 of 2). Return Figure I.3. Guide to types of
codes produced by PL/I data types • 301 defining • • • • • • • • • • •
Figure 0.1. Pictured character- Figure J.l. General formats of the
string examples • • • • • • 316 assignment statement • • . • . • 441
Figure 0.2. pictured numeric Figure J.2. General formats of the
character examples. • • • • • • 317 DEFAULT statement • • • • • • • 448
Figure 0.3. Examples of zero Figure J.3. General formats of the
suppression • • • • • • • • • • 319 DO statement • • • • • 452
Figure 0.4. Examples of insertion Figure J.4. Transfer and destination
characters • • • • • • • • • • • • • 320 statements • • • • • • • • • • 458
Figure 0.5. Examples of drifting Figure J.5. Format of option list
picture characters • • • • • • • • • 321 for READ statement • • • 470
Figure 0.6. Examples of CR, DB, T, Figure J.6. Effects of 'PAGE and
I, R, and Y picture characters • • • 323 ~SKIP ••• • • • • • • • • • 486
Figure 0.7. Examples of floating- Figure K.1 (Part 1 of 2). summary of
point picture specifications • • • . 323 alignment requirements for ALIGNED
Figure 0.8. Examples of scaling data • • • • • • • • • • • • • • • • 490
factor picture characters • • • • • 324 Figure K.l (Part 2 of 2). Summary of
Figure F.l. List of priority of alignment requirements for ALIGNED
operations and guide to conversion data • • • • • • • • • • • • • • • • 491
rules • • • • • • • • • • • • • • • 333 Figure K.2 (Part 1 of 2). Summary of
Figure F.2. Table of CEIL (n*3.32) alignment requirements for UNALIGNED
and CEIL (n/3.32) values • • • • • • 333 data • • • • • • • • • • • • • • • • 492
Figure F.3. Circumstances causing Figure K.2 (Part 2 of 2). Summary of
conversion • • • • • • • • • • • 333 alignment requirements for UNALIGNED
Figure F.4a. Master table for data • • • • • • • • • • • • • • 493
arithmetic operations • • • • • 349 Figure K.3. Mapping of minor
Figure F.4b. Key to conversions • • 349 structure G • • • • • • • • • 494
Figure F.4c. Result table for Figure K.4. Mapping of minor
ADDITION, SUBTRACTION, structure E • • • • • 495
MULTIPLICATION, and DIVISION • 349 Figure K.5. Mapping of minor
Figure F.4d. Result table for struct ure N • • • • • • • • • • 496
EXPONENTIATION • • • • • • • • • 349 Figure K.6. Mapping of minor
Figure F.5a. Master table for structure S • • • • • • • • • 497
comparison operations • • • • • 350 Figure K.7. Mapping of minor
Figure F.5b. Types of comparison struct ure C • • • • • • • • • 498
operation and targets • • • • • • • 351 Figure K.8. Mapping of minor
Figure G.l (Part 1 of 3). Performance structure M • • • • • 499
of the mathematical built-in Figure K.9. Mapping of major
functions with short and long structure A • • • • . • • . • 500
precision floating-point arguments • 358 Figure K.l0. Offsets in final
Figure G.l (part 2 of 3). Performance mapping of structure A • • • • • 501
of the mathematical built-in Figure K.11. Format of Structure S • 502
functions with short and long Figure K.12. Block created from
precision floating-point arguments . 359 structure s ............ 503
Figure G.l (part 3 of 3). Performance Figure K.13. Block created by
of the mathematical built-in structure S with correct alignment • 503
functions with short and long Figure K.14. Alignment of data in a
precision floating-point arguments • 360 buffer in locate mode input/output,
Figure G.2 (Part 1 of 3). for different formats and data set
performance of the mathematical organizations • • • • • • • • • • • 504
built-in functions with extended- Figure L.l. Differences resulting
precision floating-point arguments • 361 from differing compiler functions • 506
Figure G.2 (Part 2 of 3). Figure L.2 (Part 1 of 2). Differing
performance of the mathematical qualitative restrictions • • • • • • 507
built-in functions with extended- Figure L.2 (Part 2 of 2). Differing
precision floating-point arguments • 362 qualitative restrictions • • • • • . 508
Figure G.2 (part 3 of 3). Figure L.3. Differing quantitative
performance of the mathematical restrictions • • • • • • • • • • • • 509
The modularity of PL/I, the ease with which level but the most elementary. These rules
subsets can be selected to meet different give the programmer considerable control
needs, becomes apparent when one examines over the degree of interaction between
the different features of the language. subroutines. They permit flexible
Such modularity is one of the most communication and storage allocation, at
important characteristics of PL/I. the same time allOWing the definition of
names and allocation of storage for private
This chapter contains brief discussions use within a procedure.
of most of the basic features to provide an
overall description of the language. Each By giving the programmer freedom to
is treated in more detail in subsequent determine the degree to which a subroutine
chapters. is self-contained, PLiI makes it possible
to write procedures which can freely be
used in other enVironments, while still
allowing interaction in procedures where
Machine Independence interaction is desirable.
The optimizing and checkout compilers are Another function provided by compile-
complementary program products. The main time facilities is the selective
function of the optimizing compiler is to compilation of program text. For example,
generate highly efficient object code, i t might specify the inclusion or deletion
while that of the checkout compiler is to of debugging statements.
minimize the time a programmer needs to
spend in debugging. Since a simple but powerful part of the
PL/I language is available for compile-time
Both compilers may be used for batch activity, the generation, or replacement
processing, that is, processing in which a and deletion, of text can become more
program must be compiled, and possibly elaborate, and more subtle transformations
executed, in full before the programmer can be performed. Such transformations
obtains any result. The checkout compiler might then be considered to be
has the facility for conversational installation-defined extensions to the
processing. In this mode, the program's language.
execution is monitored from a keyboard
terminal and temporary amendments may be
made during execution as a result of
information so obtained; new PL/I code may Execution-Time Facilities
be temporarily included in the program, for
instance. The best use is made of PL/I
facilities when both compilers are PL/I includes statements and options that
employed. The program is compiled by the provide powerful facilities for debugging.
checkout compiler during the debugging Other features allow program amendment
stages, to allow the programmer to use his during execution; these require the use of
time most effiCiently; the debugged program the Conversational Monitor System or the
is then compiled by the optimizing Time Sharing option of the operating
compiler, to obtain object code that makes system, and of the checkout compiler. They
the most efficient use of the machine. allow the programmer to learn quickly about
the behaviour of his program while it is
The language implemented by the two being executed and also, in the appropriate
compilers is, in general, the same. There processing environment, to correct it.
are a few exceptions concerned with the Also, under the Conversational Monitor
different primary function of each System or the Time Sharing Option, stream
compiler. certain optimizing features are I/O can be performed from and toa
not implemented by the checkout compiler terminal, on programs compiled by either
and certain program checkout features are the checkout or the optimizing compiler.
not implemented by the optimizing compiler.
For instance, a number of statements The debugging facilities cause
instruct the checkout compiler to provide information to be written on the SYSPRINT
the programmer with information about the file (and, if desired, at the terminal when
flow of control through his program during the terminal is not defined as the SYSPRINT
execution. Since the optimizing compiler file) throughout execution or at designated
does not have these facilities, it merely pOints during execution. The programmer
checks the statements' syntax and oeherwise can, throughout execution, cause
ignores them. Similarly, there are intormation to be written every time a
statement options concerned with generating reference to a selected variable occurs in
the most efficient object code possible a pre-defined situation or when a transfer
that are used by the optimizing compiler of control takes place. Similarly, at
but which are syntax-checked and then designated paints in the program being
ignored by the checkout compiler. executed, the information to be written can
/* character-string
AB+BC is equivalent to AB + BC
The character pair /* indicates the
TABLE(10) is equivalent to TABLE (10) beginning of a cOlllllent. The same character
pair reversed, */, indicates its end. No
FIRST,SECOND is equivalent to FIRST, SECOND blanks or other characters can separate the
two characters of either composite pair;
ATOB is !!2!: equivalent to A TO B the slash and the asterisk must be
If the number 3.1416 is to be used in The types of data that may be used in a
more than one place in the program, it may PL/I program fall into two categories:
be convenient to represent it as a variable problem data and program control data.
to which the value 3.1416 has been Problem data is used to represent values to
assigned. Thus, t~e above statement could be processed by a program. It consists of
be written as: two data types, arithmetic and string.
Program control data is used by the
PI = 3.1416; programmer to control the execution of his
AREA = RADIUS**2*PI; program. Program control data consists of
the following seven types: label, event,
In the last statement, only the number 2 is file, entry, locator, task, and area.
a constant.
The third DECLARE statement specifies a The keyword attributes for declaring
negative scale factor of -2; this means binary fixed-point variables are BINARY and
that the assumed decimal pOint is two FIXED. Precision is specified by two
places to the right of the rightmost digit decimal integer constants, enclosed in
of the item. parentheses, to represent the maximum
number of binary digits and the number of
The fourth DECLARE statement specifies digits to the right of the binary pOint,
that D is to represent fixed-point items of respectively. If the variable is to
no more than three digits, two of which are represent integers, the second digit and
fractional. the comma can be omitted. The attributes
can appear in any order, but the precision
The maximum number of decimal digits specification must follOW either BINARY or
allowed is 15. Default preciSion, assumed FIXED (or REAL or COMPLEX).
when no specification is made, is (5,0).
The internal coded arithmetic form of Following is an example of declaration
decimal fixed-point data is packed decimal. of a binary fixed-point variable:
packed decimal is stored two digits to the
byte, with a sign indication in the DECLARE FACTOR BINARY FIXED (20,2);
rightmost four bits of the rightmost byte.
Consequently, a decimal fixed-point data FACTOR is declared to be a variable that
item is always stored as an odd number of can represent arithmetic data items as
digits, even though the declaration of the large as 20 binary digits, two of which are
variable may specify the number of digits fractional. The decimal eqUivalent of that
(p) as an even number. value range is from -262,144.00 through
+262,143.15.
When the declaration specifies an even
number of digits, the extra digit place is The maximum number of binary digits
in the high-order position, and i t allowed is 31. Default precision is
participates in any operations performed (15,0). The internal coded arithmetic form
upon the data item, such as in a comparison of binary fixed-point data can be either a
operation. Any arithmetic overflow or fixed-point binary halfword or fullword. A
assignment into an extra high-order digit halfword is 15 bits plus a sign bit, and a
place can be detected only if the SIZE fullword is 31 bits plus a sign bit. Any
condition is enabled. binary fixed-point data item with a
precision of (15,0) or less is stored as a
halfword, and with a precision greater than
(15,0), up to the maximum precision, is
Binary Fixed-Point Data stored as a full word. The declared number
of digits are considered to be in tht low-
order pOSitions, but the extra high-order
A binary fixed-point constant consists of digits participate in any operations
one or more binary digits with an optional performed upon the data item. Any
binary point, followed immediately by the arithmetic overflow into such extra high-
letter B, with no intervening blank. A order digit positions can be detected only
3141593E-6
P: PROCEDURE;
CALL Pl;
TASK DATA
AREA DATA
For detailed information, see chapter 8, The bounds of a dimension are the
·Storage Control-. beginning and the end of that dimension.
The extent is the number of integers
between, and including, the lower and upper
bounds. If only one integer appears in the
Data Organization bounds specification tor a dimension, the
lower bound is assumed to be 1. The one
dimension of LIST has bounds of 1 and 8;
In PL/I, data items may be single data its extent is 8. The two dimensions of
elements, or they may be grouped together TABLE have bounds of 1 and 4 and 1 and 2;
to form data collections called arrays and the extents are 4 and 2.
The bounds of an array determine the way LIST_A (10) 310 LIST_B (2)
elements of the array can be referred to.
For example, assume that the following data LIST_A (11) 70 LIST_B (3)
items are assigned to the array LIST, as
declared above: Assume that the same data were assigned
to TABLE, which is declared as a two-
20 5 10 30 630 150 310 70 dimensional array (though note again that
assignment could not be direct from LIST to
The different elements would be referred TABLE). TABLE can be illustrated as a
to as follows: matrix of four rows and two columns, as
follows:
Reference Element
LIST (1) 20
TABLE(m,n)
LIST (2) 5
(l,n) 20 5
LIST (3) 10
(2,n) 10 30
LIST (4) 30
(3,n) 630 150
LIST (5) 630
(4,n) 310 70
LIST (6) 150
An element of TABLE is referred to by a
LIST (7) 310 subscripted name with two parenthesized
subscripts, separated by a comma. For
LIST (8) 70 example, TABLE (2,1) would specify the
first item in the second row, in this case,
Each of the numbers following the name the data item 10.
LIST is a subscript. A parenthesized
subscript following an array name, with or Note: The use of a matrix to illustrate
without an intervening blank, identifies a TABLE is purely conceptual. It has no
particular data item within the array. A relationship to the way in which the items
subscripted name, such as LIST(4), refers are actually organized in storage. Data
to a single element and is an element items are aSSigned to an array in row major
variable. The entire array can be referred order, that is, with the right-most
to by the unsubscripted name of the array, subscript varying most rapidly. For
for example, LIST. In this case, LIST is example, aSSignment to TABLE would be to
an array variable. Note the difference TABLE(l,l), TABLE(1,2), TABLE(2,1),
between a subscript and the dimension TABLE(2~2) and so forth.
attribute specification. The latter, which
appears in a declaration, specifies the Arrays are not limited to two
dimensionality and the number of elements dimensions; up to 15 dimensions can be
The subscripts of a subscripted name need Like an array, the entire structure is
not be constants. Any expression that given a name that can be used to refer to
yields a valid arithmetic value can be the entire collection of data. Unlike an
used. If the evaluation of such an array, however, each element of a structure
expression yields a value that is not a also has a name.
fixed-point binary integer, it is converted
to FIXED BINARY(15,O), since subscripts are A structure is a hierarchical collection
maintained internally as binary integers. of names. At the bottom of the hierarchy
is a collection of elements, each ot which
Subscripts are frequently expressed as represents a single data item or an array.
variables or other expressions. Thus, At the top of the hierarchy is the
TABLE(I,J*K) could be used to refer to the structure name, which represents the entire
different elements of TABLE by varying the collection of element variables. For
values of I, J, and K. example, the following is a collection of
element variables that might be used to
compute a weekly payroll:
Non-connected storage: The use of the Note: The LIKE attribute copies
DEFINED attribute to overlay arrays with StrUCturing, names, and attributes of the
I I I I I I I I
byte I byte I byte I byte I byte 1byte 1byte 1byte I byte
I I I I I 1 I I
---------------------------------------------------------------------------------------
I I 1 I
halfword Ihalfword Ihalfword Ihalfword Ihalfword
I 1 1 1
1 I
I word I word I word
I I I
1---------------------------------------------------------------------------------------
I I double
I doubleword I word
I I
L---------------------------------------------------------------------------------------J
Figure 3.1. Section of main storage showing alignment of fixed length fields
structure below the level of the specified storage on an integral boundary for that
name only. No dimensionality of the unit of intormation. A boundary is called
specified name is copied. For example, if integral for a unit of information when its
BUDGET were declared as 1 BUDGET(12), the address is a multiple of the length of ~he
declaration of COST OF LIVING LIKE BUDGET unit in bytes. For example, a word (four
would not give the dimension attribute to bytes) must be located in storage so that
COST_OF_LIVING. To achieve dimensionality its address is a multiple of the number 4.
of COST OF LIVING, the declaration would A halfword (two bytes) must have an address
have to-be-DECLARE 1 COST_OF_LIVING(12) that is a multiple of the number 2, and· a
LIKE BUDGET. doubleword (eight bytes) must have an
address that is a multiple of the number 8
A minor structure name can be declared (see figure 3.1).
LIKE a major structure or LIKE another
minor structure. A major structure name
can be declared LIKE a minor structure or Halfwords, words, and doublewords may be
LIKE another major structure. accessed more readily than a field of the
same length that is not aligned on an
integral boundary. For this reason, it is
a system requirement that data to be used
ALIGNED and UNALIGNED Attributes in certain operations is aligned on one of
the three integral boundaries.
When the UNALIGNED attribute is The third example illustrates the CALL
specified, the compiler generates code that option. It indicates that the procedure
moves the data to an appropriate integral SUBR is to be invoked to perform the
boundary before an operation is performed, initialization. The required values are
if the operation requires data alignment. assigned to TABLE during the execution of
Consequently, although the UNALIGNED SUER.
attribute may reduce storage requirements,
it may increase execution time. The fourth example shows an INITIAL
attribute which contains an expression. It
Defaults are applied at element level. specifies that A is to be initialized with
The default for bit-string data, character- the value of the product of Band C.
string data, and numeric character data is
UNALIGNED: for all other types of data, the The fifth example illustrates the use of
default is ALIGNED. a fUnction reference to initialize a data
item.
ALIGNED or UNALIGNED can be specified
for element, array, or structure variables. For a variable that is allocated when
The application of either attribute to a the program is loaded, that is, a static
structure is equivalent to applying the variable, which remains allocated
attribute to all contained elements that throughout execution of the program, any
are not explicitly declared ALIGNED or value specified in an INITIAL attribute is
UNALIGNED. assigned only once. For automatic
variables, which are allocated at each
The following example illustrates the activation of the declaring block, any
effect of ALIGNED and UNALIGNED specified initial value is assigned with
declarations for a structure and its each allocation. For based and controlled
elements: variables, which are allocated at the
execution of ALLOCATE statements (also
DECLARE 1 S, LOCATE statements for based variables), any
2 X BIT(2), /*UNALIGNED BY DEFAULT*/ specified initial value is assigned with
2 A ALIGNED, /*ALIGNED EXPLICITLY */ each allocation. Note, however, that this
3 B, /*ALIGNED FROM A */ initialization of controlled variables can
3 C UNALIGNED, /*UNALIGNED EXPLICITLY*/ be overridden in the ALLOCATE statement.
4 D, /*UNALIGNED FROM C */
4 E ALIGNED, /*ALIGNED EXPLICITLY */ The INITIAL attribute cannot be given
4 F, /*UNALIGNED FROM C */ for entry constants, file constants,
3 G, /*ALIGNED FROM A */ DEFINED data, entire structures, or
2 H; /*ALIGNED BY DEFAULT */ parameters (except CONTROLLED parameters).
RATE. SECONDARY / 4
Examples of expressions are:
A(4,6) * COST.SECONDARY(2)
OPERATIONAL EXPRESSIONS
PROBLEM DATA CONVERSION
An operational expression consists of one
or more single operations. A sing1e Two classes of conversion can be performed
operation is either a prefix operation (an on problem data: type conversion and
operator preceding a single operand) or an arithmetic conversion.
infix operation (an operator between two
operands). The two operands of any infix Type conversions are those that take
operation, when the operation is performed, p1ace between the different types of
usually must be of the same data type. problem data, namely:
The operands of an operation in a PL/I character-string - data with the CHARACTER
expression are automatically converted, if attribute
necessary, to a common representation
before the operation is performed. General bit-string - data with the BIT
principles concerning these conversions are attribute
given in -Attributes of Targets" later in
this chapter. Detailed rules for specific numeric character- data with a PICTURE
cases, including rules for computing the attribute that contains
precision or length of a converted item, neither of the picture
can be found in section F, "Data Conversion characters A and X.
and Expression Evaluation."
coded arithmetic - data with FIXED or
Data conversion is mainly confined to FLOAT, DECIMAL or BINARY,
problem data. The only conversion possible REAL or COMPLEX, and
with program control data is between offset precision attributes.
and pointer types (except that conversion
to character strings takes place under the (Strictly, numeric character data is merely
checkout compiler during stream output). a particular case of arithmetic data, but
for the purpose of presenting the
There are very few restrictions on the conversion rules, it is regarded as a
More than one bit-string operation can 2. Character, which involves left-to-
be combined in a single expression that right, character-by-character
yields a bit-string value. comparisons of characters according to
the collating sequence.
In the following examples, if the value
of operand A is '010111'B, the value of 3. Bit, which involves left-to-right,
operand B is '111111'B, and the value of bit-by-bit comparison of binary
operand C is '110'B, then: digits.
COMBINATIONS OF OPERATIONS
CONCATENATION OPERATIONS
Different types of operations can be
combined within the same operational
A concatenation operation is one that is expression. Any combination can be used.
specified by combining operands with the For example, the expression shown in the
concatenation symbol: following assignment statement is valid:
II RESULT = A + B < C , Di
It signifies that the operands are to be Each operation within the expression is
joined in such a way that the last evaluated according to the rules for that
character or bit of the operand to the left kind of operation, with necessary data
will immediately precede the first conversions taking place before the
character or bit of the operand to the operation is performed.
right, with no intervening bits or
characters. Assume that the variables given above
are declared as follows:
The concatenation operator can cause
conversion to string type since DECLARE RESULT BIT(3), A FIXED
concatenation can be performed only upon DECIMAL(l), B FIXED BINARY
strings, either character strings or bit (3), C CBARACTER(2), D BIT(4);
strings. If either operand is character or
decimal, any necessary conversions are • The decimal value of A would be
performed to produce a character-string converted to binary base.
II
result 2 would be converted to binary, and
the algebraic comparison would be
v performed, yielding the bit-string result
of the entire expression.
(lowest)
The priority of operators is defined
If two or more operators of the highest only within operands (or sub-operands). It
priority appear in the same expression, the does not necessarily hold true for an
order of evaluation of those operators is entire expression. Consider the following
from right to left; that is, the rightmost example:
exponentiation or prefix operator is
evaluated first. Each succeeding
exponentiation or prefix operator to the
A + (B < C) & (0 II E *. F)
left has the next highest priority. The priority of the operators specifies, in
this case, only that the exponentiation
For all other operators, if two or more will occur before the concatenation. It
operators of the same priority appear in does not specify the order of the operation
the same expression, the order or priority in relation to the evaluation of the other
of those operators is from left to right. operand (A + (B < e».
Note that the order of evaluation of the Any operational expression (except a
expression in the assignment statement: prefix expression) must eventually be
reduced to a single infix operation. The
RESULT =A + B < C & Di operands and operator of that operation
determine the attributes of the result of
is the result of the priority of the the entire expression. For instance, in
operators. It is as if various elements of the first example of combining operations
the expression were enclosed in parentheses (which contains no parentheses), the "and"
A + (B *. 3)
symbol.
In this example, the exp~ession SQRT(C) The SUBSTR built-in fUnction extracts a
represents a value that is equal to the substring of specified length from the
square root of the value of C. Such an named string. As a pseudovariable, i t
expression is called a function reference. indicates the location, within a named
string, that is the receiving field.
A function reference consists of a name
and, usually, a parenthesized list of one In the above example, a substring five
or more variables, constants, or other characters in length, beginning with
expressions. The name is the name of a character 20 of the string B, is to be
block of code written to perform specific assigned to the last five characters of the
computations upon the data represented by string A. That is, the last five
the list and to substitute the computed characters of A are to be replaced by
value in place of the function reference. characters 20 through 24 of B. The first
five characters of A remain unchanged, as
Assume, in the above example, that C has do all of the characters of B.
the value 16. The function reference
SQRT(C> causes execution of the code that All the built-in functions that can be
would compute the square root of 16 and used as pseudovariables are discussed in
replace the function reference with the section G, "Built-in Functions and
value 4. In effect, the assignment Pseudovariables." NO programmer-written
statement would become: function can be used as a pseudovariable.
-1 -2 -1
-6 -3 4 Array·and-Array Operations
This chapter classifies statements strings, area sizes, initial values, and
according to their functions. Statements some file attributes may be determined
in each functional class are listed, the during execution of the program.
purpose of each statement is described, and
examples of their use are shown.
The names of the classes have been chosen values returned by internal procedures
for descriptive purposes only; apart from
preprocessor and listing control statements DECLARE statements may also be an
they have no fundamental significance in important part of the documentation of a
the language. A statement may be included program; consequently, programmers may make
in more than one class, since it can have liberal use of declarations, even when
more than one function. default attributes apply or when a
contextual declaration is possible.
Because there are no restrictions on the
number of DECLARE statements, different
Descriptive Statements DECLARE statements can be used for
different groups of names. This can make
modification easier and the interpretation
When a PL/I program is executed, it may of diagnostics clearer.
manipulate many different kinds of data.
Each data item, except an arithmetic or
string constant, is referred to in the
program by a name. The PL/I language OTHER DESCRIPTIVE STATEMENTS
requires that the properties (or
attributes) of data items referred to must
be known at the time the program is The OPEN statement allows certain
compiled. There are a few exceptions to attributes to be specified for a file
this rule; for non-STATIC items, the bounds constant and may, therefore, also be
of the dimensions of arrays, the lengths of classified as a descriptive statement.
REWRITE
DELETE
Only sequential files can be processed with
STREAM I/O Statements the GET and PUT statements. Record
boundaries generally are ignored: data is
GET considered to be a stream of indiVidual
data items, either coming from (GET) or
PUT going to (PUT) the external medium.
I/O Control Statements The GET and PUT statements may transmit
a list of items in one of three modes:
OPEN data-directed, list-directed, or edit-
directed. In data-directed transmission,
CLOSE the names of the data items, as well as
their values, are recorded on the external
UNLOCK medium. In list-directed transmission, the
data is recorded externally as a list of
An allied statement, discussed with constants, separated by blanks or commas.
these statements, is the DISPLAY statement. In edit-directed transmission, the data is
recorded externally as a string of
There are two important differences characters to be treated character by
between STREAM transmission and RECORD character according to a format list.
transmission. In STREAM transmission, each
data item is treated individually, whereas Data-directed transmission is most
RECORD transmission is concerned with useful for reading a relatively small
collections of data items (records) as a number of values and for producing self-
The OPEN statement may be used to The assignment statement, which has no
specify any fi1~ attribute except the keyword, is identified by the assignment
ENVIRONMENT ~ttribute. For a PRINT file, symbOl (=). It generally takes one of the
the length" of each printed line and the two forms illustrated by the following
number of lines per page can be specified examples:
only in an OPEN statement by the PAGESIZE
and LINESIZE options. The .LINESIZE option NTOT=TOT:
can be specified for a non-PRINT OUTPUT
file to determine the length of the AV=(AV*NUM+TAV*TNUM)/(NUM+TNUM)i
phYSical blocks transmitted to a device.
The OPEN statement can also be used to The first form can be used purely for
specify a name (in the TITLE option) other internal data movement. The value of the
than a file name, as a link between the variable (or constant) to the right of the
data set and the file. aSSignment symbol is to be assigned to the
variable to the left. The second form
The CLOSE statement dissociates a data includes an operational expression whose
set from a file. All files are closed at value is to be assigned to the variable to
termination of a program, so a CLOSE the left of the aSSignment symbol. The
statement is not always required. second form specifies computations to be
made, as well as data movement.
The UNLOCK statement releases, for use
by other tasks, a record which has Since the attributes of the variable on
restricted access because i t is associated the left may differ from the attributes of
with an EXCLUSIVE file. the result of the expression (or of the
variable or constant), the assignment
statement can also be used for conversion
and editing.
DISPLAY STATEMENT
The variable on the left may be the name
of an array or a structure: the expression
The DISPLAY statement is used to write on the right may yield an array or
messages on the console, usually to the structure value. Thus the assignment
operator. It may also be used, with the statement can be used to mOve aggregates of
REPLY option, to allow the operator to data, as well as single items.
PROCEDURE STATEMENT
I
I DO WHILE(A=B) UNTIL(X=10);
The effect of executing a do-group may
be summarized as follows:
In this example, the expression in the
WHILE option is tested before each 1. If a control variable is specified,
execution of the group, and the assign the initial value to the
expression in the UNTIL option is tested control variable.
at the end of each execution of the
group. If, when the DO statement is 2. If the TO option is present, test the
first encountered, A~=B, the group is value of the control variable against
not executed at all. If, however, A=B, the expression in the TO option. If
the group is executed at least once. the control variable is out of range,
leave the group.
If, after an execution of the group,
X=10, no further iterations are 3. If the WHILE option is specified, test
performed. Otherwise, a further the expression in the WHILE option.
iteration is performed provided that A If it is • false', leave the group.
is still equal to B.
4. Execute the statements in the group.
Example 2: 5. If the UNTIL option is specified, test
the expression in the UNTIL option.
DO I=l TO 10 UNTIL(Y=l): If it is 'true', leave the group.
In this example, the group is executed 6. If there is a control variable:
a~ least once, with I equal to 1.
a. If the TO or BY option is
If, after an execution of the group, specified, add the increment to
Y=l, no further iterations are the control variable.
performed. Otherwise, the implied
increment (BY 1) is added to I, and the b. If the REPEAT option is specified,
new value of I is compared with 10. If evaluate the expression in the
I is greater than 10, no further REPEAT option and assign it to the
iterations are performed. Otherwise, a control variable.
new iteration commences.
c. If the TO, BY, and REPEAT options
are all absent, leave the group.
Example 3:
7. Go to 2.
DO 1=1 REPEAT 2*1 UNTIL(I=256)i
A more formal expansion of the iterative
Here, the first execution of the group do-group is given in ·section J:
is performed with 1=1. statements·.
After this and each subsequent If a DO statement specifies a control
execution of the group, the UNTIL Ivariable (DO I = •• • i), the part of the
expression is tested. If I=256, nO Istatement after the equals sign is called a
further iterations are performed. I specification. More than one specification
otherwise, the REPEAT expression is lean be included in a Single DO statement.
evaluated and assigned to I, and a new Iconsider each of the following DO
iteration commences. I statements:
DO I 1 TO 10, 13 TO·15;
The STOP and EXIT statements are both used The ON statement takes the form:
to cause abnormal termination. The STOP
statement terminates execution of the ON condition[SNAP] {SYSTEMilon-unit}
entire program, including all concurrent
tasks. The EXIT statement terminates only The "condition" is one of those listed in
the task that executes it, together with section H, "On-Conditions." The "on-unit"
any attached tasks. (See chapter 11, is a single statement or a begin block that
WMultitasking. W) specifies action to be taken when that
condition arises and an interrupt occurs.
For example:
CHECK AND NOCHECK STATEMENTS The NOFLOW statement prevents the output
of FLOW information at a transfer of
control.
When a CHECK statement is executed,
information about the variables specified
or assumed is put out whenever these
variables occur in pre-defined situations. PUT STATEMENTS
This continues to the end of program
execution or until the CHECK statement is
overridden by a NOCHECK statement. When a PUT statement is executed, the
END [label];
PROCEDURE BLOCKS
Unlike a procedure block, a label is
optional for a begin block. If one or more
A procedure block, simply called a labels are prefixed to a BEGI~ statement,
procedure, is a sequence of statements they serve only to identify the starting
headed by a PROCEDURE statement and ended point of the block. (Control may pass to a
by an END statement, as follows: begin block without reference to the name
of that block through normal sequential
label: [label:] ••• PROCEDURE; execution, although control can be
transferred to a labeled BEGIN statement by
execution of a GO TO statement.) The label
following END is optional. However, a
END[labell; label can appear after END, matching a
label of the corresponding BEGIN statement.
All procedures must be named because the (There are exceptions; see ·use of the END
procedure name is the primary point of statement-, later in this chapter.) An
entry through which control can be example of a begin block follows:
transferred to a procedure. Hence, a
PROCEDURE statement must have at least one B: CONTROL: BEGIN;
label. A label need not appear after the statement-1
keyword END in the END statement, but if statement-2
one does appear, it must match the label
(or one of the labels) of the PROCEDURE
statement to which the END statement
corresponds. (There are exceptions; see statement-n
·use of the' END statement·, later in this END B.
chapter.) An example of a procedure
follows: Unlike procedures, begin blocks
A PL/I program consists of a collection of In order to understand the rules for the
identifiers, constants, and special scope of a name, it is necessary to
characters used as operators or delimiters. understand the terms "contained in" and
Identifiers themselves may be either "internal to."
keywords or names with a meaning specified
by the programmer. The PL/I language is Contained In:
constructed so that the compiler can
determine from context whether or not an All of the text of a block, from the
identifier is a keyword, so there is no PROCEDURE or BEGIN statement through
list of reserved words that must not be the corresponding END statement, is
used for programmer-defined names. (Though said to be contained in that block.
the uses of the 48-character set composite Note, however, that the labels of the
symbols, and, under the checkout compiler, BEGIN or PROCEDURE statement heading
of the file SYSPRINT, are restricted.) Any the block, as well as the labels of
identifier may he used as a name; the only any ENTRY statements that apply to the
restriction is that at any point in a block, are not contained in that
program a name can have one and only one block. Nested blocks are contained in
meaning. For example, the same name cannot the block in which they appear.
be used for both a file and a floating-
point variable. Internal To:
DECLARE A, B: ] 5.
EVENT attribute.
END Ri
END Q: ]
11 7. A name that appears in an IN option,
or in the OFFSET attribute, is given
the AREA attribute.
Contextual Declaration
SCOPE OF A CONTEXTUAL DECLARATION
When a name appears in certain contexts,
some of its attributes can be determined
without explicit declaration. In such a The scope of a contextual declaration is
case, if the appearance of a name does not determined as if the declaration were made
lie within the scope of an explicit in a DECLARE statement immediately
declaration for the same name, the name is following the PROCEDURE statement of the
said to be contextually declared. external procedure in which the name
appears.
A name that has not been declared
explicitly will be recognized and declared Note that contextual declaration has the
R = Q:
C: BEGIN:
[ DECLARE R:
DO I = 1 TO 10:
ENDi
END Ci
END B:
1
]
D: PROCEDURE: ]
DECLARE S;
[ END D:
END A: 1
L---------------------------------------------------------------------------------------J
Figure 1.1. Scopes of data declarations
r---------------------------------------------------------------------------------------,
L1 L1' L2 ABC D E
A: PROCEDURE:
DECLARE E ENTRY:
L1: P = Qi
B: PROCEDURE:
L2: CALL C:
C: PROCEDURE:
[ L1: X=Yi
GO TO L1:
CALL E;
END C:
END Bi
D:
[ PROCEDURE:
END D:
rE:
CALL Bi
END Ai
PROCEDURE:
1 ]
L END Ei
L---------------------------------------------------------------------------------------J
Figure 1.2. scopes of entry and label declarations
D and B are explicitly declared in block The scope of a name with the INTERNAL
A and can be referred to anywhere within Ai attribute is the same as the scope of its
but since they are INTERNAL, they cannot be declaration. Any other explicit
referred to in block E (unless passed as an declaration of that name refers to a new
argument to E). object with a different, non-overlapping
scope.
For example:
The assumed attributes for A are REAL ENTRY: An entry constant declared in a
FLOAT: for B, they are REAL FIXED. DECLARE statement, or as a statement prefix
on a PROCEDURE or ENTRY statement, is
3. If mode, scale, and base are not assumed EXTERNAL. An entry variable is
specified by a DECLARE or DEFAULT assumed INTERNAL.
statement, the attributes assumed
depend on the initial letter of the LABEL, POINTER, OFFSET, AREA, EVENT, TASK:
identifier. Identifiers declared with anyone of these
whereby all possible initial alphabetic Assume that the following ranges of
characters, from A through Z, and the initial letters are to correspond to the
characters $, ~, and # are specified. attributes given:
The purpose of this chapter is to describe variables during execution •. Programs often
how the PL/I programmer can control the need data that is used whenever the program
allocation of storage. Allocation is the is executed. For example, all arithmetic
process of obtaining storage for a constants specified in a program are stored
variable. A generation of a variable in a manner similar to variables declared
refers to a particular allocation of it. STATIC. The difference is that constants
The four storage classes STATIC, AUTOMATIC, cannot be changed during program execution
CONTROLLED, and BASED allow the programmer whereas the values of static variables can.
to exercise as 'much control as he requires Although static variables can be declared
for a particular program. at any point in a program, they are all
allocated prior to execution. But it is
All variables require storage: this important to note that static variables
applies both to problem data, such as follow normal scope rules for the validity
string and arithmetic variables, and to of references to them. For example:
program control data such as label
variables, entry variables, and file A:PROC OPTIONSCMAIN):
variables. The declaration of a variable
must include a storage class attribute even
if only by default. The name of a variable
is effectively the address of the variable, B:PROC:
and the attributes specified for a variable DECLARE X STATIC INTERNAL:
describe the amount of storage required and
how it is to be interpreted. For example:
DECLARE X FIXED BlNARY(31,O) AUTOMATIC: END B;
END A:
The name X addresses a fullword, i.e., four
bytes, that contains a value to be Although the variable X is allocated
interpreted as a fixed-point binary throughout the program, it can be
integer. For static and automatic referenced only within procedure B or any
variables, this concept is not very block contained in B.
important, but when considering controlled
and, particularly, based variables it is If static variables are initialized
relevant. using the INITIAL attribute, the initial
values must be specified as constants with
It should be understood that at no point the exception of pointer variables as noted
in a PL/I program does the programmer have below. And any specification of extenis,
access to the absolute address of a for instance array bounds, must also be
variable within main storage, because the constants. Thus if static storage is used,
allocation of storage for variables is it must be borne in mind that whatever
managed by the compiler. The programmer allocation has been specified when the
does not specify where in main storage the program was written will be retained
allocation is to be made. He can, however, throughout the execution of the program.
specify where it is to be allocated static storage should be used for all data
relative to storage already. allocated for that may be referred to by the programmer
instance by allocating based variables in at any point in a program~ A STATIC
an area variable. pOinter or offset variable may be
initialized only by using the NULL built-in
The degree of storage control that can function.
be exercised depends on the class of
storage used. All other forms of storage allocation
are dynamic, that is, the storage is
obtained during the execution of the
program. Because. of this, the programmer
Static Storage can exert more control.
ALLOCATE X;
MULTIPLE GENERATIONS OF CONTROLLED
VARIABLES
ALLOCATE X(10,10);
If storage for a controlled variable is
reallocated before being freed the first
generation is preserved, i.e., stacked.
The second generation becomes the current ALLOCATE X ( • , .) i
generation; the first generation cannot be
directly accessed until the current In this example. the first generation of X
generation has been freed. This is similar has bounds (10,20); the second and third
to the process described for automatic generations have bounds (10,10). The
variables in a recursive procedure. For elements of each generation of X are all
cont~olled variables, however, stacking and character strings of length five.
unstacking of variables occur at ALLOCATE
and FREE statements rather than at block The asterisk notation can also be used
boundaries and are independent of in a DECLARE statement, but has a different
invocation of procedures within a task. meaning. For example:
Although values of successive DCL Y CHAR(.) CTL,
generations of a controlled variable are N FIXED BINi
stacked, values can be obtained from the N=20:
most recent generation to help create a new
generation. If, in an ALLOCATE or DECLARE
statement, a bound, length, or size is
specified by an expression that contains ALLOCATE Yi
references to the vatiabl&, the value is
taken from the most recent previous
generation. For example:
ALLOCATE Y CHAR (N) ;
DCL X(20) FIXED BIN CTL;
This simply means that the length of the
character string Y is to be taken from the
previous generation unless it is specified
ALLOCATE X; in an ALLOCATE statement, in which case Y
is given the specified length. This allows
the programmer to defer the specification
of the string length until the actual
ALLOCATE X(X(l»i allocation of storage.
BASED VARIABLES
ALLOCATION BUILT-IN FUNCTION
A declaration of a based variable has the
Where the allocation and freeing of a keyword BASED and, optionally, the name of
variable depend on flow of control, it is a locator variable that can be assumed to
useful to be able to determine if the be associated with the based variable. For
variable has been allocated. The example:
ALLOCATION built-in function returns a
binary integer value indicating the number DeL x FIXED BIN BASED(P);
of generations that can be accessed in the
current task for a given controlled For this declaration the value of the
variable. If the variable is not variable P will identify the location of
allocated, the value zero is returned. The the variable X, except when the reference
function reference has the form: is otherwise explicitly qualified, as
described below.
ALLOCATION (a)
The association of a pointer variable in
where a must be a controlled variable. this way is not a special relationship. P
can be used to identify locations of other
Besides the ALLOCATION built-in based variables and other locators can be
function, other built-in functions that may used to identify other generations of the
be useful are the array-handling functions variable X.
DIM, which determines the extent of a
specified dimension of an array, and LBOUND
and HBOUND, which determine the lower and
upper bound respectively of a specified LOCATOR QUALIFICATION
dimension of a given array. Similarly for
strings, the built-in function LENGTH,
returns the current length of the string. Because a reference to the value of a based
Q->X = Q->X + 1~
Setting Pointer Variables
This assignment statement has the same
,~
effect as that of the previous example. A
based variable can be declared without Before a reference is made to a pointer-
naming a pointer variable; in this case any qualified variable, the pOinter must have a
reference to the based v~riable must always value. A pointer value is obtained from
be explicitly locator-qualified. any of the following:
(Note that PL/I allOWS a more general 1. The NULL built-in function.
form of locator qualification than is
described here; see "Multip1e Locator 2. The ADDR built-in function.
Qualification" at the end of this chapter.
However, the general form is not essential 3. A READ or LOCATE statement.
to an understanding of the remainder of
this chapter.) 4. An ALLOCATE statement.
T=H;
NXT: T->DATA=X;
TYPES OF LIST
Area variables
Offset Variables
The AREA attribute defines an area of
stgrage that is to be reserved for the
allocation of based variables. The Offset variables are a special form of
declaration of an area variable has the pOinter used exclusively with area
form: variables. The value of an offset variable
indicates the location of a based variable
DCL identifier AREA [(size)]; within an area variable relative to the
start of the area. Because the based
The amount of storage to be reserved is variables are identified relatively, if the
given in bytes; i.e. the integral value of area variable is assigned to a different
·size". If size is not given, a default of part of main storage, the offset values are
1000 bytes is assumed. not invalidated. Note that offset,
variables do not preclude the use of
The size of an area is adjustable in th~ pOinter variables within an area. An
same way as a string length or an array offset variable is declared as follows:
bound and therefore i t can be specified by
an expression or an asterisk (for a DCL identifier
controlled area or parameter) or by a REFER OFFSET[(element-area-variable)]:
option (for a based area). The maximum
size of an area is limited only by the The association of an area variable with
amount of main storage available to the an offset variable is not a special
program. relationship; an offset variable can be
associated with any area variable by means
In addition to the declared size, an of the POINTER built-in function (see
extra 16 bytes of control information, "Locator Conversion" below). The advantage
which contains such details as the amount of making such an association in
of storage in use, precedes the reserved declaration is that a reference to the
size of an area. offset variable implies reference to the
associated area variable.
The amount of reserved storage that is
actually in use is known as the extent of Note that the appearance of an area
the area. The maximum extent is variable in the declaration of an offset is
represented by the area size. Based a contextual declaration of the area
variables can be allocated and freed within variable.
an area at any time during execution. This
means that the extent of an area varies as
storage is used. Because any based
variable can be allocated within an area, Locator Conversion
they could require different amounts of
storage. When a based variable is freed,
the storage i t occupied is marked as When an offset variable is used in a
DCL A AREA,
(T,H) OFFSET(A), The ,value of an area expression can be
1 STR BASED(H), assigned to one or more area variables by
2 P OFFSET (A) , an assignment statement. Area-to-area
2 DATA: assignment has the effect of freeing all
allocations in the target area and then
assigning the extent of the source area to
ALLOCATE STR IN(A); the target area, in such a way that all
T=H: otfsets for the source area are valid for
the target area. For example:
GO TO NEXT;
ALLOCATE X IN (A) ;
X = 1:
ALLOCATE X IN CA) SET (O(2}) ;
FREE statement with the IN Option 0(2) -> X = 2;
B = A;
A based variable allocated within an area Given this program segment and using the
variable can be freed by specifying the POINTER built-in function, the references
area variable by the IN option: POINTER (O(2),B)->X and 0(2)->X will
represent the same value allocated in areas
FREE based-variable B and A respectively.
[IN(element-area-variable»);
If a source area containing no
Multiple freeing of both based and allocations is assigned to a target area,
controlled variables can be made by the the effect is merely to free all
same FREE statement. When all the current allocations in the target area.
allocations of variables within an area
variable are to be freed, the EMPTY built- A possible use for area aSSignment is to
in function is the most convenient method. allow for expansion of a list of based
variables beyond the bounds of its original
area. When an attempt is made to allocate
a based variable within an area that
EMPTY Built-In Function contains insufficient free storage to
accommodate it, the AREA condition is
raised (see below). The on-unit for this
When an area variable is allocated, it condition could be to change the value of a
automatically has the empty state, i.e., pOinter qualifying the reference to the
the area extent is zero. The value of the inadequate area, so that it pOinted to a
EMPTY built-in function can be assigned to different area; on return from the on-unit,
an area variable to free all allocations in the allocation would be attempted again,
the variable. The function reference does within the new area. Alternatively, the
not require arguments but must be given a on-unit could write out the area and reset
null argument list if the name has not been it to EMPTY.
declared BUILTIN. For example:
DECLARE A AREA,
I BASED (P), AREA ON-Condition
J BASED (Q);
Note that the area variable itself is not 2. When an attempt is made to perform an
freed, its storage is retained for further area assignment, and the target area
allocations of based variabies. is too small to accommodate the extent
If no on-unit is specified, the system will Reference to a based variable can also
comment and raise the ERROR condition. be implicitly qualified. The locator value
used to determine the generation of a based
variable that is implicitly qualified is
the one declared with the based variable.
INPUT/OUTPUT OF AREAS Because the locator declared with a based
variable can also be based, a chain of
locator qualifiers can be implied. For
The area facility is designed to allow easy example:
input and output of complete lists of based
variables as one unit, to and from RECORD DECLARE (P(lO),Q) POINTER,
files. On output, only the area extent, R POINTER BASED (Q),
together with the 16 bytes of control V BASED (P(3»,
information, is transmitted (although the W BASED (R),
extent does include freed allocations which Y BASED;
are still significant). Thus the unused ALLOCATE R,V,W;
part of an area does not take up space on
the data set. Because the extents of areas Given this declaration and allocation, the
may vary, V-format or U-format records following are valid references:
should be used. The maximum record length
required is governed by the area length 1. P(3) -> V
(i.e., area size + 16).
2. V
3. Q -> R -> W
MULTIPLE LOCATOR QUALIFICATION
4. R -> W
element-Iocator-expression->
[based-Iocator-variable-> ••• 1
based-variable Levels of Locator Qualification
CALL OUT SUB (NAME, ITEM); CALL READCM (RATE, TIME, DISTANCE,
MASTER) ;
END PRMAIN;
OUTSUB: PROCEDURE (A,B); READCM: PROCEDURE (W,X,Y,Z);
DECLARE A CHARACTER (20), DECLARE W FLOAT (10), X FLOAT(S),
B BITeS); Y FLOAT(lS), Z FILE;
MAINP: PROCEDURE;
A name is explicitly declared to be a
parameter by its appearance in the
parameter list of a PROCEDURE or ENTRY
statement. However, its attributes, unless GET LIST (A, B, C, Y);
defaults apply, must be explicitly stated
within that procedure in a DECLARE
statement.
x = Y**3+SPROD(A,B,C);
It can be seen that the use of arguments In the above procedure, the assignment
and parameters provides the means for statement
generalizing procedures so that data whose
names may not be known within such x = Y*.3+SPROD(A,B,C);
procedures can, nevertheless, be operated
upon. contains a reference to a function called
END SPROD;
END MAINP;
When SPROD is invoked by MAINP, the
arguments A, B, and C are associated with SPROD: PROCEDURE CU,V,W,Z);
the parameters U, V, and W, respectively. DECLARE Z LABEL;
Since attributes have not been explicitly
declared for the arguments and parameters,
default attributes of FLOAT DECIMAL (6) are
applied to each argument and parameter. IF U > V+ W
THEN GO TO Z;
During the execution of SPROD, the IF ELSE RETURN CU*V*W)i
statement is encountered and a test is
made. If U is greater than V + W, the
statement associated with the THEN clause
is executed; otherwise, the statement END SPROD;
associated with the ELSE clause is
executed. In either case, the executed In MAINP, LABl is explicitly declared to be
statement is a RETURN statement. a statement label constant by its
appearance as a label for the CALL ERRT
RETURN Statement: The RETURN statement is statement. When SPROD is invoked, LABl is
the usual way by which a function is associated with parameter Z. Since the
terminated and control is returned to the attributes of Z must agree with those of
invoking procedure. Its use in a function LABl, Z is declared to have the LABEL
differs somewhat from its use in a attribute. When the IF statement in SPROD
subroutine; in a function, not only does it is executed, a test is made. If U is
retu~n control but it also returns a value greater than V + w, the THEN clause is
to the point of invocation. The general executed, control returns to MAINP at the
form of the RETURN statement, when it is statement labeled LABl, and evaluation of
used in a function, is as follows: the expression that invoked SPROD is
discontinued. If U is not greater than V +
RETURN (element-expression); W, the ELSE clause is executed and a return
to MAINP is made in the normal fashion.
The value of the element expression is Additional information about the use of
returned to the invoking 'procedure at the label arguments and label parameters is
point of invocation. Thus, for the above contained in the section -Relationship of
example, SPROD returns either 0 or the Arguments and Parameters- in this chapter.
value represented by U*V*W, along with
control to the invoking expression in ~: In some instances, a fUnction may be
MAINP. The returned value is taken as the so defined that it does not require an
value of the function reference, and argument list. In such cases, the
evaluation of the invoking expression appearance of an external function name
continues. within an expression will be recognized as
a function reference only if the function
GO TO Statement: A function can also be name has been explicitly declared to be an
terminated by execution of a GO TO entry name. See -ENTRY Attribute- in this
statement. If this method is used, chapter for additional information.
evaluation of the expression that invoked
the function will not be completed, and
control will go to the designated
statement. As in a subroutine, the ATTRIBUTES OF RETURNED VALUES
transfer point specified in a GO TO
statement may be a parameter that has been
associated with a label argument. For RETURNS Attribute: The RETURNS attribute
Built-in Functions
END C;
x = sQRT(Y):
FORTRAN Library Functions
END MAIN:
5UB1: PROCEDURE (U,V):
DECLARE (U(*), V(*» CONTROLLED;
PL/I includes input and o~tput statements with record-oriented transmission, stream-
that enable data to be transmitted between oriented tranSmission is less efficient in
the internal and external storage devices terms of execution time because of the data
of a computer. A collection of data conversion it involves, and more space is
external to a program is called a data set. required on external storage devices
Transmission of data from a data set to a because all data is in character form.
program is termed input, and transmission
of data from a program to a data set is Record-oriented transmission is more
called output. versatile than stream-oriented
transmission, with regard to both the
PL/I input and output statements are manner in which data can be processed and
concerned with the logical organization of the types of data set that it can process.
a data set and not with its physical Since data is recorded in a data set
characteristics: a program can be designed exactly as it appears in main storage, any
without specific knowledge of the data format is acceptable: no conversion
input/output devices that will be used when problems will arise, but the programmer
the program is executed. To a1low a source must have a greater awareness of the
program to deal primarily with the logical structure of his data.
aspects of data rather than with its
physical organization in a data set, PL/I This chapter discusses those aspects of
employs a symbolic representation of a data PL/I input and output that are common to
set called a file. A file can be stream-oriented and record-oriented
associated with different data sets at transmission, including files and t~eir
different times during the execution of a attributes, and the relationship of files
program. to data sets. The next two chapters
describe the input and output statements
TWO types of data transmission can be that can be used in a PL/I program, and the
used by a PL/I program. In stream-oriented various data set organizations that are
transmission, the organization of the data recognized in PL/I.
in the data set is ignored within the
program, and the data is treated as though
it actually were a continuous stream of
individual data items in character form: Data Sets
data is converted from character form to
internal form on input, and from internal
form to character form on output. In oata sets are stored on a variety of
record-oriented transmission, the data set auxiliary storage media, such as punched
is considered to be a collection of cards, reels of magnetic tape, magnetic
discrete records. No data conversion takes disks, and magnetic drums. oespite their
place during record transmission: on input variety, these media have many common
the data is transmitted exactly as it is characteristics that permit standard
recorded in the data set, and on output it methods of collecting, storing, and
is transmitted exactly as it is recorded transmi tting data. For convenience, the
internally. (This is not strictly true for general term volume is used to refer to a
ASCII data sets - see -Information unit of aUXiliary storage, such as a reel
Interchange Codes- in this chapter.) It is of magnetic tape or a disk pack, without
possible for the same data set to be regard to its specific physical
processed at different times by either composition.
stream transmission or record transmission:
however, all items in the data set would I In datasets other those with Virtual
have to be in character form. IStorage Access Method (VSAM) organization,
the data items are arranged in distinct
stream-oriented transmission is ideal physical groupings called blocks. (This
for simple jobs, particularly those that discussion has to be s1ight1y modified for
use punched card input and have limited teleprocessing applications, where the data
output: a ~nimum of coding is required of set is in fact a queue of messages and the
the programmer, especially for punched card term -block- is not strictly app1icable.
input and printed output. Stream-oriented However, a message is similar to a block in
transmission also a1lows communication with that it may consist of one or more records.
the program at execution time from a Teleprocessing is d1SCUSSed in chapter 12.
termina1, if the program is being run under -Record-Oriented Transmission.-) These
the Time Sharing Option. However, compared blocks allow the data set to be transmitted
When a block contains two or more records, In PL/I, only CHARACTER data may be
the records are said to be blocked. written onto an ASCII data set. Each
Blocked records permit more compact and character in the ASCII code is represented
efficient use of auxiliary storage. The by a seven-bit pattern and there are 128
use of blocked records can also improve the such patterns. In EBCDIC, each character
throughput of a program where a large has an eight-bit pattern, and there are 256
number of short records are to be possibilities. The ASCII set includes a
processed, by reducing the number of substitute character (the SUB control
physical input/output operations. character) that is used to represent EBCDIC
characters having no valid ASCII code. (In
In data sets with VSAM organization, the the American National Standards Institute
data items are arranged in control table, this is the character having the
intervals, which are in turn arranged in column 1, row 10 position.) Upon reading
control areas. For processing purposes, this data, the character would be
the data items within a control interval translated to the EBCDIC SUB character,
are arranged in logical records. A control which has the bit pattern 00111111.
interval may contain one or more logical
records, and a logical record may span two
or more control intervals. Further
information on the structure of VSAM data Files
sets is given in the Programmer's Guide for
the relevant compiler.
To allow a source program to deal primarily
Most data processing applications are with the logical aspects of data rather
concerned with logical records rather than than with its physical organization in a
Iblocks or control intervals. Therefore, data set, PL/I employs a symbolic
the input and output statements of PL/I representation of a data set called a file.
generally refer to logical records; this This symbolic representation determines how
allows the programmer to concentrate on the input and output statements access and
data to be processed, without being process the associated data set. Unlike a
directly concerned about its physical data set, however, a file has significance
organization in external storage. only within the source program and does not
exist as a physical entity external to the
program.
FILE ATTRIBUTE
~\.
Group Alternative Default SEQUENTIAL, DIRECT and TRANSIENT
~ Attributes Attribute Attributes
EXCLUSIVE Attribute
ADDITIVE ATTRIBUTES
When access to a record is restricted to
one task, the record is said to be locked
The additive attributes are: by that task. The EXCLUSIVE attribute,
which can be specified for DIRECT UPDATE
PRINT files only, provides a temporary locking
mechanism to prevent one task from
BACKWARDS interfering with an operation by another
task. It can be suppressed by the NOLOCK
KEYED option on the READ statement. Figure 10.1
shows the effects of various operations on
EXCLUSIVE an EXCLUSIVE file.
The KEYED attribute applies only to files The options appropriate to the two types of
Operation
1---------------------------------------------------------------------
I Unlocked I Locked by this task I Locked by another task
~----------------------------------------------------- ---------------------------------
READ NOLOCK Proceed Proceed Wait for unlock
CLOSE FILE IRaise ERROR if there are records locked by another task. Otherwise,
lunlock all records locked in this task, and proceed with closing.
Terminate Task IUnlock all records locked by task. Close file, if opened in this taskl
---------------------------------------------------------------------------------------1
1The unlocking occurs at the end of the operation, on completion of anyon-units I
entered because of the operation (that is, at the corresponding WAIT statement when I
the EVENT option has been specified). If the EVENT option has been specified with a I
READ statement, the operation is not completed until the corresponding WAIT statement I
is reached; in the meantime, no attempt to delete or rewrite the record should be I
made. I
L---------------------------------------------------------------------------------------J
Figure 10.1. Effect of operations on EXCLUSIVE files
data transmission are described in chapter file has not been closed before completion
11, ·Stream-Oriented Transmission,· and of the task in which the file was opened,
chapter 12, wRecord-Oriented Transmission,· the file is closed automatically upon
both in Part I. completion of the task.
This chapter describes the input and output constants. The variables to which the data
statements used in stream-oriented items are to be assigned are specified by a
transmission. Those features that apply data list. Items are separated by a comma
equally to stream-oriented and record- and/or one or more blanks.
oriented transmission, including files,
file attributes, and opening and closing output: The data values to be transmitted
files, are described in chapter 10, "Input are specified by a variable, a constant, or
and Output". an expression that represents a data item.
Each data item placed in the stream is a
In stream-oriented transmission, a data character-string representation that
set is treated as a continuous stream of reflects the attributes of the variable.
data items in character form; within a Items are separated by one or more blanks.
program, block and record boundaries are Leading zeros of arithmetic data are
ignored. However, a data set is considered suppressed. Binary items are expressed in
to consist of a series of lines of data, decimal representation.
and each data set that is created or
accessed by stream-oriented transmission For PRINT files, data items are
has a line size associated with it. In automatically aligned on implementation-
general, a line is equivalent to a record defined preset tab positions. These
in the data set; however, the line size positions are 1, 25, 49, 73, 97, and 121,
does not necessarily equal the record size. but provision is made for the programmer to
alter these values.
There are three modes of stream~oriented
transmission: list-directed, data-
directed, and edit-directed. The
transmission statements used in all three DATA-DIRECTED TRANSMISSION
modes require the following information:
1. The name of the file associated with Data-directed transmission permits the user
the data set from which data is to De to transmit self-identifying data.
obtained or to which data is to be
assigned. Input: Each data item in the stream is in
the form of an assignment that specifies
2. A list of program variables to which both the value and the variable to which it
data items are to be assigned during is to be assigned. In general, values are
input or from which data items are to in the form of constants. Items are
be obtained during output. This list separated by a comma and/or one or more
is called a data list. On output in blanks. A semicolon must end ~ach group of
list- and edit-directed modes, the items to be accessed by a single GET
data list can also include statement. A data list in the GET
expressions. statement is optional, since the semicolon
determines the number of items to be
3. For edit-directed mode, the format of obtained from.the stream. (These rules are
each data item in the stream. slightly amended when the program is
initiated and data entered from a terminal
Under certain conditions some of this under TSO. Details are given in the
required information can be implied. following OS publications: Time
Sharing Option: PL/I Optimizing Compiler
and Time Sharing Option: PL/I Checkout
Compiler. )
LIST-DIRECTED TRANSMISSION
output: The data values to be transmitted
may be specified by an optional data list.
List-directed transmission permits the user Each data item placed in the stream has the
to read and write out data without having form of an assignment statement without a
to specify the format of the items in the semicolon. Items are separated by one or
stream. more blanks. The last item transmitted by
each PUT statement is followed by a
Input: In general, the data items in the semicolon. Leading zeros of arithmetic
stream are character strings in the form of data are suppressed. The character
optionally signed valid constants or in the representation of each value reflects the
form of expressions that represent complex attributes of the variable, except for
STREAM OUTPUT:
EDIT-DIRECTED TRANSMISSION
PUT ({FILE (file-expression)} I{STRING
(character-string-variable)}]
Edit-directed transmission permits the user (data-specification]
to specify the variables to which data is [SKIP (expression)]];
to be assigned or to specify data to be
transmitted, and to specify the format for Note that the SKIP option cannot be used
each item on the external medium. with the STRING option in a PUT statement.
PAGE which may be used with The SKIP option specifies a new current
LINE (w) STREAM OUTPUT PRINT line (or record) within the data set. The
files parenthesized expression is converted to an
integer~. The data set is positioned to
The statements are discussed individually the start of the wth line (record) relative
in detail in section J, "Statements". to the current line (record).
The FILE option specifies the file upon The SKIP option takes effect before the
which the operation is to take place. The transmission of any values defined by the
STRING option allows GET and PUT statements data specification, even if it appears
to be used to transmit data between after the data specification. Thus, the
internal storage locations rather than statement:
between internal and external storage. If
neither the FILE option nor the STRING PUT LIST(X,Y,Z) SKIP(3);
option appears in a GET statement, the
standard input file SYSIN is assumed; if causes the values of the variables X, Y,
neither option appears in a PUT statement, and Z to be printed on the standard output
the standard output file SYSPRINT is file SYSPRINT commencing on the third line
assumed. after the current line.
COpy Option
a. The variable must not be based on 3. If the data list includes the name of
an OFFSET variable. an array, subscripted references to
that array may appear in the stream
b. The variable must not be a member although subscripted names cannot
of a structure declared with the appear in the data list. The entir~
REFER option. array need not appear in the stream;
only those elements that actually
c. The pointer on which the variable appear in the stream will be assigned.
is based must not be based, If a subscript is out of range, or is
defined, or a parameter, and i t missing, the NAME condition is raised.
must not be a member of an array
or structure. Let X be the name of a two-dimensional
array declared as follows:
6. Under the optimizing compiler, defined
variables in the data list must not DECLARE X (2,3);
have been defined:
Consider the following data list and
a. On a controlled variable. input data stream:
1. If the data specification does not 4. If the data list includes the names of
include a data list, the names in the structure elements, then fully
stream may be any names known at the qualified names must appear in the
point of transmission. Qualified stream, although full qualification is
names in the input stream must be not required in the data list.
fully qualified. The name must not Consider the following structures:
contain mOre than 256 characters.
DECLARE 1 CARDIN, 2 PARTNO, 2 DESCRP,
2. If a data list is used, each element 2 PRICE, 3 RETAIL, 3 WHSL;
of the data list must be an element,
array, or structure variable. Names If i t is desired to read a value for
cannot be subscripted, but qualified CARDIN. PRICE. RETAIL, the data
names are allowed in the data list. specification and input data stream
All names in the stream should appear could have the following forms:
in the data list; however, the order
of the names need not be the same, and Data Specification Input Data Stream
the data list may include names that
do not appear in the stream. For DATA (CARDIN.RETAIL) CARDIN. PRICE.
example, consider the following data RETAIL = 4.28;
DATA (Y(1,-3).Q)
General rules for data-directed output:
the associated data field in the
1. An element of the data list may be an output stream is of the form:
element, array, or structure variable,
or a repetitive specification Y.Q{1,-3)= 3.756;
involving any of these elements or
further repetitive specifications. 5. Structure names in the data list are
Subscripted names can appear. For interpreted as a list of the contained
problem data, the names appearing in element or elements, and any contained
the data list, together with their arrays are treated as above.
values, are transmitted in the form of
a list of element assignments For example, consider the follOWing
separated by blanks and terminated by structure:
a semicolon. (For PRINT files, items
are separated according to program tab 1 A, 2 B, 2 C, 3 D
settings.)
If a data list for data-directed
The rules applying to program control output is as follows:
data are given in chapter 15,
"Execution-time Facilities of the DATA (A)
Checkout Compiler."
and the values of Band Dare 2 and
2. Array variables in the data list are 17, respectively, the associated data
treated as a list of the contained fields in the output stream would be
subscripted elements in row-major as follows:
order.
A.B= 2 A.C.D= 17;
Consider an array declared as follows:
6. In the following cases, data-directed
DECLARE X (2,4) FIXED; output is not valid for subsequent
data-directed input:
If X appears in a data list as
follows: a. When the character-string value of
a riumeric character variable does
DATA (X) not represent a valid optionally
Signed arithmetic constant. For
on output, the output data stream example, this is always true for
would have the form: complex numeric character
variables.
X(l,l)= 1 X(1,2)= 2 X(1,3)= 3
X{1,4)= 4 X(2,1)= 5 X,(2,2)= 6 b. When a program control variable is
X(2,3)= 7 X(2,4)= 8; transmitted such a variable must
not be specified in an input data
~ In actual output, more than one list.
Length of Data-Directed output Fields 1. The data list, which must be enclosed
in parentheses, is described in "Data
Lists", above. The format list, which
The length of the data field on the also must be enclosed in parentheses,
external medium is a function of the contains one or more format items.
attributes declared for the variable and, There are three types of format items:
since the name is also included, the length data format items, which describe data
of the fully qualified subscripted name. in the stream: control format items,
The field length for output items converted which describe page, line, and spacing
from coded arithmetic data, numeric operations; and remote format items,
character data, and bit-string data is the which specify the label of a separate
same as that for list-directed output data, statement that contains the format
and is governed by the rules for data list to be used. Format lists and
conversion to character type as described format items are discussed in more
in section F, "Data Conversion and detail in "Format Lists", below.
Expression Evaluation".
~ Program-control variables
For character-string data, the contents cannot be specified in data lists for
of the character string are written out edit-directed transmission.
enclosed in quotation marks. Each
quotation mark contained within the 2. For input, data in the stream is
character string is represented by two considered to be a continuous string
successive quotation marks. of characters not separated into
indiVidual data items. The number of
characters for each data item is
specified by a format item in the
Example format list. The characters are
treated according to the associated
format item.
In the example shown in figure 11.2, A is
declared as a one-dimensional array of six 3. For output, the value of each item in
elements: B is a one-dimensional array of the data list is converted to a format
seven elements. The procedure calculates specified by the associated format
and writes out values for All) = B(I+1) + item and placed in the stream in a
B(l). field whose width also is specified by
the format item.
6.
associated with a separate use of a
data format item.
n item
item
n item
1 •••
encountered, the control action is
executed, and the data list item is n (format-list) [: n (format-list)
paired with the next format item.
The second example specifies that the There are three types of format items:
character string 'INVENTORY=' is to be data format items, control format items,
concatenated with the value of INUM and and the remote format item. Data format
placed in the stream in a field whose width items specify the external forms that data
is the length of the resultant string. fields are to take.' Control format items
Then the value of INVCODE is to be specify the page, line, column, and spacing
converted to character to represent an operations. The remote format item allows
optionally signed decimal fixed-point format items to be specified in a separate
integer constant and is then to be placed FORMAT statement elsewhere in the block.
in the stream right-adjusted in a field
with a width of five characters (leading Detailed discussions of the various
1.Can also be used with non-PRINT files: see ·Options of Transmission statements·,
earlier in this chapter, and "ENVIRONMENT Attribute" on this page.
L---------------------------------------------------------------------------------------J
Figure 11.3. Options and format items for controlling layout of PRINT files
BUFFERS(n)
Standard File SYSPRINT
CONSECUTIVE
Undefined-length Records
b. Both the BLKSIZE and the RECSIZE Record length: The specified or default
options are specified, and the LINESIZE value is used:
relationship of the two values is
compatible with blocking for the PRINT files:
record format used. The records F, FB, FBS, or U: LINESIZE + 1
are assumed to be blocked and the V, VB, D, or DB: LINESIZE + 5
record format is set to FB, VB, or
DB whichever is appropriate. Non-PRINT files:
F, FB, FBS, or U: LINESIZE
2. If, for FB-format or FBS-format V, VB, D, or DB: LINESIZE + 4
The volume disposition options allow the BUFOFF Option and Block Prefix Fields
programmer to specify the action to be
taken when the end of a magnetic tape
volume is reached, or when a data set on a At the beginning of each block in an ASCII
magnetic tape volume is closed. The LEAVE data set, there may be a field known as the
option prevents the tape from being block prefix field. It may be from one to
rewound. The REREAD option rewinds the 99 bytes long. The buffer offset option
tape to permit reprocessing of the volume indicates the length of this field to data
or data set. If neither of these is management, so that the accessing or
specified, the action at end of volume or creation of data is started at this offset
on closing of a data set is controlled by from the beginning of each phYSical block.
the DISP parameter of the associated DD PL/I does not support access to this field,
statement. The effects of the options are and in general it does not contain
summarized in figure 11.4. information which is used in OS
implementations. There is one situation in
which data management does use information
in the block prefix: with unblocked or
blocked variable length records (that is,
D- or DB-format records), the block prefix
ASCII DATA SETS field may be used to record the length of
the block. In this case, it is four bytes
long and contains a right-aligned, decimal
Data sets on magnetic tape using ASCII may character value that gives the lengtn of
be created and accessed in PL/I. The the block in bytes, including the block
implementation supports F, U, and D record prefix field itself. It is then exactly
formats. F and U formats are treated in equivalent to a block length field.
the same way as with other data setsJ D and
DB formats, which correspond to V and VB The format of the buffer offset option
formats with other data sets, are described is BOFOFF (n»). A numerical value equal
below. to the length of the prefix can be
specified for wnw. It may be specified as
In addition to the record format, two either a decimal integer constant or as a
other ENVIRONMENT options may be specified: variable with the attributes FIXED
ASCII, and the buffer offset option BUFOFF. BINARY(31,O) STATIC. Its minimum value is
This chapter describes the input and output Unaligned Bit Strings
statements used in record-oriented
transmission. Those features of PL/I that
apply equally to record-oriented and The following may not be transmitted.
stream-oriented transmission, including
files, file attributes, and opening and 1. BASED, DEFINED, parameter,
closing files, are described in chapter 10, subscripted, or structure-base-element
-Input and Output". variables that are unaligned fixed-
length bit strings.
In record-oriented transmission, data in
a data set is considered to be a collection 2. Minor structures whose first or last
of records recorded in any format base elements are unaligned fixed-
acceptable to the operating system. No length bit strings (except where they
data conversion is performed during record- are also the first or last elements of
oriented transmission: on input, the READ the containing major structure).
statement either causes a single record to
be transmitted to a program variable 3. Major structures that have the DEFINED
exactly as it is recorded in the data set, attribute or are parameters, and that
or else sets a pointer to the record in a have unaligned fixed-length bit
buffer: on output, the WRITE, REWRITE, or strings as their first or last
LOCATE statement causes a single record to elements.
be transmitted from a program variable
exactly as it is recorded internally.
I Although, for non-VSAM data sets, data is
actually transmitted to and from a data set Varying-Length Strings and Area
in blocks, the statements used in record- Variables
oriented transmission are concerned only
with records: the records are blocked and
deblocked automatically. A locate mode output statement (see "LOCATE
Statement-, later in this Chapter)
specifying a varying-length string causes
the transmission of a field having a length
equal to the maximum length of the string,
plus a two-byte prefix denoting the current
length of the string. The SCALARVARYING
Data Transmitted option must be specified for the file. A
locate mode output statement specifying an
area variable causes the transmission of a
Most variables, including parameters and field as long as the declared size of the
DEFINED variables, can be transmitted by area, plus a 16-byte prefix containing
record-oriented transmission statements, control information.
and in general, the information given in
this chapter may be applied equally to all A move mode output statement (see -WRITE
variables. There are certain special Statement" and "REWRITE statement" later in
considerations for a few types of data, and this chapter) specifying a varying-length
these are given below. string variable transmits only the current
length of the string. A two-byte prefix is
included only if the SCALARVARYING option
is specified for the file. A move mode
statement specifying an element area
Data Aggregates variable or a structure whose last element
is an area variable transmits only the
current extent of the area plus a 16-byte
The following restrictions apply to data prefix.
aggregates:
1. An aggregate must be in connected
storage. (An aggregate parameter must Data Transmission Statements
have the CONNECTED attribute).
2. For the LOCATE statement, the variable The follOWing is a general description of
must be a level 1 based variable. the record-oriented data transmission
READ statement
DELETE Statement
The READ statement can be used with any
INPUT or UPDATE file. It causes a record The DELETE statement specifies that a
to be transmitted from the data set to the record in an UPDATE file be deleted.
program, either directly to a variable or
to a buffer. In the case of blocked
records, a READ statement with the
appropriate option causes a record to be UNLOCK Statement
transferred from a buffer to the variable
or sets a pointer to the record in a
buffer; consequently, not every READ The UNLOCK statement is used in association
statement causes transmission of data from with a READ statement that refers to an
an input device. EXCLUSIVE file. The UNLOCK statement makes
the specified record available to other
tasks in addition to that for which the
READ statement was issued.
WRITE statement
The WRITE statement can be used with any Options of Transmission Statements
OUTPUT file or DIRECT UPDATE file, and also
Iwith SEQUENTIAL UPDATE files associated
Iwith VSAM data sets. It causes a record Options that are allowed for record-
to be transmitted from the program to the oriented data transmission statements
data set. For unblocked records, differ according to the attributes of the
transmission may be directly from a file and the characteristics of the
variable or from a buffer. For blocked associated data set. Lists of all of the
records, the WRITE statement causes a allowed combinations for each type of file
logical record to be placed into a buffer; are given in figures 12.8 through 12.15,
only when the blocking of the records is later in this chapter.
complete is there actual transmission of
data to an output device. Each option consists of a keyword
followed by a value, which is a file
expression, a variable, or an expression,
enclosed in parentheses. In any statement,
the options may appear in any order.
REWRITE statement
1ST
READ
INPUT
IUFFER
VARIAIU
(DATA)
D
1ST 2ND 3RD
WRITE WRITE WRITE
! I
OUTPUT
IUFFER
I
r
A
,
.'A
lit
I
Piqure 12.1.
I I I
Input and output: move mode
1ST
READ
INPUT
BUFFER
I I I
pl pt Pt
1ST 2ND lRD
READ READ READ
1ST 2 NO lRD
WRITE WRITE WRITE
OUTPUT
BUFFER
I I I
lRD
WRITE
__------------~)l,---------------
( '\
DATA
SET
I
Figure 12.2. Locate mode input, move mode output
I
Chapter 12: Record-oriented Transmission 163
Idata set, the option is ignored. capacity.
Recor.ds can have one of the following
formats: FBS-format: The records are blocked. Only
the last block can be a short block.
Fixed-length F unblocked
FB blocked A consecutive data set is said to contain
FS unblocked, standard FBS-format records if:
FBS blocked, standard
1. All records in the data set are FB-
Variable ~length v unblocked format
VB blocked
VS spanned 2. For direct-access storage, every track
VBS blocked, spanned except the last one is filled to
D unblocked (see "ASCII capacity.
Data Sets")
DB blocked (see ASCII 3. No blocks except the last one are
Data Sets") truncated.
undeffned-Iength U (cannot be blocked) Data sets with standard format (FS or FBS)
records can be read from direct-access
Blocking and deblocking of records is storage more efficiently than data sets
performed automatically. with truncated blocks or embedded unfilled
tracks.
All records, whatever the format, consist
of data bytes and, optionally, control or
prefix bytes. variable-length records
include control or prefi::: bytes to specify variable-length Records
record and block lengtbs; the use of these
bytes is described later in this section.
In addition, any record (whatever the Each record can be a different length.
format) can have an optional printer or
machine control character in the first data V-format: The records are unblocked; each
byte. The programmer must insert the record constitutes a single block. Each
character himself, and must indicate the record consists of:
presence of such a character by means of
the CTLASA or CTL360 options of the Four control bytes
ENVIRONMENT attribute, or by means of the
equivalent field of the DCB subparameter in Data bytes
the associated DD statement.
The four control bytes contain the
The SCALARVARYING option (described later record length (that is, the length of
in this section) can be specified with the current record including the four
records of any format. This option cannot control bytes); this value is inserted
be specified if the first data byte automatically and requires nO action by
contains a printer or a machine control the programmer. In addition, four extra
character, as this would lead to an control bytes are placed at the
ambiguous interpretation of this byte. beginning of the block. Thes~ bytes
contain the block size including all
control bytes; the value is inserted in
the same way in the record length.
Fixed-length Records
VB-format: The records are blocked. Each
record consists of:
All records in the data set are the same
length. Four control bytes
FS-format: The records are unblocked. each VS-format: Each record constitutes at
record constitutes a single block. For least one block. On CONSECUTIVE data
direct-access storage, every track sets, record length can be greater than
except the last one is filled to block size; if it is, the record can
Note: The TOTAL option cannot be specified A teleprocessing file can be declared
for files associated with VSAM data sets or with the following attributes only:
for device-associated files (described
later in this chapter), or for files FILE
reading Optical Mark Read data. RECORD
INPUT or OUTPUT
The statement READ SET will always be BUFFERED or UNBUFFERED
implemented by in-line code if it specifies TRANSIENT
a file declared or indicated as above, KEYED
except when a file with the attribute ENVIRONMENT
BACKWARDS is used to transmit U-format
records. The other record I/O statements, For teleprocessing applications, the
namely READ INTO, WRITE FROM, and LOCATE, only environment options that can be
generate in-line code provided: specified are:
r---------------------------------------------------------------------------------------,
CTLASA code I CTL360 code bytes I ,
-----------------------------------------------------------------1
action before I action after I action without, Action
I
I
printing 1 printing I printing I I
+ 00000001 print only (no space)
b 00001001 00001011 Space 1 line
'0 00010001 00010011 Space 2 lines
00011001 00011011 Space 3 lines
1 10001001 10001011 Skip to channel 1
2 10010001 10010011 Skip to channel 2
3 10011001 10011011 Skip to channel 3
4 10100001 10100011 Skip to channel 4
5 10101001 10101011 Skip to channel 5
6 10110001 10110011 Skip to channel 6
7 10111001 10111011 Skip to channel 7
8 11000001 11000011 Skip to channel 8
9 11001001 11001011 Skip to channel 9
A 11010001 11010011 Skip to channel 10
B 11011001 11011011 Skip to channel 11
C 11100001 11100011 Skip to channel 12
L---------------------------------------------------------------------------------------J
Figure 12.4. CTLASA and CTL360 print control codes for the IBM 1403 Printer
tape to permit reprocessing of the data associated with CONSECUTIVE data sets.
set. If neither of these is specified, the They specify that the first character of a
action at end of volume or on closing of a record is to be interpreted as a control
data set is controlled by the DISP character.
parameter of the associated DD statement.
The effects of the options are summarized
in figure 12.3. 1. The CTLASA option specifies ANSI
standard control characters.
The purpose of this option is to aid the The NOWRITE option is used for DIRECT
optimizing compiler in the production of UPDATE files. It informs the compiler that
efficient compiled code. In particular, i t no records are to be added to the data set
allows the compiler to use in-line code for and that data management modules concerned
certain I/O operations (see "Optimization solely with adding records are not
of Input/Output Operations" earlier in this required; i t thus allows the size of the
chapter). It specifies that no attributes object program to be reduced.
will be merged from the OPEN statement or
the I/O statement. In other words, the The ADDBUFF option can be specified for
complete set of attributes is to be built a DIRECT INPUT or DIRECT UPDATE file with
up at compile time from explicitly declared INDEXED data set organization and F-format
and default attributes. records to indicate that an area of
internal storage is to be used as a
The UNDEFINEDFILE condition is raised if workspace in which records on the data set
any attribute that was not explicitly can be rearranged when new records are
declared appears on the OPEN statement, or added. The size of the workspace is
if the I/O statement implies a file assumed to be equivalent to one track of
attribute that conflicts with a declared or the direct device used. The option need
default attribute. not be specified for DIRECT INDEXED files
with V-format records, as the workspace is
The checkout compiler accepts and checks automatically allocated for such files.
the TOTAL option but does not perform any
optimization.
When a CONSECUTIVE data set is accessed by There are two kinds of keys, recorded keys
a SEQUENTIAL UPDATE file, a record must be and source keys. A recorded key is a
retrieved with a READ statement before it character string that actually appears with
can be updated by a REWRITE statement; each record in the data set to identify
however, every record that is retrieved that record; its length cannot exceed 255
need not be rewritten. A REWRITE statement characters. A source key is the character-
will always update the last record read. string value of the expression that appears
in the KEY or KEYFROM option of a data
Consider the following: transmission statement to identify the
record to which the statement refers; for
READ FILE(F) INTO(A); direct access of an INDEXED data set, each
transmission statement must include a
source key.
the use of either option is shown in figure each record, even when there is already an
12.10. embedded key. If the records are blocked,
the key of only the last record in each
Programs written for the PL/I F Compiler block is recorded separately in front of
which use records with embedded keys can be the block.
compiled without alteration to the
ENVIRONMENT attribute for the inclusion of During the execution of a WRITE
the KEYLOC option, if the original RKP statement that adds a record to a data set
subparameter is specified when the with embedded keys, the value of the
recompiled program is executed. expression in the KEYFROM option is
assigned to the embedded key position in
The use of embedded keys avoids the need the record variable. Note that a record
for the KEYTO option during sequential variable can be declared as a structure
input, but the KEYFROM option is still with an embedded key declared as a
required for output. (However, the data structure member, but that such an embedded
specified by the KEYFROM option may be the key must not be declared as a VARYING
embedded key portion of the record variable string.
itself.) In a data set with unblocked
records, a separate recorded key precedes For a LOCATE statement, the KEYFROM
~The complete file declaration would include the attributes FILE, RECORD, and
ENVIRONMENT: if any of the options KEY, KEYFROM, and KEYTO is used, i t must
also include the attribute KEYED.
Notes: The attribute UNBUFFERED is ignored and BUFFERED is assumed for INDEXED
SEQUENTIAL and SEQUENTIAL files.
Use of the DELETE statement is invalid if OPTCD=L (DCB subparameter) was not
specified when the data set was created or if the RKP subparameter is zero for
FB records, or four for V and VB records.
L---------------------------------------------------------------------------------------J
Figure 12.9 (part 2 of 2). Statements and options permitted for creating and
accessing INDEXED data sets
r---------------------------------------------------------------------------------------1
I I I Data Set
KEYLOC
II RKP
I
I Record Variable
1-----------------------
I Unblocked I Blocked
(n) I I I records I records
---------------------------------------------------------------------------------------
n>l I RKP equivalent = Key Key I Key
I n-1+C~ I
---------------------------------------------------------------------------------------
n=l I No equivalent Key Key2 I Key
Records within an INDEXED data set are Embedded keys in a record to be updated
either actual records containing valid data must not be altered. The modified record
or dummy records. A dummy record is must always overwrite the updated record in
identified by the constant (8)'1'B in its the data set.
first byte. Dummy records can be inserted
by the programmer, or can be created by Additionally, records can be effectively
deleting records. They can be replaced by deleted from the data set; a DELETE
valid data records having the same keys as statement marks a record as a dummy by
the dummy records. The sUbparameter putting (8)'1'B in the first byte. The
OPTCD=L must be included in the DD DELETE statement should not be used to
statement that defines the data set when it process a data set with F-format blocked
is created, so that dummy records are records and either KEYLOC=l or RKP=O, or V-
recognized and not retrieved by READ or VB-format records and either KEYLOC=l or
statements. RKP=4. (The code (8) 'l'B would overwrite
the first byte of the recorded key.) Note
that the EVENT option is not supported for
SEQUENTIAL access of INDEXED data sets.
CREATING A DATA SET
During sequential access of an INDEXED
data set, i t is possible to read a
When an INDEXED data set is being created, particular record by supplying a source key
the associated file must be opened for in the KEY option of a READ. statement, and
SEQUENTIAL OUTPUT, and the records must be to continue sequential reading from that
presented in the order of ascending key pOint in the data set. (The associated
values. (If ther~ is an error in the key file must have the KEYED attribute.) Thus,
sequence, the KEY condition will be a READ statement that includes the KEY
raised.) A DIRECT file cannot be used for option will cause the record, whose key is
the creation of an INDEXED data set. supplied, to be read; a subsequent READ
statement without the KEY option will cause
Once an INDEXED data set has been the record with the next higher recorded
created, the file that accesses i t can be key to be read (even if the keyed record
opened for SEQUENTIAL INPUT or UPDATE, or has not been found).
for DIRECT INPUT or UPDATE. In the case of
F-format records, it can also be opened for The effect of supplying a source key
OUTPUT to add records at the end of the that is shorter than the recorded keys in
data set. The keys for these records must the data set differs according to whether
have higher values than the existing keys or not the GENKEY option is specified in
for that data set and must be in ascending the ENVIRONMENT attribute. In the absence
order. The storage allocated for a data of the GENKEY option, the source key is
set can be increased when it is required padded on the right with blanks to the
for output. length specified in the KEYLENGTB option of
the ENVIRONMENT attribute, and the record
with this padded key is read (if such a
record exists). If the GENKEY option is
SEQUENTIAL ACCESS specified, the source key is interpreted as
a generic key, and the first record with a
key in the class identified by this generic
A SEQUENTIAL file that is used to access an key is read. (Refer to -Key
INDEXED data set may be opened with either Classification,- above.)
the INPUT or the UPDATE attribute. The
data transmission statements need not
include source keys, nor need the file have
the KEYED attribute. Sequential access is DIRECT ACCESS
in order of ascending recorded-key values;
records are retrieved in this order, and
not necessarily in the order in which they A DIRECT file that is used to access an
were added to the data set. Dummy records INDEXED data set may be opened with either
are not retrieved if the DO statement that the INPUT or the UPDATE attribute. All
defined the data set included the data transmission statements must include
key is presented, the KEY condition will be string variable specified in the KEYTO
raised. When the file is closed, any space option has more than eight characters, the
remaining at the end of the current extent value returned (the region number) is
is filled with dummy records. padded on the left with blanks: if it has
fewer than eight characters, it is
If a data set is created using a truncated on the left.
buffered file, and the last WRITE or LOCATE
statement before the file is closed sequential access is in the order of
attempts to transmit a record beyond the ascending region numbers. All records are
limits of the data set, the CLOSE statement retrieved, whether dummy or actual, and the
may raise the ERROR condition. PL/I program should be prepared to
recognize dummy records.
If a DIRECT OUTPUT file is used to
create the data set, the whole of the The rules governing the relationship
primary extent allocated to the data set is between READ and REWRITE statements for a
filled with dummy records when the file is SEQUENTIAL UPDATE file that accesses a
opened. REGIONAL (1) data set are identical to those
for a CONSECUTIVE data set (described
Once a REGIONAL(l) data set has been above).
created, the file that accesses it can be
opened for SEQUENTIAL INPUT or UPDATE, or
for DIRECT INPUT or UPDATE. It can be
opened for OUTPUT only if the existing data
set is to be overwritten. Direct Access
When a record is added to the data set Consider the following examples of
by direct access, it is written with its source keys (the character "b W represents a
recorded key in the first available space blank):
after the beginning of the track that
contains the region specified. When a KEY ('JOHNbDOEbbbbbb12363251')
record is read by direct access, the search
for a record with the appropriate recorded The rightmost eight characters make up the
key begins at the start of the track that region specification, the relative number
contains the region specified. Unless it of the record. Assume that the associated
is limited by the LIMCT subparameter of the DO statement has the subparameter
DO statement that defines the data set, the KEYLEN=14. In retrieving a record, the
search for a record or for space to add a search will begin with the beginning of the
record continues right through to the end track which contains the region number
of the data set and then from the beginning 12363251, until the record is found having
until the whole of the data set has been the recorded key of JOHNbDOEbbbbbb.
covered. The closer a record is to the
specified region, the more quickly it can If the subparameter were KEYLEN=22, the
be accessed. search still would begin at the same place,
but SinCE the comparison and the source key
are the same length, the search would be
for a record having the recorded key
Source Keys 'JOHNbDOEbbbbbb12363251'.
KEY C'JOHNbDOEbbbbbbDIVISIONb423bbbb34627')
The character-string value of the source
key can be thought of as having two logical In this example, the rightmost eight
parts, the region number and a comparison characters contain leading blanks, which
key. On output, the comparison key is are interpreted as zeros. The search will
written as the recorded key: for input, it begin at region number 00034627. If
is compared with the recorded key. KEYLEN=14 is specified, the characters
DIVISIONb423b will be ignored.
The rightmost eight characters of the
source key make up the region number, which Assume that COUNTER is declared FIXED
must be an unsigned decimal integer that BINARY (21) and NAME is declared
I 't
1
1
I IKEYTO(character-string-
I
I
variable)
1 IREAD FILE(file-expr):2 I EVENT (event-variable)
I I land/or
I t I IGNORE (expression)
1---------------------------------------------------------------------------------------
ISEQUENTIAL UPDATEtREAD FILE(file-expr) INTO(variable); IKEYTO(character-string-
BUFFERED 1 I variable)
1 lor KEY(expression)3
1 I
tREAD FILE(file-expr) SET(pointer-variable); IKEYTOCcharacter-string-
, I variable)
1 lor KEY(expression)3
I I
IREAD FILE(file-expr);2 IIGNORECexpression)
I I
IWRITE FILE(file-expr) FROMCvariable): IKEYTOCcharacter-string-
1 I variable)
I I
IREWRITE FILE(file-expr); IFROM(variable) and/or
, I KEY (expression) 3
SEQUENTIAL UPDATEIREAD FILE(file-expr) INTOCvariable); 1EVENT (event-variable)
I UNBUFFERED
I
t , land/or either
IKEY(expression)30r
I
I ,,1 IKEYTO{character-string-
I variable)
1 I
I
t ,
tREAD FILE(file-expr);2 IEVENTCevent-variable)
land/or
,(continued)
L ,
_____________________________________________________ ----------------------------------J
I IGNORE Cexpression)
Figure 12.12 (Part 1 of 2). Statements and options permitted for loading and
accessing VSAM entry-sequenced data sets
1The complete file declaration would include the attributes FILE, RECORD, and
ENVIRONMENT; if either of the options KEY or KEYTO is used, it must
also include the attribute KEYED.
3The expression used in the KEY option must be a relative byte address obtained by
means of the KEYTO option.
L---------------------------------------______________ ----------------------------------J
Figure 12.12 (Part 2 of 2). Statements and options permitted for loading and
accessing VSAM entry-sequenced data sets
DIRECT or a SEQUENTIAL file may be used. loptions KEY, KEYTO, or KEYFROM is used, the
Ifile must also have the KEYED attribute.
For a DIRECT OUTPUT file, each record is I
placed in the position specified by the I For READ statements without the KEY
relative record number (or key) in the I option, the records are recovered in
KEYFROM option of the WRITE statement (see lascending relative record number order.
"Keys for VSAM Data sets" earlier in this IAny empty slots in the data set are skipped
chapter). lover.
I
For a SEQUENTIAL OUTPUT file, WRITE I If the KEY option is used, the record
statements with or without the KEYFROM Irecovered by a READ statement is the one
option may be used. If the KEYFROM option Iwith the specified relative record number.
is specified, the record is placed in the ISuch a READ statement positions the data
specified slot; if it is omitted, the ,set at the specified record; subsequent
record is placed in the slot following the Isequential reads will recover the following
current position. There is no requirement
for the records to be presented in
ascending relative record numbers. If the
,
Irecords in sequence.
EVENT Cevent-variable)
I
I and/or IGNORE(expression)
I
I WRITE FILECfile-expr) FROMCvariable) EVENT (event-variable)
I (continued) KEYFROM(expression);
L---------------------------------------------------------------------------------------J
Figure 12.13 CPart 1 of 3). Statements and options permitted for creating and
accessing VSAM data sets via prime or alternate indexes
,,IDELETE
KEY(expression); ,,
I EVENT (event-variable)
L---------------------------------------------------------------------------------------J
Figure 12.13 (Part 2 of 3). statements and options permitted for creating and
accessing VSAM data sets via prime or alternate indexes
is rewritten is the record with the The "data set" associated with each
specified relative record number; otherwise TRANSIENT file is in fact an input or
it is the record that was accessed by the output message queue set up by the MCP. A
previous READ statement. READ statement for the file will take the
next message (or the next record from the
DELETE statements, with or without the current message) from the associated queue,
KEY option, may be used to delete records assign the data part to the variable named
from the data set. in the READ INTO option (or set a pointer
to point to the data in a READ SET buffer),
and save the origin name by assigning i t to
Direct Access the variable named in the KEYTO option.
(The PENDING condition is raised if the
input queue is empty when the READ
IA DIRECT file used to access an RRDS may statement is executed.) A WRITE or LOCATE
Ihave the OUTPUT, INPUT. or UPDATE statement will transmit the processed
I attribute. Records may be read, written, message or record to the output queue,
I rewritten, or deleted exactly as though a using the element expression specified in
IKEYED SEQUENTIAL file were used. the KEYFROM option to identify the
destination.
Telepro cessing
ENVIRONMENT Attribute
Figure 12.14 (Part 2 of 3). statements and options permitted for creatin9 and
accessing VSAM relative-record data sets
Figure 12.14 (Part 3 of 3). statements and options permitted for creating and
accessing VSAM relative-record data sets
RECSIZE: Size of the record variable (or program. The queue is always accessed
input or output buffer, for locate sequentially.
mode) in the PL/I program. If the
TP(M) option is used, this size The data set associated with a TRANSIENT
should, if possible, be equal to file differs from those associated with
the length of all the logical DIRECT and SEQUENTIAL files in that its
records that constitute the contents are dynamiC: reading a record
message. If it is smaller, part removes it from the data set. Such a da~a
of the message will be lost. If set can never be created by a DIRECT or
it is greater, the contents of the SEQUENTIAL file. (It can, however, be
last part of the variable (or accessed as a CONSECUTIVE data set by a
buffer) are undefined. If the SEQUENTIAL file.)
TP(R) option is specified, this
size must be the same as the The TRANSIENT attribute can be specified
logical record length. only for RECORD KEYED BUFFERED files with
either the INPUT or the OUTPUT attribute.
BUFFERS: Number of intermediate buffers (The EVENT option cannot be used for
required to contain the longest teleprocessing operations.) The file may
message to be transmitted. If a also have the ENVIRONMENT attribute with
message is too long for the the options appropriate to teleprocessing.
buffers specified, extra buffers
must be obtained before processing For TRANSIENT files, the file name or
can continue, which increases title must be the ddname of a DO statement.
execution time. The extra buffers The message queue data set is identified in
are obtained by the operating the DO statement by the QNAME parameter.
system: the programmer need not For a TRANSIENT OUTPUT file, the element
take any action. expression specified in the KEYFROM option
must have as its value a recognized
These are the only options of the terminal or program identification.
ENVIRONMENT attribute that can be specified
for a TRANSIENT file.
Error Handling
TRANSIENT Attribute
The conditions that can be raised during
teleprocessing transmission are TRANSMIT,
The TRANSIENT attribute, which is an KEY, RECORD, ERROR, and PENDING.
alternative to the DIRECT and SEQUENTIAL
attributes, indicates that the contents of The TRANSMIT condition can be raised
the data set associated with the file are only on input, and is as described for
re-established each time the data set is other types of transmission.
accessed. In effect, this means that
records can be continually added to the The RECORD condition is raised in the
data set by one program during the same circumstances as for other types of
execution of another program that transmission. (The messages and records
continually removes records from the data are treated as V-format records.)
set. Thus the data set can be considered
to be a continuous queue through which the The ERROR condition is raised as for
records pass in transit between the message other types of transmission; it is also
control program and the message processing raised when the expression in the KEYFROM
The READ statement is used for input, with The READ statement causes the message or
either the INTO option or the SET option: record to be moved from the input buffer
the KEYTO option must be given. The origin into the variable INREC: if the buffer is
name is assigned to the variable named in empty when the READ statement is executed
the KEYTO option. If the-origin name is (i.e., there are no messages in the queue),
shorter than the character-string variable the PENDING condition is raised. 'I'he
named in the KEYTO option, i t is padded on standard system action for the condition is
the right with blanks. If the KEYTO to suspend execution and wait until a
variable is a varying-length string, its message is available. The name of the
current length is set to that of the origin origin is aSSigned to TERM.
name. The origin name should not be longer
than the KEYTO variable_(if it is, i t is After processing, the message or record
truncated), but in any case will not be is held in OUTREC. The WRITE statement
longer than 8 characters. The data part of moves i t to the output buffer, together
the message or record is a~signed to the with the value of TERM (which will still
variable named in the INTO option, or the contain the origin name unless another name
pointer variable named in the SET option is has been assigned to it during processing).
set to point to the data in the READ SET From the buffer, the message will be
buffer. automatically transmitted to the correct
queue for the destination, as specified by
Either the WRITE or the LOCATE statement the value of TERM.
may be used for output: either statement
must have the KEYFROM option -- the first Since the output queue is determined
eight characters of the value of the from the destination name, the fite name
KEYFROM expression are used to identity the OOT has no significance outside the PL/I
destination. The data part of the message program. However, the file would need the
is transmitted from the variable named in TRANSIENT, KEYED, and BUFFERED attributes,
the FROM option of the WRITE statement: or, and the correct message format in the
in the case of LOCATE, a pOinter variable ENVIRONMENT attribute.
is set to point to the location of the data
in the output buffer. When a message is DECLARE (IN INPUT,OUT OUTPUT) FILE
transmitted by an OUTPUT TRANSIENT file as TRANSIENT ENV(TP(M) RECSIZE(124»,
a number of logical records, the end of the MESSAGE CHARACTER(120) VARYING
message must be indicated by closing the BASED(INPTR),
file. TERM CHARACTER(S):
1 BUFFERED, and the ENVIRONMENT attribute with either the TP(M) or the TP(R) option.
L---------------------------------------------------------------------------------------J
Figure 12.15 statements and options permitted for TRANSIENT files
READ FILE (IN) SET (INPTR) KEYTO(TERM); the processing program could consist of a
number of subtasks, each associated with a
different queue. Each subtask processes
the input from its associated queue, and
WRITE FILE(OUT) FROM (MESSAGE) transmits output to the required
KEYFROM(TERM); destination. As soon as the PENDING
condition is raised in a subtask, another
This example is similar to the previous subtask could receive input or transmit
one, except that locate mode input is used; output.
the message data is processed in the input
buffer, using the based variable MESSAGE,
which has been declared with the pOinter Summary of Record-Oriented
variable INPTR. (The data of the message
will be aligned on a doubleword boundary.) Tr ansmission
Note that the attribute TRANSIENT implies
KEYED and BUFFERED. The WRITE statement The following points cover the salient
moves the processed data from the input to features of record-oriented transmission:
the output buffer; otherwise its effect is
as described for the WRITE statement in the 1. A SEQUENTIAL file specifies that the
first example. acceSSing, creation, or modification
of the data set records is performed
The technique used in this example would in a particular order:
be useful in applications where the
differences between processed and CONSECUTIVE or REGIONAL data set; from
unprocessed messages were relatively the first record of the data set to
simple, since the maximum size of input and the last record of the data set (or
output messages would be the same. If the from the last to the first if the
length and structure of the output message BACKWARDS attribute has been
could vary widely, depending on the text of specified).
the input message, locate mode output could
be used to advantage; after the input INDEXED or REGIONAL(l) data set; in
message had been read in, a suitable based ascending order of key sequence.
variable could be located in the output
buffer (using the LOCATE statement), where 2. A DIRECT file specifies that records
further proceSSing would take place. The may be processed in random order. The
message would be transmitted immediately particular record is identified by a
before execution of the next WRITE or key.
LOCATE statement for the file.
3. Records in a data set that are
Note that although the EVENT option is accessed, created, or modified by a
not permitted, data transmission could be SEQUENTIAL file mayor may not have
overlapped with processing in an MVT recorded keys. If they do, the
operating system by means of the PL/I recorded keys may be extracted from
multitasking facilities described in the data set or placed into the data
chapter 11, "Multitasking". For example, set by the KEYTO and REYFROM options.
6. When a file has the DIRECT, INPUT or 110. For VSAM data sets, the WRITE
UPDATE, and EXCLUSIVE attributes, it 1 statement is permitted with UPDATE
is possible to protect individual I files. Also, for an ESDS or an RRDS,
records that are read from the data 1 the WRITE statement may have the KEYTO
set. For an EXCLUSIVE file, any READ I option.
statement without a NOLOCK option
automatically locks the record read.
No other task operating upon the same
data set can access a locked record Examples of Declarations of Record
until it is unlocked by the lOCking Files
task. The record is protected from
access by tasks in other jobs, as well
as by those within the same job as the Following are examples of declarations of
locking task. Any task referring to a file constants including the ENVIRONMENT
locked record will wait at that point attribute:
until the record is unlocked. A
record can be explicitly unlocked by DECLARE FILE#3 INPUT DIRECT
the locking task through execution of ENVIRONMENT(V BLKSIZE(328)
a REWRITE, DELETE, UNLOCK, or CLOSE REGIONAL (3 » ;
statement. Records are unlocked
automatically upon completion of the This declaration specifies only three file
locking task. The EXCLUSIVE attribute attributes: INPUT, DIRECT, and ENVIRONMENT.
applies to the data set and not the other implied attributes are FILE (implied
file. consequently, record protection by any of the attributes) and RECORD and
is provided even when all tasks refer KEYED (implied by DIRECT). Scope is
to the data set through use of EXTERNAL, by default. The ENVIRONMENT
different files. attribute specifies that the data set is of
the REGIONAL(3) organization and contains
7. A WRITE statement adds a record to a unblocked varying-length records with a
data set, while a REWRITE statement maximum length of 328 bytes. Note that a
replaces a record. Thus, a WRITE maximum length record will contain only 320
statement may be used with OUTPUT bytes of data to be used by the program,
files, and DIRECT UPDATE files, but a because 8 bytes are required for control
This declaration also specifies only three With this OPEN statement, the file
file attributes: UPDATE, BUFFERED, and attributes would be the same as those
ENVIRONMENT. Implied attributes are FILE, specified (or implied) in the DECLARE
RECORD, and SEQUENTIAL (the last two statement in the second example above (the
attributes are implied by BUFFERED). Scope number of buffers would have to be stated
is EXTERNAL, by default. The data set is in the associated DO statement). The file
of INDEXED organization, and it contains might be opened in this way, then closed,
fixed-length records of 100 bytes each. and then later opened with a different set
Four buffers are to be allocated for use in of attributes, for example:
accessing the data set. Note that although
the data set actually contains recorded OPEN FILE (INVNTRY)
keys, the KEYTO option cannot be specified INPUT SEQUENTIAL KEYED;
in a READ statement, since the KEYED
attribute has not been specified. This OPEN statement allows records to be
read with either the KEYTO or the KEY
Note that for both of the above option. Because the file is SEQUENTIAL and
declarations, all necessary attributes are the data set is INDEXED, the data set may
either stated or implied in the DECLARE be accessed in a purely sequential manner:
statement. None of the attributes can be or, by means of a READ statement with a KEY
changed in an OPEN statement or in a DO option, it may be accessed randomly. A KEY
statement. The second declaration might option in a READ statement with a file of
have been written: this description causes a specified record
to be obtained. Subsequent READ statements
DECLARE INVNTRY without a KEY option access records
ENVIRONMENT(F RECSIZE(100) sequentially, beginning with the next
INDEXED); record.
The data manipulations performed by the If the aSSigned string is shorter than
arithmetic, comparison, and bit-string the length declared for the receiving
operators are extended in PL/I by a variety string variable, the assigned string is
of string-handling and editing features. extended on the right either with blanks,
These features are specified by data in the case of a character-string variable,
attributes, statement options, built-in or with zeros, in the case of a bit-string
functions, and pseudovariables. variable. Assume SUBJECT still has the
attributes CHARACTER (10). Then the
The following discussions give general following two statements assign equivalent
descriptions of each feature, along with values to SUBJECT:
illustrative examples.
SUBJECT = 'PHYSICS';
SUBJECT = 'PHYSICSbbb';
Editing by Assignment
The letter ~ indicates a blank character.
The most fundamental form of editing Let CODE be a bit-string variable with
performed by the assignment statement the attributes BIT(10). Then the following
involves converting the data type of the two statements assign equivalent values to
value on the right-hand side of the CODE:
assignment symbol to conform to the
attributes of the receiving variable. CODE '110011'B;
Because the assigned value is made to
conform to the attributes of the receiving CODE '1100110000'B;
variable, the precision or lengtn of the
assigned value may be altered. Such Note, however, that the following
alteration can involve the addition of statements do not assign equivalent values
digits or characters to and the deletion of to SOBJECT if it has the attributes
digits or characters from the converted CHARACTER (10):
item. The rules for data conversion are
discussed in chapter 4, "Expressions and SUBJECT = '110011'B:
Data Conversions", and in section F, "Data
Conversion and Exp~ession Evaluation". SUBJECT '1100110000'B;
RATE = 7.62;
Picture Character V
When this statement is executed, decimal
pOint alignment occurs on the character V
The V picture specification character and not the decimal point picture character
indicates the position of an assumed that appears in the picture specification
decimal point within the character-string. for RATE. If RATE were printed, it would
For example: appear as '762.00', but its arithmetic
value would be 7.6200.
DCL VALUE PICTURE 'Z9V999';
Unlike the character V, which can appear
The string '12345' represents the numeric only once in a picture specification, the
value 12.345. Note that th~ V character in decimal pOint picture character can appear
the picture specification does not specify more than once; this allows digit groups
a character position in the character- within the numeric character data item to
string representation. In particular, on be separated by points, as is common in
assignment to the data item a decimal pOint Dewey decimal notation and in the numeric
is not included in the character string. notations of some European countries.
SUM = 123;
Picture Character $
SUM = 123.00;
In the first statement, two zero digits are The $ picture character controls the
added to the right of the digits 123. appearance of the currency symbol $ in
specified positions of numeric character
Note the effect of the following data items. For example a dollar sign can
declaration. be appended to the left of a numeric
There are several ways in which signed The I picture specification character
information may be held in a numeric specifies a character position which holds
character data item. The simplest of these the representation of a digit overpunched
is the S character specification. This with a 12-punch if the value is positive or
specifies a character in the character- zero, but just a digit if the value is
string representation which contains '+' if negative.
the value is positive or zero, and "~_I if
the value is negative. It must occur The R picture specification character
either to the right or to the left of all specifies a character position which hold
digit positions. For example: the representation of a digit overpunched
with an ii-punch if the value is negative,
DeL ROOT PICTURE 'S999'; but just a digit if the value is positive.
For example:
50 is held as '+50', zero as '+000' and
-243 as '-243'. Similarly the '+' picture GET EDIT (X) (P'R99');
character specifies a corresponding
character position containing '+' for will set X to (+) 132 on finding '132' in
positive or zero, and blank for negative the next 3 positions of the input stream,
values; the '_I picture character specifies but -132 on finding 'J32'.
a corresponding character position
containing blank for positive or zero, and
1_' for negative values.
other Numeric Character Facilities
'ABC12M'
'bbb09/'
'XYZb13' This structure contains NAME, a minor
structure of character-strings, and
The following values are not (the invalid CODE STRING, a minor structure of bit-
characters are underscored)~ strings. By default, the elements of
PERSONNEL-RECORD have the UNALIGNED
'AB123M' attribute. Consequently, CODE_STRING is
'ABC1/2' mapped with eight elements per byte, that
-
'Mb#AS·, , is, in the same way as a bit-string of
length 25.
When a PL/I program is executed, a large The most common system action is to
number of exceptional conditions are raise the ERROR condition. This provides a
monitored by the system and their common condition that may be used to check
occurrences are automatically detected for a number of different types of errors,
whenever-they arise. These exceptional rather than checking each error type
conditions may be errors, such as overflow individually. standard system action for
or an input/output transmission error, or the ERROR condition depends on the
they may be conditions that are expected processing mode:
but infrequent, such as the end of a file
or the end of a page when output is being Batch processing (opt~izing and checkout
printed. compilers): If the condition is raised
in the major task, the FINISH condition
When checking out a program, a is raised and the program is
programmer can also get a selective flow subsequently terminated. If it is
trace and dumps by specifying that the raised in a subtask, that task is
occurrence of anyone of a list of terminated.
identifiers be treated as an exceptional
condition. Conversational processing (checkout
compiler only): Control is passed to
Each of the conditions for which a test the terminal.
may be made has been given a name, and
these names are used by the programmer to The programmer may specify whether or
control the handling of exceptional not some conditions are to be enabled, that
conditions. The list of condition names is is, are to be checked for so that they will
part of the PL/I language. For keyword cause an interrupt when they arise. If a
names and descriptions of each of the condition is disabled, an occurrence of the
conditions, see section H, -ON-Conditions.- condition will not cause an interrupt.
Under the checkout compiler, the SIZE,
The situations in which these conditions STRINGRANGE, and SUBSCRIPTRANGE conditions
occur is the same for both the optimizing are continuously monitored, whether enabled
and the checkout compilers. The enabling or not.
of these conditions, and the specifying of
the action required when a condition is All input/output conditions and the
raised, are described in this chapter. ERROR, FINISH, and AREA conditions are
always enabled and cannot be disabled. All
with the checkout compiler, the of the computational conditions and the
facilities for making values available to program checkout conditions may be enabled
the programmer during execution are greatly or disabled. The program checkout
extended. These facilities are described conditions and the SIZE condition must be
in chapter 15, -Execution-time Facilities explicitly enabled if they are to cause an
of the Checkout Compiler-. interrupt: all other conditions are enabled
by default and must be explicitly disabled
if they are not to cause an interrupt when
they occur.
Enabled Conditions and Established
Action
A condition that is being monitored, and Condition Prefixes
the occurrence of which will cause an
interrupt, is said to be enabled. Any
action specified to take place when an Enabling and disabling can be specified for
occurrence of the condition causes an the eligible conditions by a condition
interrupt, is said to be established. prefix. A condition prefix is a list of
one or more condition names, enclosed in
Most conditions are checked for parentheses and separated by commas, and
automatically, and when they occur, the connected to a statement (or a statement
system will take control and perform some label) by a colon. The prefix always
standard action specified for the precedes the statement and any statement
condition. Such conditions are enabled by labels. For example:
default, and the standard system action is
established for them. (SIZE): L1: X=(I*.N)/(M+L);
(NOCONVERSION): Y=AIIB:
A standard system action exists for every
condition, and if an interrupt occurs, this
standard system action will be performed
scope of the Condition Prefix unless the programmer has specified an
alternate action in an ON statement for
that condition. The purpose of the ON
The scope of the prefix, that is, the part statement is to establish the action to 'be
of the program throughout which i t applies, taken when an interrupt results from an
is usually the statement to which the exceptional condition that has been
prefix is attached. The prefix does not enabled, either by default Or by a
apply to any functions or subroutines that condition prefix.
may be invoked in the execution of the
statement. ~ The action specified in an ON
statement will not be executed durihg any
A condition prefix to an IF statement portion of a program throughout which the
applies only to the evaluation of the condition has been disabled.
expression following the IF: it does not
apply to the statements in the THEN or ELSE The form of the ON statement is:
clauses, although these may themselves have
prefixes. Similarly, a prefix to the ON ON condition[SNAP]{SYSTEMilon-unitJ
statement has no effect on the statements
in the on-unit. (See section J, ·Statements· for a full
description) •
IA condition prefix to a DO statement or a
ISELECT statement applies only to the The keyword SYSTEM followed by a
levaluation of any expressions in the semicolon specifies standard system action
(statement itself and not to any other whenever an interrupt occurs. It re-
Istatement in the group. Condition prefixes establishes system action for a condition
Ito a WHEN clause apply only to the for which some other action has been
levaluation of expressions in the WHEN established.
Iclause itself: they do not apply to the
Istatements following the WHEN clause. The on-unit is used by the programmer to
specify an alternative action to be taken
Condition prefixes to the PROCEDURE whenever an interrupt occurs.
statement and the BEGIN statement are
special (though commonly used) cases. A The SNAP option specifies that, when an
condition prefix attached to a PROCEDURE or interrupt occurs, a list of all blocks in
BEGIN statement applies to all the the chain of invocation leading to the
statements up to and including the current task is written on the standard
corresponding END statement. This includes system file SYSPRINT. If SNAP is
other PROCEDURE or BEGIN statements nested specified, the action of the SNAP option
within that block. It does not apply to precedes the action of the on-unit. If
any procedures lying outside that block. SNAP SYSTEM is specified, the system action
message is followed immediately by a list
The enabling or disabling of a condition of active blocks.
may be redefined within a block by
attaching a prefix to statements within the The on-unit must be either a single,
block, including PROCEDURE and BEGIN unlabeled, Simple statement or an unlabeled
statements (thus redefining the enabling or begin block. The single statement cannot
disabling of the condition within nested be a RETURN, FORMAT, DECLARE, or DEFAULT
blocks). Such a redefinition applies only statement. It cannot be either of the two
to the execution of the statement to which compound statements, IF and ON, or a do-
the prefix is attached. In the case of a I group, or a select-group. (PROCEDURE,
nested PROCEDURE or BEGIN statement, it I BEGIN, END, DO, and SELECT statements can
applies only to the block the statement never appear as single statements.) The
defines, as well as any blocks contained begin block, if it appears, can contain any
within that block. When control passes out Istatement (except that a RETURN statement
SIGNAL statement
END;
The programmer may simulate the occurrence
of an ON condition by means of the SIGNAL The CONDITION condition is always
statement. An interrupt will occur unless enabled, but it can be raised only by the
the named condition is disabled. This SIGNAL statement.
statement has the form:
SIGNAL condition-name;
CHECK Condition
The SIGNAL statement causes execution of
the interrupt action currently established
for the specified condition. The principal The CHECK condition is an important tool
use of this statement is in program provided in PL/I for program testing. It
checking, to test the action of an on-unit, is raised during execution of the program
and to determine that the correct action is whenever the value of a deSignated variable
associated with the condition. is mOdified, or whenever control is
transferred to a statement prefixed by a
If the signaled condition is not deSignated label or entry constant.
enabled, the SIGNAL statement is treated as Variables, label constants, and entry
a null statement. constants for which the CHECK condition is
condition is enabled for HEADER, an block. which in turn calls a procedure (not
interrupt will occur before HEADER is shown here) that reads on, ignoring cards
executed. The READ statement with the INTO until it reaches a header card. The begin
option will cause a CHECK condition to be block ends with a GO TO statement that
raised for each element of the variable terminates the on-unit.
SAMPLE; consequently, the input is listed
in the form of data-directed output. The GET statement labeled NEWBATCH uses
the STRING option to get the different test
The card read is assumed to be a header numbers that have been read into the
card. If it is not, the SIGNAL CONVERSION character string READINGS, which is an
statement causes execution of the BEGIN element of SAMPLE. Since the variables
This chapter describes language features The extent to which these facilities are
which can provide various facilities to applicable to a particular program depends
help the programmer at execution time. on the processing mode:
These features are implemented by the- PL/I
checkout compiler only. If they are 1. Batch processing:
included in a source program to be
processed by the PL/I optimizing compiler, The programmer does not control the
they are checked for correct syntax and time at which execution begins, and
then ignored; their presence in such a cannot intervene during execution to
program is not regarded as an error. initiate a trace or a current-status
list, or to modify his program. If a
trace or a current-status list is
In order that the working time of both required, the appropriate statements
the programmer and the computer shall be must have been included in the source
used with the maximum efficiency, it is program. output from these facilities
essential that program turnaround should be is not avai~able until execution has
as rapid as possible. The most important terminated.
way of achieving this, as far as the
programmer is concerned, is to reduce the 2. Conversational processing:
time he spends finding out how well his
program works, and to allow him to correct The programmer initiates execution of
any syntactic or logical errors with the his program at the terminal and can
minimum delay. The PL/I checkout compiler intervene during execution to initiate
supports this aim by providing execution- a trace or a current-status list, or
time facilities that: to modify his program. statements to
initiate a trace or status-list can
1. Provide the programmer with also be included in the source
information about designated items. program. output from these facilities
This information comprises: is immediately available and can be
printed at the terminal.
a. A trace of the items, that is,
information is put out whenever If the SYSPRINT file is associated
these items are referenced in pre- with a device other than the
defined situations throughout programmer's terminal, some of
execution. SYSPRINT output will appear on both
devices. That part of the SYSPRINT
b. A list showing the current status output which is not normally available
of the designated items at any at the terminal can be copied onto it
specified point during execution. by means of the appropriate terminal
instruction.
The items to be traced or listed, and
the points at which this output Conversational processing requires a
occurs, are specified by statements in keybOard terminal as the input/output
the source program. The pre-defined device. This enables the programmer to:
situations are specified in the
language. 1. Transmit and receive data at a rate
fast enough to allow him to maintain a
2. Allow the programmer to initiate the train of thought, and
trace dynamically.
2. Have control passed to him at the
3. Provide hi~ with the opportunity, in termin~l, or obtain it by calling
the appropriate processing attention from the terminal.
environment, for amending his program.
Changes made to the existing program processing at the terminal is performed
can be temporary, Or they can be in immediate mode, that is, any instruction
incorporated automatically into the entered can be executed immedi~tely. If a
current source program. The current permitted PL/I statement or statement group
source program can be saved on an is entered, it can be translated and
external data set and can be interpreted (executed) immediately.
retranslated at any time without
leaving the checkout compiler PL/I includes statements and options
environment. that support these facilities. These
2. There are some language items that The tracing mechanism is activated by the
have or can have a different usage in following statements:
batch processing from that in
conversational processing. They are: Item or feature Statements
The effect of the use of both CHECK and a. Delete from all actual or
NOCHECK statements in a program is shown by inherited prefixes (both CHECK and
the following example: NOCHECK) all names that appear in
the CHECK or NOCHECK statement
CHECK (A,B,C,D); name-list (except where the same
name appears in the statement and
the prefix but refers to a
different data item in each case).
NOCBECK (A,D); In both cases, treat a prefix with
no name-list as having a name-list
that includes all known names.
CHECKCA,B,C): /* NAMES CHECKED FOR: The FLOW statement causes information about
the transfer of control during execution of
a task to be written on the SYSPRINT file.
When a FLOW statement has been executed, it
CCHECKCA»: •••• : /* A,B,C remains effective until the task terminates
CCHECK(D,E»: •••• :/* A,B,C,D,E or until a NOFLOW statement is executed in
(NOCHECK(A»: •••• :/* A,B,C the same task. The FLOW statement has no
(NOCHECK): •••. : /* A,B,C effect outside procedures compiled by the
(CHECK): •••• : /* ALL checkout compiler.
The CHECK condition is raised when 2. The number of the statement to which
AUTOMATIC, BASED, or CONTROLLED variables control is transferred.
are initialized by means of the INITIAL
attribute (with or without the CALL
option). If standard system action is While it is always clear why a
taken, CHECK output is produced as follows: particular statement is specified in the
flow comment as the statement that caused
AUTOMATIC: Only if the CHECK statement has the transfer of control, it is not always
been executed before the establishment so obvious why control was transferred to
of the prologue for the block containing the statement given as the destination.
.,
CHECK(A,B,C,Cl,O,F,P):
0(1): READ FILE (X) INTO(Cl): /*CHECK OUTPUT FOR D(l) AND Cl*/
F: PROC(Y,Z):
DCL (Y,Z) DECIMAL (5)
Y=20:
.,
END F:
END PRj
Notes:
NOFLOW Statement
3 FLOW;
The NOFLOW statement suppresses the action
of a FLOW statement executed earlier in the
12 ON CONVERSION GO TO L12; same task.
RETURN in 197 42
procedure invoked
as function reference 1 I
L---------------------------------------------------------------------------------------J
Figure 15.2. Flow comments produced by various transfers of control
r---------------------------------------------------------------------------------------,
Option 1 Intormation 1
---------------------------------------------------------------------------------------1
[LIST] (data-list) 1Variables I
DATA [(data-list)] 1 1
EDIT (data-list) (format-list) 1 1
[(data-list) (format-list»)... 1 I
---------------------------------------------------------------------------------------1
SNAP IActive blocks and on-units I
---------------------------------------------------------------------------------------1
FLOW(n)] ILast n transfers of control I
---------------------------------------------------------------------------------------1
ALL[(character-string-expression)] IVariables, active blocks and on-units, 1
Itransfers of control, ON built-in functions 1
L---------------------------------------------------------------------------------------J
Figure 15.3. Program information provided by the PUT statement options
PUT DATA statement is not initialized or is the output for a progra~control variable
not allocated, the checkout compiler comprises information re1ated to the
includes a comment to this effect in the current situation of the variable. For
output. example, the output for a file variable
states whether the file is open or closed,
The information provided for a program- and the output for an event variable states
control variable specified or assumed in a whether the event is active or inactive.
PUT LIST or POT DATA statement depends on
the variable. The name of the variable is Onder the optimizing compiler a POT DATA
put out only if DATA (with or without a statement specifying a program control
data list) is specified. A progra~control variable will cause only the name of the
variable does not have a value in the sense variable to be printed. A PUT LIST or PUT
that a problem variable has one. Instead, EDIT statement must not specify program
SNAP information: The information provided where n is a number 1 through 9999. Any or
by a PUT SNAP statement. In a all of the options may be specified
multitasking program, the chain of together.
invocation is followed back through
all attaching tasks to the main When one or more of the options is
procedure of the program. specified, SNAP and FLOW information is
given for each task for which other
FLOW information: The information provided information is transmitted, except that i t
by a PUT FLOW statement without a is always omitted for the current task.
number-of-statements option. The other information is transmitted if one
or more of the options 0, S, F, or C is
Condition built-in functions: Values of specified. The information is given for
the following built-in functions in all tasks and blocks unless limited by one
data-directed format. or both of the options T and n.
Condition status: For each PL/I on- n: Limits the output to this number of
condition: blocks.
Full details of the terminal subcommands 5. The ~INCLUDE facility may not be used.
since the NORESCAN option for preprocessor Note that each 1 is preceded by seven
variable A suppresses the res canning of the blanks.
result 'B+C' substituted for A.
The fifth statement increments the value
Note that the preprocessor variable B of I by 1 and the sixth statement, a
has a default precision of (5,0) and, preprocessor IF statement, tests the value
therefore. actually contains 2 preceded by of I. If I is not greater than 10, the
four zeros. When this value replaces B in scan is resumed at the statement labeled
the string 'B+C' it is converted to a LAB: otherwise, the scan continues with the
character string and becomes 2 preceded by text immediately following the IGO TO
seven blanks (the rules for conversion of statement. Hence, for each increment of I,
decimal fixed-point values to character up to and including 10, the assignment
string are followed). See the section statement is rescanned and each occurrence
·preprocessor Expressions· later in this of I is replaced by its current value. As
chapter, for details. a result, the following statements are
inserted into the preprocessed text:
Replacement values must not contain
percent symbols, unmatched quotation marks, Z( l)=X( l)+Y( 1):
or unmatched comment delimiters.
Z( 2)=X( 2)+Y( 2) :
The following example illustrates how
compile-time facilities can be used to
speed up the execution of a DO-loop.
Z( 10)=X( 10)+Y( 10):
A programmer might include the following
loop in his program: As before, each number from 1 through 9
is preceded by seven blanks: the number 10
DO 1=1 TO 10: is preceded by six blanks.
Z(I)=X(I)+Y(I):
END; When the value of I reaches 11, control
falls through to the IDEACTIVATE statement.
The following sequence would accomplish the This statement is interpreted as follows:
same thing, but without the requirements of subsequent encounters of the identifie~ I
incrementing and testing during execution in source program text are not to be
of the compiled program: replaced by the value 11 in the
preprocessed text being formed; each I will
IDECLARE I FIXED: be left unmOdified, either for the
11=1; remainder·of the scan or at least until I
ILAB: ; is reactivated by a IACTIVATE statement.
ZCI)=X(I)+Y(I); If I is again activated, it will still have
11=1+1; the value 11 (unless an intervening
IIF 1<=10 ITHEN IGO TO LAB; preprocessor assignment statement has
IDEACTIVATE I; established a new value for I).
The first statement activates I and
establishes it as a preprocessor variable.
The second statement assigns the value 1 to Character strings and comments
I. This means that subsequent encounters
of the identifier I in non-preprocessor
statements will be replaced by 1 (provided PL/I character or bit string constants and
that I remains activated). The third comments are not processed by the
statement is a preprocessor null statement I preprocessor, unless they appear in a
that is used as the transfer target for the I function reference to an active
preprocessor GO TO statement appearing Ipreprocessor procedure. The existence of
later. an otherwise valid preprocessor statement
in a character string or comment will be
The fourth statement, not being a ignored, as will the existence of a
I [label: 1 • •• DO [i=ml [TO m2 [BY m3]1]; Note: If text inclusion is the only pre-
BY m3 [TO m2]J processor facility required, that is, if
the source program and the included text
contain no preprocessor statements other
than 'INCLUDE, the preprocessor stage may
i[label:] ••• END[labell; be omitted. (For the optimizing compiler,
this necessitates the use of the INCLUDE
compiler option. See the programmer's
In the above format, i must be a guide for the optimizing compiler.)
preprocessor'variable and m1, m2, and m3
must be preprocessor expressions. The It the included text contains any
label that can follow the keyword END must preprocessor declarations, the scope of the
be one of the labels preceding the keyword names ~eclared as preprocessor variables is
DO. Preprocessor do-groups may be nested all the included text and any text which
and multiple closure is allowed. follows the included text, except
preprocessor procedures in which the name
Control cannot be transferred into a is redeclared.
preprocessor do-group specifying iteration,
except by way of a return from a The general format and the rules
preprocessor procedure invoked from within governing the use of the iINCLUDE statemen~
the group. are presented in section J, "Statements".
The use of a computing system to execute a system. Hence, at any given time, it. may
number of operations concurrently is be necessary for the system to select its
broadly termed multiprogramming. The PL/I next action from a number of different
programmer can make use of the tasks. Each task has a eriority value
multiprogramming capability of the system associated with it, which governs this
by means of the multitaskinq facilities selection process. The programmer can
described in this chapter. control the priority of the task, within
limits, if he wishes to do so; otherwise,
A PL/I program is a set of one or more the priority value is set automatically.
procedures, each of which consists of one
or more blocks of PL/I statements. The
execution of these procedures constitutes ~ CALL B; ~-------4"~ END A;
A:PROC;-------I..
one or more tasks, each of which can be
identified by a different task name. A
task is dynamic; it exists only while the
procedure is being executed. This
distinction between the procedure and its
execution is essential to the discussion of
multitasking. A procedure could be
executed several times in different tasks.
B:PROC; ------~... END;
When the multitasking facilities are not
used, the execution of a program comprising
one or more procedures constitutes a Single
task, with a single flow of control; when a
procedure invokes another procedure,
control is passed to the invoked procedure,
and execution of the invoking procedure is
suspended until the invoked procedure C:PROC;------I... CALL D TASK; - - - - - - I . . . . END C;
passes control back to it. This serial
type of operation is said to be
synchronous: when the progranuner is
concerned only with synchronous operations,
the distinction between program and task is
relatively unimportant.
With multitasking, the invoking
procedure does not relinquish control to D: PROC; ------.1.... END;
the invoked procedure. Instead, an
additional flow of control is established,
so that both procedures can be executed (in Figure 11.1. Synchronous and
effect) concurrently. This process is asynchronous operation
known as attaching a task. The attached
task is a subtask of the attach~g task. A task can have control of either the
Any task can attach a number of subtasks. CPU or the systems's I/O resources. I/O
The task that has control at the outset is may be performed in one task while CPU
called the major task. This parallel type operations are being carried out in
of operation is said to be asynchronous. another, and there may, at the same time,
be other tasks waiting for one or other of
The diagram shown in figure 11.1 the resources. Operation of the CPU can be
illustrates the difference between interrupted if a task of higher priority
synchronous and asynchronous operations. than the current one requires CPU
The arrowed lines represent the control facilities. Interruption can occur, for
flows. Procedures A and B are executed instance, if a higher-priority task
synchronously: C and D are executed completes an I/O operation or if the
asynchronously. current task attaches a subtask of higher
priority. An I/O operation is never
When several procedures are executed as interrupted: I/O resources can only be re-
asychronous tasks, individual statements allocated after completion of an I/O
are not necessarily executed simultaneously operation. When an I/O operation is
by different tasks: whether this occurs completed, the system searches amongst all
depends on the state and resources of the the active tasks that require the 110
Examples
Full details of the WAIT statement are The two values, completion and status, of
given in section J, "Statements"; the an event variable can be retrieved by the
following is a shorter description, built-in functions COMPLETION and STATUS.
The programmer should not attempt to The DELAY statement (see section J,
assign a completion value to an event WStatements W) allows a task to wait for a
variable currently associated with an specified period, without reference to an
active task or with an input/output event. event variable.
An input/output event is never complete
until an associated WAIT statement is
executed, the WAIT being in the same task
as the EVENT option. Termination of Tasks
Other ways in which an event variable
can be set have already been discussed A task is terminated by the occurrence of
(such as specifying the event name in the one of the following:
EVENT option of a CALL statement). Full
details of event variables will be found 1. Control for the task reaches a RETURN
under wEVENT Attribute W in section I, or END statement for the initial
-Attributes w• See also wEVENT Option w in procedure of the task.
chapter 12, -Record-Oriented Transmission-.
2. Control for the task reaches an EXIT
Note: statement.
When tasks are being synchronized, the 3. Control for the task, or for any other
following points should be kept in mind: task, reaches a STOP statement.
1. An input/output event must be waited 4. The block in which the task wes
for in the task that initiates the attached is terminated (either
input/output operation. The event can normally or abnormally).
also be waited for in any other task,
but in this case this task will wait 5. The attaChing task itself is
until the event has been set complete terminated.
by a WAIT statement in the initiating
task. 6. Standard system action for the ERROR
condition or the action on normal
2. There is a very real danger that two return from an ERROR on-unit is
tasks could interlock and enter a carried out.
permanent wait state. The programmer
must ensure that this cannot happen in Termination is normal only if item (1) of
a program. For example: the above list applies. In all other
END ONLINE;
PROCESS: PROCEDURE;
DECLARE ANS CHARACTER (30) VARYING,
(READEVT, ENDEVT, TEVREAD,
TEVUPDT, TEVRED) EVENT EXTERNAL;
WS: WAIT (READEVT, ENDBEVT) (1);
IF COMPLETION(READEVT)='l'B THEN GO TO READIN;
WAIT (TEVREAD, TEWPDT, TEVRED) (3);
EXS: EXIT;
/*IF 'END BATCH' COMMAND WAIT FOR ASSOCIATED
TASKS BEFORE BATCH IS TERMINATED*/
V
r------------------ -----------,------------------------------,
V V
Subtask PRl PRIORITY = P-ll Subtask PR2 PRIORITY = P-12 Subtask PR4 PRIORITY = P-13
Ir---------------------------,
READER: PROC: . I ,UPDATE: PROC:
r--------------------------,
r--------------------------, IRED:
I PROC: I
I Function: I IFunction: I I Function: I
IRead cards into array I IProcess array information: I ,Treatment of 'RED' 1
I (which must have at least I Icheck that each row is I 1accounts. If necessary 1
I three rows). When one row I I full before processing. I ,attac~ task for treatment I
lis filled, test for comple-I IUpdate master files, I lof 'VERY RED' accounts. I
Ition of processing of next I
Irow by subtask PR2 before I
Icontinuing to read. I
Itransaction files.
IWhen statement 'page' is I
Ifull, attach task to print I
I
,
L--------------------------J
V
L---------------------------J I statement. Transfer infor-I Subtask PRS PRIORITY = P-14
Subtask PB3 PRIORITY = P-15 lmation on a 'RED' account I r--------------------------,1
r---------------------------,
ISTATBMENT:PROC(Account ID):I
Ito a 'RED' array for
Iprocessing by 'RED' pro- ,
I IVERYRED: PROC:
1Function: I
I Function:
IPrint statement for the II Icedure.
L_--_______________________ JI IPrint letter for account I
I owner, and owner's name I
L_- _________________________
laccount identified. JI<---------------J Ifor branch manager. 1
L--------------------------J
Figure 17.3. Flow diagram for programming example of multitasking
,,
l
·f
DO; following example:
DCL A CBAR(N);
.
tl
f
t
~
in structures, such structures
should be declared ALIGNED.
Note: The use of bit strings in a
mul~itasking program can
d.
e.
Use edit-direct input/output in
preference to list- or data-
directed •
Consider the use of overlay
.
t
0Ccasionally cause incorrect
resUlts. When the program
defining to simplify transmission
to or from a character string
t: references the bit string, it may structure. For example:
DCL 1 IN, specify FS or FBS record format,
2 TYPE CHAR(2), whenever possible.
2 REC,
3 A CHAR(S), 5. The following measures apply to
3 B CHAR(7), interlanguage communication:
3 C CHAR(66);
GET EDIT(IN) a. Where poSSible, ensure that PL/I
(A(2),A(S),A(7),A(66»; aggregate arguments will be mapped
the same as those for COBOL or
In the above example, each format- FORTRAN.
item/data-field pair is matched
separately, code being generated b. The compiler cannot always detect
for each matching operation. It when a structure in PL/I and COBOL
would be more efficient to define will map identically. Each
a character string on the element in the base structure has
structure and apply the GET an alignment requirement; for
statement to the string: example, a CHAR(4) item can be
aligned on any byte in main
DCL STRNG CHAR(SO) DEF IN; storage, whereas a FIXED BIN(31)
item must be fullword aligned.
The compiler creates a dummy
argument for the structure
GET EDIT (STRNG) (A(SO»; whenever the first base element
has a less stringent alignment
f. If a file is declared DIRECT requirement than any other base
INDEXED, the ENVIRONMENT options element. This rule is applied
INDEXAREA, NOWRITE, and ADD BUFF independently to each minor
should be applied if possible. structure at level 2. The NOMAP
option should be specified if the
g. When creating or accessing a actual lengths of items do not
CONSECUTIVE data set, use file and require padding bytes to be
record variable declarations that inserted. For example:
cause in-line code to be
generated, if possible. Details DeL 1 5,
of the declarations are given in 2 X CHAR(4),
chapter 12, "Record-Oriented 2 Y FIXED BIN(31);
Transmission· •
The compiler will create a dummy
h. Conversion of source keys for argument for this structure
REGIONAL data sets can be avoided because Y has a greater alignment
if the following special cases are stringency than X. However, the
observed. structure will map identically in
PL/I and COBOL because no padding
(1) For REGIONAL(l): When the is required.
source key is a fixed binary
element variable or constant, c. When arguments do map differently,
use precision in the range use the NOMAPIN option to avoid
(12,0) to (23,0). unnecessary initialization of
dummy arguments, and use the
(2) For REGIONAL(2) and (3): When NOMAPOUT option to avoid
the source key is of the form unnecessary assignment from dummy
(character-string- arguments if the final value is
expressionllr), where r is a not required (e.g_, if the value
fixed binary element variable is unchanged).
or constant, use precision in
the range (12,0) to (23,0). d. Avoid multiple initialization of
the PL/I environment by ensuring:
i. Direct update of an INDEXED data
set is slowed down if an I/O (1) that the main procedure is
operation on the same file PL/I, or
intervenes between a READ and a
REWRITE for the same key. This (2) that a PL/I procedure is
can cause the REWRITE statement to called from the main routine,
issue an extra READ. or
j. When creating or accessing a data (3) that the structure of the
set having fixed-length records, program is such that the PL/I
use standard formatting, that is, environment is not destroyed
,
I
END; DCL 1 A( 3000),
2 NAME CHAR(14),
2 NUMBER FIXED BINARY;
,
I
ITUNING A PROGRAM FOR A VIRTUAL STORAGE
the 100th name would be held adjacently
with the lOOth number and so they could
I SYSTEM easily be accessed together. However, if
I i t is declared:
I
IThe output of the optimizing compiler is DCL 1 A,
Iwell suited to the requirements of a 2 NAME(3000) CHAR(14),
Ivirtual storage system. The executable 2 NUMBER(3000) FIXED BINARY;
code is read-only and is separate from the
data which is itself held in discrete all the names would be held contiguously
segments. For these reasons there is followed by all the numbers, thus the 100th
usually little cause to tune the program to name and the 100th number would be widely
reduce paging. Where such action is separated.
essential, a number of steps can be taken.
However, it should be borne in mind that When choosing the storage class for
the effects of tuning are usually small. variables there is little to choose between
STATIC INTERNAL and AUTOMATIC. The storage
The object of tuning for a virtual where both types of variable are held is
storage system is to minimize the paging, required during execution for reasons other
that is to reduce the number of times the than access to the variables. The storage
data is moved from auxiliary storage into used for based or controlled variables is
main storage and vice-versa. This can be not however required and avoiding these
done by making sure that items that are storage classes may reduce paging.
accessed together are held together and by
making as many pages as possible read only. Complete control of the positioning of
variables can be obtained by declaring them
When using the optimizing compiler the BASED within an AREA variable. All
problem can be approached both by writing variables held within the area will be held
the source program so that the compiler I together.
Iwill produce the most advantageous use of I
Ivirtual storage and, if further tuning is I A further refinement is possible that
,required, by using linkage editor lincreases the number of read only pages.
Istatements to manipulate the output of the IThis is to declare STATIC INITIAL only
Icompiler so that certain items appear on Ithose variables that remain unaltered
1---------------------------------------------------------------------------------------
1 ICharacter string IString must be fixed-length with length ~256.
ICharacter Picture 1 I
1 ICharacter Picture IPictures must be identical.
1---------------------------------------------------------------------------------------
1 IFIXED BINARY IVia FIXED DECIMAL. SIZE condition disabled.
1 1 1
I IFIXED DECIMAL IType 2 pictures without * or embedded
1 1 1punctuation. SIZE condition disabled.
INumeric Picture I I
Itype 1 and 2 1FLOAT IVia FIXED DECIMAL. SIZE condition disabled.
1 I 1
1 INumeric Picture IPicture types 1, 2 or 3. SIZE condition
1 I I disabled.
1---------------------------------------------------------------------------------------
ILabel 1Label I
1---------------------------------------------------------------------------------------
____________________________________________________ ----------------------------------J
IL-locator I locator I
optimization can cause Significantly fewer For in-line conversions, pictures with
instructions to be executed. this subset of characters are divided into
three types:
Compare lAS for string assignment with the two comparands taking the roles of
Isource and target, but no adjustable or varying-length operands are
I handled
STRING function ,Element variables and non-adjustable array and structure variables
lin connected storage.
I Notes: 1. the maximum lengths specified refer to the lengths of operations rather than,
I operands. If the target is fixed-length, the operation length is the target I
I length. If the target is VARYING, the operation length is the lesser of the I
I operand lengths. I
I I
I 2. UNALIGNED bit strings that are parameters, defined variables, or part of I
I
L-----________________________________________________ ----------------------------------J
aggregate variables are not handled. I
Figure 18.2. Conditions under which string operations are handled in-line
,
I
I
I
I Register allocation can be more
,
IORDER Option
I
ISignificantly optimized if REORDER is
Ispecified for the plock. However, the
Ivalues of variables that are reset in the
Iblock are not guaranteed to be the latest
'The ORDER option should be specified for a lassigned values when a computational
Iprocedure or begin block if the programmer linterrupt occurs, since the latest value of
Irequires that the most recently assigned la variable may be present in a register but
Ivalues of variables that are modified in Inot in the storage location of the
Ithe block are guaranteed for use in On- I variable. ThUS, anyon-unit entered for a
lunits entered because of computational Icomputational interrupt must not refer to
linterrupts during the execution of Ivariables set in the reorder block.
Istatements and expressions in" the block. I However, use of the built-in functions
lIn a block to which the ORDER option 10NSOURCE and ONCHAR is still valid in this
,applies, common expreSSions may be I context.
leliminated by the compiler. If so, the I
,occurrence of computational interrupts I A program is in error if during
,during execution of the block may be less lexecution there is a computational or
Ithan would occur if common expressions had Isystem action interrupt in a REORDER block
Inot been eliminated. However, if an Ifollowed by the use of a variable whose
linterrupt occurs during execution of an Ivalue is not guaranteed.
'ORDER block, the values of variables in I
Istatements which precede the interrupt are I Since these restrictions preclude the
Iguaranteed to be the most recent values Icorrection of erroneous data, except by
lassigned when reference is made to them in lusing ONSOURCE and ONCHAR pseudovariables
Ithe on-unit for the interrupt. Other forms Ifor a CONVERSION on-unit, the programmer
lof optimization are permitted in an ORDER Imust either depend on the standard system
Iblock except for forward or backward move- 'action, thereby terminating execution of
lout of any expression which can cause an Ithe program, or use the on-unit to perform
I interrupt. Since it would be necessary to lerror recovery and to restart execution by
Idisable all the possible conditions which lobtaining fresh data for computation. The
Imight be encountered, the use of ORDER Isecond approach should ensure thqt all
Ivirtually suppresses any move-out of Ivalid data is processed, and that invalid
,statements or expressions from loops. data is noted, while still taking advantage
I of any possible optimization. For example:
I
I ON OVERFLOW PUT DATA;
,
IREORDER Option DO J = 1 TO M;
DO I = 1 TO Ni
X(I,J) = Y(I) + Z(J) *L + SQRT(W)i
I
'The REORDER option permits the compiler to P = I*Ji
Igenerate optimized code to produce the END;
'result specified by the source program, END;
Iwhen error-free execution takes place.
'Move-out is permitted for any invariant When the above statements appear in a
,statements and expressions from inside a reorder block, the source code compiled is
Iloop to a pOint in the source program interpreted as follows:
leither preceding or following such a loop.
IThus the statement or expression is ON OVERFLOW PUT DATA;
DCL A PIC'99.9',
B PIC'99V9',
PROGRAM CONTROL C PIC'99.V9':
A,B,C=4!>.6:
PUT LIST (A,B,C):
1. The procedure to be given initial
control at execution time must have This will cause the following values
the OPTIONS(~.IN) attribute. If more to be put out for A, B, and C,
than one procedure has the MAIN respectively:
option, the first one encountered by
the linkage-editor gets control. 04.5 456 45.6
1=6:
DO J=I TO 4; END;
X=X+J;
END; 7. I is frequently used as the control
variable in a do-group, for example:
X is not altered by this group, since
BY 1 is implied. Iterations can step DO 1=1 TO 10;
backwards, and if BY -1 had been
specified, three iterations would have Within the scope of this implicit
taken place. declaration, I might be contextually
declared as a pointer, for example:
3. Expressions in a DO statement are
assigned to temporaries with the same DCL X BASED (I) ;
characteristics as the expression, not
the variable. For example: The two statements are in conflict and
will produce a diagnostic message.
DCL A DECIMAL FIXED(S,O); When I is a pointer variable, it can
A=10; only be used in a do-group in one of
DO 1=1 TO A/2; the following ways:
END;
DCL (A, B, C) ( 10 I 10 ) ;
ACI) = X:
A=B*C:
i STRINGS
I
DATA AGGREGATES
1. Assignments made to a varying string
by means of the SUBSTR pseudovariable
1. Array arithmetic should be thought of do not set the length of the string.
as a convenient way of specifying an A varying string initially has an
iterative computation. For example: undefined length, so that if all
assignments to the string are made
DeL A(10,20): using the SUBSTR pseudovariable, the
string still has an undefined length
and cannot be successfully assigned to
another variable or written out.
A=A/AC1,1):
2. The user must ensure that the lengths
has the same effect as of intermediate results of string
expressions do not exceed 32767 bytes.
DCL A(10,20): This applies particularly to strings
of varying lengths, as there is nO
object-time length checking.
DO 1=1 TO 10:
DO J=l TO 20:
A(I,J}=A(I,J)/A(l,l): FUNCTIONS AND PSEUDOVARIABLES
END: END:
Note that the effect is to change the 1. When UNSPEC is used as a
value of A(l,l) only, since the first pseudovariable, the expression on the
iteration would produce a value of 1 right is converted to a bit string.
for A(l,l). If the programmer wished consequently, the expression must not
to divide each element of A by the be invalid for such conversion: for
original value of A(l,l), he could example, if the expression is a
write character string containing characters
other than 0 or 1, a conversion error
B=A(l,l): will result.
A=A/B:
or alternatively,
ION-CONDITIONS AND ON-UNITS
DCL A(10,20), I
B(10,20}: I
I 1. Note the correct poSitioning of the ON
I statement. If the specified action is
I to apply when the named condition is
B=A/A(l,l}: I raised by a given statement, the ON
would result in the ERROR condition a. Block size smaller than record
being raised in the event of a size (except when records are
transmission error during the first spanned).
GET operation, and the required branch
would not be taken (assuming that no b. LINESIZE exceeding thE permitted
previous ON statement applies). maximum.
Furthermore, the ON statement would be
executed after each execution of the c. KEYLENGTH zero or not specified
GET statement. for creation of INDEXED,
REGIONAL(2), or REGIONAL(3) data
sets.
2. An on-unit cannot be entered by means
of a GOTO statement. To execute an d. Specitying a KEYLOC option, for an
on-unit deliberately, the SIGNAL INDEXED data set, with a value
statement can be used. resulting in KEYLENGTH + KEYLOC
exceeding the record length.
11 READ FILE (F) INTO (X); 111. When a based variable is freed, the
I associated pOinter no longer contains
I useful information.
I
15 REWRITE FILE (F); 18. A based variable allocated in an area
must be freed in that area. For
example:
The PL/I interlanguage facilities permit PL/I. Assigning a value to one variable
communication, at execution time, between causes the same valUE to be assigned to the
programs compiled by the PL/I checkout and other. TherE is no similar equivalence in
optimizing compilers and programs compiled COBOL - no COBOL variable can have common
by one of the following compilers, and storage with a PL/I variable other than as
executed using the corresponding library. an argument or parameter.
The compilers and libraries have all been
developed by IBM for os. The interlanguage facilities are
entirely provided by the PL/I compiler;
I Program program No. they are obtained by specifying the
I appropriate language items in the invoking
lOS FORTRAN IV Compiler or invoked PL/I procedure. Existing COBOL
I (H Extended) 5734-F02 or FORTRAN programs or routines generally
lOS FORTRAN Library Mod I 5734-LM1 do not need modification or recompiling for
lOS FORTRAN Library Mod II 5734-LM3 interlanguage use; new programs or routines
I can be written in these languages and
lOS FULL ANS COBOL (Version 4) compiled as before, without the need to
I Compiler and Library 5736-CB2 antiCipate interlanguage communication.
I (Library only) 5736-LM2 Thus existing COBOL or FORTRAN application
IOS/VS FULL·ANS COBOL Compiler programs can be extended by the use of PL/I
I and Library 5746-CB1 procedures, while COBOL or FORTRAN
I (Library only) 5746-LM4 libraries can be made available to new or
existing PL/I procedures.
Communication between a PL/I program,
and a program compiled by one of the ~ In the context of this Chapter,
FORTRAN or COBOL compilers, can be achieved "routine" includes a COBOL subprogram, or a
in two ways: FORTRAN subroutine or function, including a
FORTRAN library function. The conventions
1. By using a conversion data set for the that exist in these languages for handling
PL/I and COBOL/FORTRAN routines. subroutines and fUnctions apply normally,
and are not modified for interlanguage use.
2. By invoking a COBOL/FORTRAN routine In particular, the restriction that a
from a PL/I routine, or vice versa, FORTRAN function cannot be invoked without
and by passing data either as passing an argument or arguments still
arguments or in the form of static applies when the invocation is from a PL/I
storage. routine.
Interrupt Handling
If the main routine of the program is a
PL/I main procedure, the PL/I environment
is established on entry to the program. COBOL and FORTRAN routines handle certain
Even if this program contains a mixture of of the hardware interrupts that may occur
PL/I and COBOL or FORTRAN routines, the during their execution, but there are sOme
normal rules for freeing PL/I storage and that they do not handle. The inter language
closing PL/I files apply. communication facilities of PL/I allow any
interrupt not dealt with by a COBOL or
If the main routine of the program is FORTRAN routine to be handled by any PL/I
not a PL/I main procedure, the PL/I procedure from which that routine is
environment is established when the first dynamically descendent.
The programmer specifies the INTER an on-unit, while established, applies not
option of the OPTIONS attribute when only to the procedure in which it was
declaring the COBOL or FORTRAN entry name. created, but also to all procedures that
(See also the INTER option under "passing are dynamically descendent from it. If
Arguments to COBOL or FORTRAN Routine" there occurs, during the execution of a
earlier in this chapter.) This allows the COBOL or FORTRAN routine, an interrupt that
interrupts not dealt with by the invoked will not be handled by that routine, and if
COBOL or FORTRAN routine to be handled by the routine was invoked by a PL/I procedure
either a PL/I on-unit or by PL/I standard in which the INTER option was specified for
system action. (Except that PL/I cannot the COBOL or FORTRAN entry name, then a
handle a ZERODIVIDE interrupt in a division search is made through all invoking
of COMPUTATIONAL-3 data in a routine procedures for an appropriate on-unit. If
compiled by a COBOL compiler other than the none is found, standard system action is
COBOL E compiler. Such an interrupt will taken. If INTER is not specified, nO
cause termination of the program.) In PL/I, search is made, and the interrupt is dealt
r---------------------------------------------------------------------------------------,
1 01 A SYNCHRONIZED. 1 A ALIGNED, 1
1 02 B OCCURS 3 TIMES. 2 B(3), I
I 03 C OCCURS 4 TIMES. 3 C(4), I
1 04 D OCCURS 5 TIMES USAGE COMP-3 4 D(5) FIXED DECIMAL(7,3), 1
I PIC S9999V999. 1
1 02 E USAGE DISPLAY. 2 E, I
I 03 F PIC X(8). 3 F CHAR(8), I
1 03 G PIC 9(8). 3 G PIC '(8)9', 1
I 02 DUMMY OCCURS 6 TIMES. 2 H(6,7) FIXED BINARY (15,0)~ ,
I 03 H OCCURS 7 TIMES USAGE COMP 1
I PIC S9999. I
l---------------------------------------------------------------------------------------J
Figure 19.3. Declaration of a data aggregate in COBOL and PL/I
Informatory return code 0000 Figure 19.5 shows the return codes
Warning return code 0004 generated by various types of PLII data.
Error return code 0008
Severe error return code 0012
,EXECUTION-TIME RETURN CODES
If no messages are produced, a code of 0000 I
is returned. I
IThe value of the PL/I return code may be
A return code of 0000 indicates that the ,set in a PL/I routine by means of the
compiler found no possible sources of ,PLIRETC built-in subroutine (see the
error. A code of 0004 indicates that Iprogrammer's guide for the compiler).
execution will probably be successful. A I
code of 0008 indicates that an error has , The return code of a non-PL/I routine
been found but that execution nevertheless Imay be obtained by declaring the entry
might be successful. A code of 0012 Ipoint with OPTIONS(RETCODE). This option
indicates that execution will probably not ,causes the value of the PLII return code to
be successful. (be set to the value returned by the non-
IPL/I routine in the lower half of register
As part of the interlanguage facilities 115.
of PL/I, diagnostic messages are produced, I
and the return code set appropriately, if , The latest value of the PLII return code
the programmer specifies arguments or Ican be read by means of the PLIRETV bu1lt-
parameters whose attributes are such that lin function.
errors may occur at execution time. The I
compiler will never prevent data being 'Example:
passed, nor will it attempt to correct I
errors; although it produces messages to
indicate likely sources of error to the ,,
, DECLARE AR ENTRY OPTIONS(ASM,RETCODE);
programmer, it will always allow him to
attempt to pass any type of data he , CALL AR;
specifies. I IF PLIRETV() =0 THEN ••••••• ;
60-CHARACTER SET
o o 1111 0000
1 1 1111 0001
Character Card-Punch 8-Bit EBCDIC 2 2 1111 0010
Code 3 3 1111 0011
4 4 1111 0100
5 5 1111 0101
blank no punches 0100 0000 6 6 1111 0110
12-8-3 0100 1011 7 7 1111 0111
< 12-8-4 (12-8-6) 0100 1100 8 8 1111 1000
( 12-8-5 (0-8-4) 0100 1101 9 9 1111 1001
+ 12-8-6 (12) 0100 1110
,I 12-8-7 (NA)
12 (NA)
0100
0101
1111
0000
$ 11-8-3 0101 1011 Composite
11-8-4 0101 1100 Symbols Card-Punch
*) 11-8-5 (12-8-4) 0101 1101
11-8-6 0101 1110 <= 12-8-4, 8-6 (12-8-6, 8-3)
11-8-7 (NA) 0101 1111 II 12-8-7, 12-8-7 (NA)
11 0110 0000 11-8-4, 11-8-4
/ 0-1 0110 0001 ....**
< 11-8-7, 12-8-4 (NA)
, 0-8-3 0110 1011 .... > 11-8-7, 0-8-6 (NA)
I 0-8-4 (NA) 0110 1100 .. = 11- 8-7, 8-6 (NA)
0-8-5 (NA) 0110 1101 >= 0-8-6, 8-6 (8-6, 8-3)
> 0-8-6 (8-6) 0110 1110 /* 0-1, 11-8-4
? 0-8-7 (12-0) 0110 1111 */ 11-8-4, 0-1
8-2 (8-5) 0111 1010 -> 11,·0-8-6 (11, 8-6)
# 8-3 (NA) 0111 1011
til 8-4 (NA) 0111 1100
8-5 (8-4) 0111 1101
= 8-6 (8-3) 0111 1110
A 12-1 1100 0001
B 12-2 1100 0010
C 12-3 1100 0011
D 12-4 1100 0100
E 12-5 1100 0101
F 12-6 1100 0110
G 12-7 1100 0111 The card-punch codes given in brackets
B 12-8 1100 1000 are BCDIC codes that differ from the
I 12-9 1100 1001 corresponding EBCDIC codes.
J 11-1 1101 0001
K 11-2 1101 0010
L 11-3 1101 0011 NA indicates that the symbol has no
M 11-4 1101 0100 representation in BCDIC. BCDIC codes can
N 11-5 1101 0101 be used in the PL/I source program provided
o 11-6 1101 0110 that the CHARSET(BCD) compiler option is
P 11-7 1101 0111 specified. No BCDIC 8-bit codes are given
Q 11-8 1101 1000 here since, when the CHARSET(BCD) option is
R 11-9 1101 1001 specified, all BCDIC codes in the s·ource
S 0-2 1110 0010 program are converted by the compiler into
T 0-3 1110 0011 EBCDIC.
U 0-4 1110 0100
V 0-5 1110 0101 Although the full PL/I 60-character set
W 0-6 1110 0110 is not available in BCDIC, all the 48-
X 0-7 1110 0111 character set (see next page) is available,
Y 0-8 1110 1000 so if CHARSET(48,BCD) is specified, all
Z 0-9 1110 1001 PL/I operations can be performed.
AND
0-S-3, 12-8-3
12-1, 11-5, 12-4
I
:
&
=
A
S-6 (8-3)
12-1
0111 1110
1100 0001
SE
GT
12-1, 12-5
12-7, 0-3
>=
>
8 12-2 1100 0010 LT 11-3, 0-3 <
C 12-3 1100 0011 NOT 11-5, 11-6, 0-3
D 12-4 1100 0100 OR 11-6, 11-9 I
E 12-5 1100 0101 /* 0-1, 11-S-4 /*
F 12-6 1100 0110 */ 11-8-4, 0-1 */
G 12-7 1100 0111 PT 11-1, 0-3 ->
B 12-8 1100 1000
I 12-9 1100 1001
J 11-1 1101 0001
J( 11-2 1101 0010
L 11-3 1101 0011 When using the 4S-character set, the
M 11-4 1101 0100 following rues must be observed:
N 11-5 1101 0101
0 11-6 1101 0110 1. The two periods that replace the colon
P 11-7 1101 0111 must be immediately preceded by a
Q 11-8 1101 1000 blank if the preceding character is a
R 11-9 1101 1001 period.
S, 0-2 1110 0010
T 0-3 1110 0011 2. The two slashes that replace the
U 0-4 1110 0100 percent symbol must be immediately
V 0-5 1110 0101 preceded by a blank if the preceding
W 0-6 1110 0110 character is an asterisk, or
X 0-7 1110 0111 immediately followed by a blank if the
Y O-S 1110 1000 follOWing character is an asterisk.
Z 0-9 1110 1001
0 0 1111 0000 3. The sequence "comma period" represents
1 1 1111 0001 a semicolon except when it occurs in a
2 2 1111 0010 comment, a character string, or a
3 3 1111 0011 picture specification or when it is
fI 4 1111 0100 immediately followed by a digit.
5 5 1111 0101
6 6 1111 0110 fl. If CBARSET(4S) is specified, 60-
7 7 1111 0111 character set symbols may be freely
a 8 1111 1000 intermixed with 4S-character set
9 9 1111 1001 symbols and will be accepted by the
compiler as valid input.
5. 4S-character set "reserved" words
(e.g., ST, LE, CAT, etc.,) must be
preceded and followed by a blank or a
comment.
The card-punch codes given in brackets
are BCDIC codes that differ from the 6. 4S-character set symbo1s represent
corresponding EBCDIC codes. BCDIC codes their 60-character set equivalents
can be used in the PL/I soarce proqram only when they do not occur in a
provided that the CHARSET(B.CD) compiler colIIDent r a cbaracter string r or a
o~ion is specified. No BCDIC a-bit codes picture specification.
are given here since, wben tbe CBARSET(BCD)
o.ption is specified, all BCOIC codes in the A record containing part or all of a
soux-ce proqram are converted by the _a-character set reserved word must be
e_piler into EBCDIC. 3 characters or more in lengtb.
CHARACTER(S) L26.1
1A variable declared with a character-string picture specification has a character-
string value only.
L---------------------------------------------------------------------------------------J
Figure D.l. pictured character-string examples
~The arithmetic value is the value expressed by the digits and the actual or assumed
location of the V in the specification.
2In this case, PL/I does not define the result since significant digits have been
truncated on the left. The result shown, however, is that given for these
implementations. The SIZE condition will be raised, if enabled.
L---------------------------------------------------------------------------------------J
Figure 0.2. Pictured numeric character examples
1The arithmetic value is the value expressed by the digits and the actual or assumed
location of the V in the specification.
L---------------------------------------------------------------------------------------J
Figure D.4. Examples of insertion characters
character must be specified in each digit the data item is zero: in that case, the V
position through which it may drift. is ignored. A field of a picture
specification can contain only one drifting
Drifting characters must appear in string. A drifting string cannot be
strings. A string is a sequence of the preceded by a digit position nor can i t
same drifting character, optionally occur in the same field as the picture
containing a V and one of the insertion characters * and Z.
characters comma, point, slash, or B. Any
of the insertion characters slash, comma, The position in the data associated with
or point within or immediately following the characters slash, comma, and point
the string is considered part of the appearing in a string of drifting
drifting string. The character B always characters will contain one of the
causes insertion of a blank, wherever it following:
appears. A V terminates the drifting
string, except when the arithmetic value of • slash, comma, or pOint if a significant
digit has appeared to t~e left it, the V delimits the preCeding portion as
a subfield, and all digit positions of the
• the drifting symbol, if the next subfield following the V must also be part
position to the right contains the of the drifting string that commences the
leftmost significant digit of the field second subfield.
• blank, if the leftmost significant digit Only one type of sign character can
of the field is more than one position appear in each field. An 5, +, or - used
to the right as a static character can appear to the
right or left of all digits in the mantissa
If a drifting string contains the and exponent fields of a floating-point
drifting character n times, then the string specification, and to the right or left of
is associated with n-1 conditional digit all digit positions of a fixed-point
positions. The position associated with specification.
the leftmost drifting character can contain
only the drifting character or blank, never In the case in which all digit positions
a digit. Two different picture characters after the V contain drifting characters,
cannot be used in a drifting manner in the suppression in the subfield will occur only
same field. if all o~ the integer and fractional digits
are zero. The resulting edited data item
If a drifting string contains a V within will then be all blanks (except for any
S specifies the plus sign character (+) if CR specifies that the associated pOSitions
the data value is ~O, otherwise i t will contain the letters CR if the value
specifies the minus sign character (-). of the data is less than zero.
The character may be drifting or static. otherwise, the positions will contain
The rules are identical to those for the two blanks. The characters CR can
currency symbol. appear only to the right of all digit
positions of a field.
+ specifies the plus sign character (+) if
the data value is ~O, otherwise i t DB is used the same way that CR is used
specifies a blank. The character may be except that the letters DB appear in the
drifting or static. The rules are associated positions.
identical to those for the currency
symbol. T specifies that the associated position,
on input, will contain a digit
specifies the minus sign character (-) overpunched with a i2-punch if the value
if the data value is <0, otherwise it is ~O or an ii-punch if the value is <0.
specifies a blank. The character may be It also specifies that an overpunch is
drifting or static. The rules are to be indicated in the character-string
identical to those for the currency value.
symbol.
I specifies that the associated pOSition,
If, during or before assignment to a on input, will contain a digit
picture, the fractional digits of a decimal overpunched with a 12-punch if the value
number are truncated so that the resulting is ~O; otherwise, it will contain the
value is zero, the sign inserted in the digit with no overpunching. It also
picture corresponds to the value of the specifies that an overpunch is to be
decimal number prior to its truncation. indicated in the character-string value
ThUS, the sign in the picture may depe~d on if the data value is ~O.
how the decimal value was calculated.
R specifies that the associated position,
Figure 0.5 gives examples of the use of on input, will contain a digit
drifting picture characters. In the overpunched with an ii-punch if the
figure, the letter b indicates a blank value is <0; otherwise, it will contain
character. the digit with no overpunching. It also
specifies that an overpunch is to be
indicated in the character-string value
if the data value is <0.
I CREDIT, DEBIT, OVERPUNCHED, AND ZERO
IREPLACEMENT SIGNS IY specifies that a zero in the specified
I digit position is to be replaced
I unconditionally by the blank character.
The character pairs CR (credit) and DB
(debit) specify the signs of real numeric Figure 0.6 gives examples of the CR, DB,
character data items and usually appear in loverpunch, and zero replacement characters.
business report forms. In the figure, the letter b indicates a
blank character.
Any of the picture characters T, I, or R
specifies an overpunched sign in.the Note: The picture characters CR, DB, T, I,
associated digit position of numeric and R cannot be used with any other sign
character data. An overpunched sign is a characters in the same field.
r---------------------------------------------------------------------------------------,
Source Source Data I Picture I Character-String
Attributes (in constant form) I Specification I Value 1
FLOAT(S) .12345E06 V.99999E99 .12345E06
FLOAT(S) .12345E-06 V.99999ES99 .12345E-06
FLOAT(S) .12345E+06 V.99999KS99 .12345+06
FLOAT(S) -123.4SE+12 S999V.99ES99 -123.45E+12
FLOAT(S) 001.23E-Ol SSS9.V99ESS9 +123.00Eb-3
FLOAT(S) 001.23E+04 ZZZV.99KS99 123.00+02
FLOAT(S) 0Ol.23E+04 SZ99V.99ES99 +123.00E+02
FLOAT(S) OOl.23E+04 SSSSV.99E-99 +123.00Eb02
1The arithmetic value is the value expressed by the mantissa, multiplied by 10 to the
power indicated in the exponent field.
L---------------------------------------------------------------------------------------J
Figure 0.7. Examples of floating-point picture specifications
This section describes each of the edit- appear in the stream, however, unless the
directed format items that can appear in specitied field width allows for them.
the format list of a GET or PUT statement. Truncation, due to inadequate field-width
specification is on the left for arithmetic
There are three categories of format items, on the right for string items.
items: data format items, control format
items, and the remote format item. Note that the value of binary data both
on input and output is always represented
In this section, the three categories in decimal form for edit-directed
are discussed separately and the format transmission.
items are listed under each category. The
remainder of the section contains detailed Following is a list of data format
discussions of each of the format items, items:
with the discussions appearing in
alphabetic order. Fixed-point format item F
General rules:
A-Format Item
1. The "field-width" is an expression
that is evaluated and converted to an
The A-format item is: integer, which must be non-negative,
each time the format item is used. It
A [(field-width)] specifies the number of data-stream
General rules:
C-&ormat Item
1. The "character-position" is an
expression which is evaluated and
The C-format item is: converted to an integer, which must be
non-negative, each time the format
C(rea1-format-item[,real-format-item]) item is used.
The complex format item describes the 2. The file is positioned to the
external representation of a complex data specified character position in the
item. current line, provided it has not
already passed this position. On
General rules: input, intervening character positions
are ignored; on output, they are
1. Each "real-format-item" is specified filled with blanks. If the file is
by one of the F-, E-, or P-format already positioned after the specified
items. The P-format item must character poSition, the current line
describe numeric character data; it is completed and a new line is
cannot describe character-string data. started; the format item is then
applied to the following line.
2. On input, the complex format item
describes the real and imaginary parts 3. If the specified character position
of the complex data item within lies beyond the rightmost character
adjacent fields in the data stream. position of the current line, or if
If the second real format item is the value of the expression for the
omitted, it is assumed to be the same character position is less than one,
as the first. The letter I will cause then the character position is assumed
5. If the GET or PUT statement is a The spacing format item controls the
single statement of an on-unit, i t relative spacing of data items in the data
cannot contain a remote format item. stream. It is not limited to PRINT files.
General rules:
*" Arithmetic Figure F. 4 Result is in coded arithmetic form When conversions are made between decimal and binary bases, the n CEI L (n"3'32) n CEIL (n/3'32)
values of the precision attributes need to be multiplied or divided by
No conversion required
3'32, and the result needs to be rounded to an integer. This table shows 1 4 1-3 1
- If operand is in coded arithmetic form
the result of the multiplication or division and rounding. 2 7 4-6 2
Operand is converted to FIXED DECIMAL If the source precision attribute is positive, the next largest integer 3 10 7-9 3
FIXED DECIMAL if it is a CHARACTER string or numeric (in PUI terms, the CEIL value) is taken after mu~tiplication. For example: 4 14 10-13 4
1 prefix +, - Arithmetic 5 14-16 5
target character (PICTURE) representation of a 17
5*3'32=16'6
fixed-point decimal number 6 20 17-19 6
CEI L (16'6)=17
7 24 20-23 7
Operand is converted to FLOAT DECIMAL The new precision attribute would therefore be 17.
8 27 24-26 8
FLOAT DECIMAL if it is a numeric character (PICTURE) This result could have been read directly from the table, which shows 9 27-29 9
30
target representation of a floating-point decimal that CEIL (n*3.32) where n=5 is 17. 10 30-33 10
34
number If the source precision attribute is negative (the scale factor of the 11 34-36 11 1/\
37
FIXED BINARY Operand is converted to FIXED BINARY if precision attribute may be negative), the next lowest integer (in PUI 12 40 37-39 12 RI
target it is a BIT string terms, the FLOOR value) is taken. For example: 13 44 40-43 13
DI
..., Bit string BIT target All non·BIT data converted to BIT (-5) *3'32=(-16'6)
14 47 44-46 14
15 50 47-49 15
FLOOR (-16'6)=(·17)
2 .. / Arithmetic FigureF.4 Result is in coded arithmetic form
The new scale factor would therefore be -17
16 54 50-53 16
17 57 54-56 17
3 infix +,., Arithmetic Figure F. 4 Result is in coded arithmetic form 18
It can be seen from the example that the table may be used with negative 18 60 57-59
If one or both operands are CHARACTER values as well as positive, since 19 64 60-63 19
CHARACTER target or DECIMAL, non-CHARACTER operand(s) 20 67 64-66 20
FLOOR (-n)=-CEll (n)
converted to CHARACTER 21 70 67-69 21
4
" Concatenation
If operands are BIT and BINARY or both
22
23
74
77
70-73
74-76
22
23
BIT target operands are BINARY, non·BIT operand(s) 24 80 77-79 24
converted to BIT 25 83 80-82 25
5 «-.. «= =-,= >= >-,> Comparison Figure F.5 Result is always either 'l'B or 'O'B 26
27
87
90
83-86
87-89
26
27
D
6 8, Bit string BIT target All non·BIT data converted to BIT 90-92 28
28 93
7 I Bit string BIT target All non·BIT data converted to BIT 29 97 93-96 29
30 100 97-99 30 D
Figure F.3 indicates target attributes for 100-102 31
All forms of assignment See specific target 31 103 FI
all forms of assignment 107 103-106 32
32 (a
33 110 107-109 33
Figure F.1. List of priority of operations and guide to conversion rules n
110-112 34
The operators are listed in order of priority, group 1 having the highest priority ana group 7 the lowest. All operators in the same priority 113-116 35
group have the same priority. For example, the exponentiation operator * * has the same priority as the prefix + and prefix - operators and
the "not" operator,: Figure F .2. Table of eEl L (n *3.32) and CE I L (n/3.32) values
If two or more operators in priority group 1 appear in an expression, the order of priority is right to left within the expression; the rightmost
exponentiation or prefix +, -, or., operator has the highest priority, the next rightmost the next highest, and so on. For all other operators,
1/
if two or more in the same priority group appear in an expression, their relative order or priority is their order left to right within the expression.
The purpose of this section is to help the Figure F.4 shows, for all arithmetic
user analyze a mixed expression, involving operations, the conversions that will take
problem data, to determine the conversions place.
that will occur, and the effect these
conversions will have on the final result. Figure F.S shows, for all problem data
In this context, an assignment is comparisons, the conversions that will take
considered as a special case of a mixed place.
expression. An expression is termed "mixed"
for one of two reasons: Source to target rules are given for
each of the following data types:
1. Operands have attributes that differ.
For example, Coded Arithmetic:
2. result2=resultl+FD
3. CH=result2 Step 3
step 1 p=1+19/3.32=7
q=7/3.32=3
The constant 4.2 has implied attributes of Refer to the rules for FIXED DECIMAL
FIXED DECIMALC2,1). source to CHARACTER target. The decimal
constant is assigned to an intermediate
Refer to figure F.4a using the string of length 10.
attributes of the constant as the first
operand and the attributes of FB as the The intermediate string is assigned to
second operand. This gives the code CH, which is padded on the right with two
reference S. In figure F.4d, code blank characters.
Coded Arithmetic
The four data types FIXED BINARY, FIXED DECIMAL, FLOAT BINARY, and
FLOAT DECIMAL are all coded arithmetic data. Rules for conversion
between them are given under each data type taken as a target.
However, the following general points should be noted:
CHARACTER
The constant will have base, scale, mode, and prec~s~on attributes.
It will be converted to the attributes of the target when they are
independent of the source attributes, as in the case of assignment.
see under specific target types of coded arithmetic data using the
attributes of the constant as the source.
BIT
BIT (continued)
FIXED BINARY
FIXED DECIMAL
FLOAT BINARY
This conversion can occur only when data is assigned. The precision
conversion is the same as that given for FIXED BINARY to FIXED BINARY
with p~ as declared or indicated and q~ as indicated by the binary
point position and modified by the value of the exponent.
FLOAT DECIMAL
This conversion can occur only when data is assigned. The precision
conversion is the same as that given for FIXED DECIMAL to FIXED BINARY
with P1 as declared or indicated and q~ as indicated by the d~cimal
point position and modified by the value of the exponen~.
FIXED BINARY
FIXED DECIMAL
FLOAT BINARY
This conversion can occur only when data is assigned. The prec1s10n
conversion is the same as that given for FIXED BINARY to FIXED DECIMAL
with P1 as declared or indicated and Q1 as indicated by the binary
point position and modified by the value of the exponent.
FLOAT DECIMAL
This conversion can occur only when data is assigned. The precision
conversion is the same as that given for FIXED DECIMAL to FIXED
DECIMAL with P1 as declared or indicated and Q1 as indicated by the
decimal pOint position and modified by the value of the exponent.
FIXED BINARY
FIXED DECIMAL
FLOAT BINARY
FLOAT DECIMAL
FIXED BINARY
FIXED DECIMAL
FLOAT BINARY
FLOAT DECIMAL
FIXED BINARY
FIXED DECIMAL
FLOAT BINARY
FLOAT DECIMAL
CHARACTER
The source string must represent a valid arithmetic constant: otherwise the
CONVERSION condition will be raised if enabled. (See Target: Coded Arithmetic).
BIT
If the length of the source string. is (n), the target must imply,
Coded Arithmetic
FIXED BINARY
FIXED DECIMAL
1. If p>=q>=O then:
FLOAT BINARY
FLOAT DECIMAL
2*p+13.
precision: (5)
value 17.3+1.51
string 'b1.7300E+01+1.5000E+OOI'
CHARACTER
The source string is assigned to the target string from left to right.
If the source string is longer than the target, excess characters on
the right are ignored, and the STRINGSIZE condition will be raised, if
enabled. If the target is longer than the source, the target is
padded on the right with blanks.
BIT
Bit 0 becomes character 0 and bit 1 becomes character 1. A null bit
string becomes a Dull character string. The generated character
string is assigned to the target string according to the rules given
for CHARACTER to CHARACTER.
Coded Arithmetic
FIXED BINARY
FIXED DECIMAL
MIN(31,CEIL«p-q)*3.32».
FLOAT BINARY
MIN(31,p).
FLOAT DECIMAL
MIN(31,CEIL(p*3.32».
CHARACTER
BIT
The source string is assigned to the target string from left to right.
If the source string is longer than the target, excess bits on the
right are ignored, and the STRINGSIZE condition will be raised, if
enabled. If the target is longer than the source, the target is
padded on the right with zeros.
entry in figure F.4b, then looking up the source to target rules indicated there; the source to target rules will give the BIT (nl) b b b b b,w b,y b,w b,x
intermediate attributes. Steps 1 and 2 are then repeated using the intermediate attributes_ Where an entry in figure Figure F .4c.
To determine whether mode of result is REAL or COMPLEX:
F.4a consists of two letters separated by a comma the first refers to the intermediate attributes of the first operand, If both operands are REAL, there is no conversion of mode and the result is REAL.
and the second to those of the second operand. If both operands are COMPLEX, there is no conversion of mode and the result is COMPLEX.
c. If the entry in figure F.4a consists of a number followed by a letter or letters in brackets, either use the number to If one operand is REAL and the other is COMPLEX, the REAL operand is converted to COMPLEX and the result is COMPLEX, with two exceptional
find the attributes of the result directly, according to the instructions in Step 2 (a) or follow through the intermediate cases. The exceptions are exponentiations in which the second operand (the exponent) is either a FIXED (p,O) variable or a fixed-point decimal
integer constant: in these cases, no conversion of mode takes place prior to evaluation but the result is COMPLEX, Code
conversions, according to the instructions in Step 2 (b). The latter method is likely to be of greatest value when debugging,
the former when writing the program_ Figure F .4a. Master Table for arithmetic operations 1 3 FLC
Note: The letters referring to intermediate operands do not apply when an exponentiation operation is to be [unl
p =
performed; this table cannot be used to determine intermediate operands for exponentiation operations. I
2 4 FLC
Maximum Precisions of Arithmetic Data [unl
p = I
Figures F .4c and F.4d give formulas for the calculation of precisions_ The actual precision values can never exceed the
implemented maximums, which are: 5 6 FLC
[unl
31 for FIXED BINARY
p= I
15 for FIXED DECIMAL
53 for FLOAT BINARY 7 8 FLC
[unl
16 for FLOAT DECIMAL
p= I
First Operand Second Operand
Target
Code Code
Note: There ar
a w FIXED DECIMAL
b x FIXED BINARY
Real mode:
c y FLOAT DECIMAL If x = 0 and y
d z FLOAT BINARY If x = 0 and y
Ifx<Oandy
Figure F .4b. Key to conversions condition is ra
Figure F .4d.
Second Operand Precision of the result
Code Attributes of result
Coded arithmetic Numeric character ADDITION or SUBTRACTION MU L TIPLICATION DIVISION
(PICTURE)
FIXED FLOAT p=15
CHARACTER (n:!) BIT (n2) 1 FIXED DECIMAL (p,ql
DECIMAL BINARY DECIMAL Fixed- p=1+MAX(PI-QI ,Pz- q2 1+ q P=PI + P~ + 1 q=15 - ((PI -qll +q~)
BINARY Floating-
· with any (P2,Q2) (P2,Q2) (P2) (P2 I point point q=MAX (ql,qzl q=ql + q~ p=31
2 FIXED BINARY (p,ql
to determine q=31 - ((p I - q I I + q~ I
DECIMAL
1 5(bl 3(c) 6(d) w Y w x 3 FLOAT DECIMAL (pI
(PI,ql)
mtry FIXED FLOAT BINARY (pI
p=MAX (PI, p:!)
BINARY 4
e numbers 7(x) 2 8(d,z) 4(d) w Y W x
(PI,qI)
Ihere there Coded p=1 + MAX (r - s, P2 - q2) + q p=l + r + P2 p=31
arithmetic DECIMAL 5 FIXED BINARY (p,q) q= MAX (s, q2 ) q=s + q2 p=31 - ((r - s) + q2 I
~ choice of
(ptl 3(y) 6(d,z) 3 6(d) W y W x
19 through FLOAT where r·o 1 + PI * 3.32, s = ql *3.32
First BINARY 6 FLOAT BINARY (p) p=MAX (PI *3.32, pz I
8(zl 4(z) a(z) 4 W y w x
Operand (PII
! to the
p=l + MAX (PI - ql, r - s) + q p=l + PI + r p=31
·hese are Numeric Fixed-point a a a a a,w a,Y a,w a,x q=MAX (q I, s) q=ql + S p=31-((PI -q\l+s
character 7 FIXED BINARY (p, q)
(PICTURE) Floating-point c c c c c,W c,Y c,W c,X where r = 1 + P2 * 3·32 and s=q2 * 3·32
~ch inter-
sponding CHARACTER (n I) a a a a a,w a,Y a,w a,x 8 FLOAT BINARY (p) p=MAX (PI, P:! *3.32)
Note 1: If the
Figure F .5b.
Second operand Type of
Code Attributes of comparison target
, are compared, comparison
Coded arithmetic Numeric
character 1 Algebraic No conversion
FIXED FLOAT (PICTURE)
o be evaluated; CHARACTER (n2) BIT (n2) 2 Character CHARACTER (MAX (nt, n2)) where (n1) and (n2) are the lengths of the first and second operands, respectively,
~se indicate DECIMAL BINARY DECIMAL BINARY Fixed- Floating-
(P2,q2) (P2,Q2) (P2) (P2) point point 3 Bit BIT (MAX (nl, n2)) where (nl) and (n2) are the lengths of the first and second operands, respectively
Id is converted,
DECIMAL 4 Algebraic FIXED BINARY (l+p"3'32, q*3'32) where (p,q) is precision of operand being converted (If operand is in numeric
iables being 1,1 4,1 5,1 8,1 1,10 5,11 1,12 4,13
(Pl,q.! character (PICTURE) form, see Note 1)
FIXED
BINARY 5 Algebraic FLOAT DECIMAL (p) where (p,q) is precision of operand being converted /If operand is in numeric character (PICTURE)
1,4 1,1 7,6 7,1 1,4 7,6 1,13 1,13
(Pt,ql) form, see Note 1 )
Coded
arithmetic DECIMAL 6 Algebraic FLOAT BINARY (p*3'32) where (p) is precision of operand being converted (If operand is in numeric character
1,5 6,7 1,1 6,1 1,5 1,11 1,14 6,9 (PICTURE) form, see Note 1)
(pd
FLOAT
First BINARY 7 ~Igebraic FLOAT BINARY (p) where (p, q) is precision of operand being converted (If operand is in numeric character (PICTURE)
operand 1,8 1,7 1,6 1,1 1,8 1,6 1,15 1,9
(p(l form, see Note 1)
Numeric Fixed-point 10,1 4,1 5,1 8,1 *10,10 5,11 10,12 4,13 8 Algebraic FLOAT BINARY (p*3'32) where (p, q) is precision of operand being converted (If operand is in numeric character
character (PICTURE) form, see Note 1)
~rand having (PICTURE) Floating-point 11,5 6,7 11,1 6,1 11,5 *11,11 11,14 6,9
9 !4lgebraic FLOAT BINARY (31)
.RY (31,0),
CHARACTER (n t ) 12,1 13,1 14,1 15,1 12,10 14,11 2,2 2,2
"No conver- 10 Algebraic FIXED DECIMAL (Precision same as implied by PICTURE specification of operand being converted)
1e two BIT (n.! 13,4 13,1 9,6 9,1 13,4 9,6 9,2 3,3 FLOAT DECIMAL (Precision same as implied by PICTURE specification of operand being converted)
11 Algebraic
Ie converted
If one operand is COMPLEX and the other is REAL, the REAL operand is converted to COMPLEX before the comparison is made, 12 Algebraic FIXED DECIMAL (15,0)
:IXED
13 Algebraic FIXED BINARY (31,0)
.. For the optimizing compiler only, if both operands are numeric character form and have identical PICTUR E specifications, the
type of comparison is character and no conversion of operands takes place, 14 Algebraic FLOAT DECIMAL (15)
Note 7: If the operand being converted is in numeric character form, its precision is that which is implied by the PICTURE specification,
Each function in the alphabetical list These functions allow the programmer to
is identified by the general form of the control conversion of base, scale, mode,
function reference (the pseudovariable and precision both directly and during
reference is always identical to the basic arithmetic operations. Other
equivalent function reference). In functions in this class are used to
general, each function description has the investigate simple properties of arithmetic
following items: values, for example, the SIGN function
indicates the sign of an arithmetic value.
1. A description of the value returned. They are:
These functions all operate on array These functions allow the programmer to
arguments and return a single value investigate the current state of a file.
property of an array. They are: They are:
CONVERSION OF ARGUMENTS
These functions allow the programmer to
investigate the current state of an event
variable. They are: Conversion of arguments can occur for many
of the built-in functions. Arguments to
COMPLETION these built-in functions can be operational
PRIORITY expressions. An expression argument, which
STATUS can include references to built-in
Let f(x) = the true value for the I The functions tnat have nO arguments or
function Ihave a Single optional argument are:
PSEUDOVARIABLES
COMPLETION REAL
COMPLEX STATUS
IMAG STRING
ONCHAR SUBSTR
ONSOURCE UNSPEC
PRIORITY
1
1---------------------------------------------------------------
I 10<ABS{x)~100
1 4.0 1 12 1 100 1 270
1-------------------------------------------------------------------------
1 complex 1 3 120
ABS(a)~10,ABS(b)~11 1 320 1 31 1 380
cOSD(x) 1 similar to real COS (x)
The pseudovariable sets the completion CONJG returns the conjugate of a given
value of the given event x. x must be complex value x, i.e., the same value with
inactive. No interrupt can occur during the sign of the imaginary part reversed.
assignment to the pseudovariable. The If x is real, it will be converted to
COMPLETION pseudovariable cannot be used as complex.
the control variable in a do-goup.
cos(a)*cosh(b)-i*sin(a)*sinh(b)
(MIN(N,MAX(p1-Q1,Pa-qa)+MAX(q1,qa»,
MAX(Q~,q2» COSH returns a floating-point value that
represents the hyperbolic cosine of a given
where (P1,Q1) and (Pa,qa) are the value x.
precisions of X1 and Xa respectively, and N
is the maximum number of digits allowable. If x is complex, the result is given by:
COMPLEX Pseudovariable
COUNT returns a binary integer of default
precision specifying the number of data
The pseudovariable assigns the real part of items transmitted during the last GET or
a complex value to the variable X1 and the POT operation on the specified file x.
imaginary part to the variable xa. Only a
complex value can be assigned to the x a file expression, the file must have
pseudovariable. The COMPLEX pseudovariable the STREAM attribute.
cannot be used as the control variable in a
do-group. The count of transmitted items for a GET
I
COUNTER Preprocessor I If x is a scalar varying-length string,
Ithe returned value includes the length-
Iprefix of the string and the number of
COUNTER returns a character string of Icurrently-used bytes; it does not include
length 5, containing a decimal number. lany unused bytes in the string.
The returned number is 00001 for the first
invocation, and is incremented by one on I
each successive invocation. COUNTER may be I If x is a scalar area, the returned
used to generate unique identifiers, or for Ivalue includes the area control bytes and
general counting purposes. Ithe current extent of the area; i t does no~
linclude any unused bytes at the end of the
If COUNTER is. invoked more than 99999 larea.
times, a diagnostic is issued and 00000 is
returned. The next invocation is treated
as the first. If x is structure or array containing
areas or varying-length strings, the
returned value includes the area control
bytes, the maximum sizes of the areas, the
CURRENTSTORAGE(x) storage Control length prefixes of the strings, and the
number of bytes in the maximum lengths of
the strings. There is one exception to
Abbreviation: CSTG(x) this rule: if x is a structure whose last
element is a non-dimensional area, the
returned value includes that area's controi
CURRENTSTORAGE returns a fixed-point binary bytes and the current extent of that area;
integer of precision (31,0) giving the i t does not include any unused bytes at the
implementation-defined storage, in bytes, end of that area.
required by a specified variable Wx".
I
x a variable of any data type, data I CURRENTSTORAGE cannot be used to obtain
organization, and storage class Ithe storage requirements of a structure
except: Imapped according to the COBOL mapping
I algorithm.
1. A BASED, DEFINED, parameter,
subscripted, or structure-base-
element variable that is an
unaligned fixed-length bit string.
DATAFIELD condition-handling
2. A minor structure whose first or
last base element is an unaligned
fixed-length bit string (except DATAFIELD is used in a NAME condition on-
where i t is also the first or last unit to return a character string whose
element of the containing major value is the name and contents of the field
structure). that caused the condition to be raised.
3. A major structure that has the It can also be used in an on-unit for an
BASED, DEFINED, or parameter ERROR or FINISH condition raised as part of
attribute, and which has an the standard system action for the NAME
unaligned fixed-length bit string condition.
as its first or last element.
If DATAFIELD is used out of context, a
4. A variable not in connected null string is returned.
DATE returns a character string of length DIVIDE returns the quotient of two values
six, in the form yymmdd, where: X1 and xa with a precision specified by X3
and x", •
Xa divisor
FLOAT returns the floating-point lMAG returns the imaginary part of a given
representation of a given value X1 with a complex value x. If real, x is converted
precision specified by xa. to complex. The mode of the result is
real.
X1 value to be converted to floating-
point scale.
Xa unsigned decimal integer constant lMAG Pseudovariable
specifying the total number of digits
in the result. If Xa is omitted, the
default value 21, for a binary result, The pseudovariable assigns a real value or
or 6, for a decimal result, is real part of a complex value to the
assumed. imaginary part of a given complex variable
x. x must be complex.
FLOOR(x) Arithmetic
INDEX(x"Xa) string-handling
FLOOR returns the largest integer less than
or equal to a given value x. x must be INDEX returns a halfword binary integer
real. indicating the starting position within the
string X1 of a substring identical to
If x is fixed-point with prec1s1on (p,q), string xa.
the precision of the result is given by:
X1 string to be searched
("IN(N,MAX(p-q+l,l»,O)
xa string to be searched for
where N is the maximum number of digits
allowable. If xa does not occur in X1. the value
IINDEX(xs,xa) Preprocessor
I
I
IINDEX (preprocessor) returns a FIXED value LINENO(x) Input/output
lindicating the starting position within
Istring X1 of a substring identical to
Istring xa. LINENO returns a default-precision fixed-
I point binary integer specifying the current
X1 string to be searched line number of the specified file x.
Xa string to be searched for x a file expression, the file must have
the PRINT attribute.
If Xa does not occur in X1, the value zero
is returned.
If xa occurs more than once in X1 , the LOG (x) Mathematical
starting position of the first "occurrence
is returned.
LOG returns a floating-point value that
The arguments of INDEX (preprocessor) are represents the natural logarithm, i.e.,
converted to character if necessary. base e, of a given value x. If x is real,
it must be greater than zero. If x is
complex, it must not be equal to 0+01. The
fUnction is multiple-valued if x is
LENGTH (x) String-handling complex; hence, only the principal value
can be returned. The principal value has
the form:
LENGTH returns a default-precision fixed-
point binary integer specifying the current (a+i*b)
length of a given string x. If x is
binary, it is converted to bit string; where b is the range:
otherwise any other conversion required is
to character string. -pi<b<=pi.
LOW returns a character string of length x If the arguments, after any necessary
where each character is the lowest conversions have been performed,. are
character in the collating sequence floating point, and their precisions are
(hexadecimal 00). If necessary, x is P~,Pa'P3 ••• Pn, then the precision of the
converted to binary integer of precision result is MAX(P1,Pa,P3 ••• Pn).
(15,0).
Arithmetic
Ari thmet'ic
MIN returns, from a set of two or more
arguments, the value of the argument with MULTIPLY returns the product of two values
the smallest value. X1 and xa with a precision specified by X3
and X41 •
X1,Xa ••• ,xn list of values from which the
smallest is to be returned. X1 and xa values to be multiplied.
The maximum number of arguments that the unsigned decimal integer constant
function will accept is 64. All the specifying the number of digits to be
arguments must be real. maintained throughout the operation;
it must not exceed the implementation
If the arguments are fixed-pOint with limit.
precisions:
decimal integer constant, optionally
(P1,~),(Pa,Qa)···,(Pn,~) signed, specifying the scale factor of
the result. For a fixed-pOint result,
the precision of the result is given by: if x4\is omitted, a scale factor of
zero is assumed. For a floating-pOint
(MIN(N,MAX(p1-q1,P2-Qa···,Pn-qn)+ result, only X3 can be given.
NULL returns a null pOinter value, i.e., a ONCODE returns a default-precison fixed-
value that cannot identify any generation point binary integer that defines the
of a variable. The null pOinter value can type of interrupt that caused the on-unit
be converted to OFFSET by assignment of the to become active. It can be used in any
built-in function value to an offset on-unit. All on-codes are defined in
variable. section H, "On-Conditions".
ONCOUNT Condition-handling
OFFSET returns an offset value derived from
a given pOinter x~ and relative to a given
area X2. If x~ is null, then the null ONCOUNT returns a default-precision fixed-
value is returned. pOint binary integer specifying the number
of interrupts that remain when an on-unit
x~ a pointer expression. It must is entered. Both types of multiple
identify a generation of a based interrupt are discussed in section H, "ON-
variable within area X2. Conditions".
ONFILE Condition-handling
ONCHAR Condition-handling
ONFILE returns a character string whose
value is the name of the file for which an
ONCHAR returns the character that caused input/output or CONVERSION condition is
the CONVERSION condition to be raised. It raised. It can be used in an on-unit for
can be used in an on-unit for the any input/output or CONVERSION condition,
CONVERSION condition or for ERROR or FINISH or for the ERROR or FINISH condition raised
condition raised as standard system action as standard system action for an
for the CONVERSION condition. input/output or the CONVERSION condition.
If the ONCHAR built-in fUnction is used If ONFILE is used out of context, a null
out of context, a blank is returned unless string is returned.
ONCBAR has a value given to i t by an
assignment to the pseudovariable out of
context; in this case, the character
assigned to the pseudovariable is returned Condition-handling
by the built-in function.
Ix a parameter of a preprocessor
Condition-handling I procedure.
ONLOC returns a character string whose I PARMSET may be used only within a
value is the name of the entry-point of the Ipreprocessor procedure, and x must be a
procedure in which the condition was Iparameter of that procedure. It may be
raised. It can be used in anyon-unit. lused freely in preprocessor expressions.
ONSOURCE returns a character string whose , PARMSET is always returns zero if the
value is the contents of the field that was Iprocedure reference does not contain an
being processed when the CONVERSION largument that matches the specified
condition was raised. It can be used in an ,parameter. However, PARMSET may also
on-unit for the CONVERSION condition or for Ireturn zero if a matching argument does
the ERROR or FINISH condition raised as appear in the reference, but the reference
standard system action for the CONVERSION is in another preprocessor procedure. The
condition. rules that apply in this case are as
follows:
If ONSOURCE is used out of context, a
null string is returned. 1. If the argument is not itself a
parameter of the invoking procedure,
PARMSET returns one.
n-m
POINTER(x"Xa) storage Control
~ a(m+j)*x(l)**j
Abbreviation: PTR(x1 ,xa) j=O
X1 must not be iSUB-deinfed.
POINTER returns a pointer value derived
from a given offset value X1 and a given
area xa. If X1 is null then the null value
is returned. PRECISION(x"xa[,xa]) Arithmetic
I
1 A value of 'O'B is returned if the file SINH returns a floating-point value that
Idoes not have the KEYED and SEQUENTIAL represents the hyperbolic sine of a given
I attributes, if the file is not open, if the value x. If x is complex, the result is
Ifile is not associated with a VSAM indexed given by:
Idata set, or if the record processed is not
Ifollowed by another record with the same sinh(a)*cos(b)+i*cosh(a)*sin(b)
I key.
1 where (a+i*b) represents x.
I If the input/output operation causes a
Icondition other than RECORD to be raised,
Ithe value of SAMEKEY is 'O'B if file
Ipositioning has been changed or lost. SQRT(x) Mathematical
I Otherwise, the value of SAMEKEY remains
I unchanged.
I SQRT returns a floating-point value that
I The value returned by SAMEKEY is represents the square root of x. If x is
lundefined if ·x· has the STREAM attribute. real, it must not be less than zero. The
result is the positive square root of x.
If x is complex, the function is multiple-
valued; hence, only the principal value can
SIGN(x) Arithmetic be returned. The principal value has the
form:
SIGN returns a default-precision fixed- (a+i*b)
point binary integer that indicates whether
a given value x is positive, zero, or where either a>O, or a=O and b>=O.
negative. The value returned is as
follows:
value of x value returned STATUS[(x)] Multitasking
x > ° +1
STATUS returns a default-precision fixed-
x = ° pOint binary integer specifying the status
° value of a given event x. If the event is
x < ° -1 normal, zero is returned; if abnormal, non-
zero is returned. If no argument is
x must be real. specified, the event associated with the
current task is assumed.
NOOVERFLOW FINISH
NOUNDERFLOW
90 SIGNAL END PAGE statement executed. 341 High order non-zero digits have
or been lost in an input/output
Attempt to start new line when operation.
626 Error exists in character P-format 1018 End of file or string was
input for a GET FILE statement encountered in data before end of
following a TRANSMIT condition. data-list or (in edit-directed
transmission) format list.
ERROR Condition Codes
1019 Attempt to close file which was
~: For other ERROR conditions, see not opened in current task.
condition codes 3 and 9.
1020 Further input/output attempted
1002 GET or PUT STRING specifies data before WAIT statement executed to
that exceeds size of string. ensure completion of previous
READ.
1003 Further output prevented by
TRANSMIT or KEY conditions having 1021 Attempt to access a record locked
been previously raised for the by another file in this task.
data set.
1022 Insufficient space on direct-
1004 Attempt to use PAGE, LINE, or SKIP access storage for VSAM data set.
S 0 for non-print file.
1023 Exclusive file closed while
1005 In DISPLAY(element-expression) records still locked in a subtask.
REPLY (character-variable)
statement, element-expression or 1024 Incorrect sequence of I/O
character-variable is of zero operations on device-associated
length. file.
CONDITION
Classification of Conditions
7. Conversational Processinq Condition
Description: The ATTENTION condition is The optional -name list- is one or more
raised when the user signals attention at names separated by commas; a name may be a
the terminal during conversational qualified name. Each name must be one of
I processing. Raising the condition the following:
interrupts processing to enter an ATTENTION
lon-unit, or, for the checkout compiler 1. An entry constant.
only, to pass control to the terminal.
2. A label constant.
The condition can also be raised by a
SIGNAL ATTENTION statement in batch or 3. An unsubscripted variable representing
conversational processing. an element, an array, or a structure,
of any data type. The variable must
I Under the optimizing compiler, an not be iSUB-defined, and must not be
IATTENTION on-unit will be entered when explictly qualified by a locator in
lattention is signaled only if the INTERRUPT the name-list.
Normal Return: Upon the normal termination If a SIGNAL statement is used to raise
of the on-unit for the condition, execution ENDPAGE, this condition can also occur
continues with the statement immediately during output of the page.
following the GET or READ statement that
caused the ENDFILE (or, if ENDFILE was standard system Action: In the absence of
raised by a READ with the EVENT option, an on-unit, the system starts a new page.
control passes back to the WAIT statement If the condition is si9naled, execution is
from which the on-unit was invoked). unaffected and continues with the statement
following the SIGNAL statement.
Note: If a file is closed in an on-unit
for this condition, the results of normal Status: ENDPAGE is always enabled: it
return are undefined. Exit from such an cannot be disabled.
on-unit should be by means of a GO TO
statement. Normal Return: Upon the normal completion
of the on-unit for this condition,
execution of the PUT statement continues in
the manner described above.
ENDPAGE (element-file-expr) -Input/Output
standard system Action: This depends on Description: The KEY condition can be
the processing mode: raised only during operations on keyed
records. It is raised in any of the
Batch processing (optimizing or checkout following cases:
compiler): No action is taken; that is,
proceSSing is continued from the point 1. The keyed record cannot be found.
Normal Return: Upon the normal completion Note: The value of the ONKEY Duilt-in
of the on-unit for this condition, the fUnCtion when the PENDING condition is
execution of the GET statement continues raised is a null string.
with the next identifier in the stream.
Abbreviation: STRG
Computational
Definition: The STRINGRANGE condition is
raised whenever the lengths of the
Description: The SIZE condition occurs arguments to a SUBSTR reference fail to
only when high-order (i.e., leftmost) comply with the rules described for the
significant binary or decimal digits are SUBSTR built-in function. It is raised for
lost in an assignment to a variable or an each such reference.
intermediate result or in an input/output
operation. This loss may result from a Standard System Action: A message is
conversion involving different data types, printed and processing continues as
different bases, different scales, or described for normal return.
different precisions.
status: STRINGRANGE is disabled by default
The SIZE condition differs from the and within the scope of a NOSTRINGRANGE
FlXEDOVERFLOW condition in that, whereas condition prefix. It is enabled only
FIXEDOVERFLOW occurs when the size of a within the scope of a STRINGRANGE condition
Abbreviation: STRZ
TRANSMIT (element-file-expr) Input/Output
Definition: The STRINGSIZE condition is
raised when a string is about to be
assigned to a shorter string. Description: The TRANSMIT condition can be
raised during any input/output operation.
Result: After the interrupt, the truncated It is raised by a permanent transmission
string is assigned to its target string. error and therefore signifies that any data
The right hand characters or bits of the transmitted is potentially incorrect.
source string are truncated so that the
target string can accomodate the source During input, TRANSMIT is raised after
string. assignment of the potentially incorrect
record. If records are blocked, TRANSMIT
standard System Action: A message is is raised for each subsequent record in the
printed and processing continues. block. During output, TRANSMIT is raised
This section gives detailed descriptions of The ALXGNED and UNALIGNED attributes
all attributes in alphabetical order. .specify the pOSitioning of data elements in
Alternative attributes are discussed storage, to influence speed of access or
together. storage economy respectively. They may be
specified for element, array, or structure
Figure 1.1 has been compiled from the variables.
individual rules for attributes and is
intended to serve as a quick reference to ALIGNED specifies that the data element
the following: is to be aligned on the storage boundary
corresponding to its data type requirement.
1. The classification of attributes
according to data type. UNALIGNED specifies that a bit string is
to be mapped on the next available bit
2. The valid combinations of attributes bo~ndary, and that a halfword, a word, or
that may be applied to a data item. doubleword item is to be mapped on the next
For a variable, attributes must be available byte boundary.
selected from the columns Data
Attributes, Scope Attributes, Storage General format:
Attributes, and Alignment Attributes.
For the types of constants shown in ALIGNED I UNALIGNED
the table, attributes must be selected
from columns Data Attributes and Scope General rules:
Attributes. Note that a complete set
of attributes for a data item may be 1. Although they are essentially element
obtained by explicit or contextual data attributes, ALIGNED and UNALIGNED
declaration and programmer-defined or can be applied to any array or
standard defaults. structure. This is equivalent to
applying the attribute to all
3. Those attributes that conflict. contained elements that are not
Attributes shown as applying to one explicitly declared with the ALIGNED
data type conflict with those of any or UNALIGNED attribute.
other data type, except for those
attributes shown as applying to both 2. Application of either attribute to a
types. Alternative attributes within contained array or structure overrides
a data type, e.g., BIT and CHARACTER, an ALXGNED or UNALIGNED attribute that
are conflicting. otherwise would apply to elements of
the contained aggregate by having been
The following example illustrates the specified for the containing
function of the figure: structure.
DECLARE ST BIT(10); 3. The LIKE attribute is expanded before
the ALIGNED and UNALIGNED attributes
Given the above declaration, the standard are applied to the contained elements
default attributes, AUTOMATIC, INTERNAL, of the LIKE structure variable. The
and UNALIGNED will be applied to the name only ALIGNED and UNALIGNED attributes
ST. that are carried over from the LIKE
structure variable are those
Figure 1.2 is an expansion of the entry explicitly specified for substructures
for file constants in figure 1.1, to and elements of the structure
include the relationships between file variable.
attributes and options of the ENVIRONMENT
attribute for the different data set 4. For overlay defining involving bit-
organizations. The figure also shows the and character-class data, both the
attribute implications of each file defined item and the overlaid part of
attribute. the base item must be UNALIGNED. For
all other types of defining,
equivalent i~ems must be either both
ALIGNED or both UNALIGNED.
ALIGNED and UNALIGNED
5. The ALIGNED and UNALIGNED attributes
of an argument actually passed must
Abbreviation: UNAL for UNALIGNED match the attributes of the
Attrihutes Implied
F FILE I I I I I I I I I
I STREAM D - - - - - - - - FILE
L RECORD - I I I I I I I I FILE
E INPUT D D D D D D D D D FILE
OUTPUT 0 0 0 0 0 0 0 0 0 FILE
A UPDATE - 0 0 0 - 0 0 0 0 FILE RECORD
T SEQUENTIAL - D D D - D D - - FILE RFCORD
T DIRECT - - - - - - - S S FILE RECORD KEYED
R BUFFERED - D D D I - - - - FILE RECORD
I UNBUFFERED - - - - - S S D D FILE RECORD
B PRINT 0 - - - - - - - - FILE STREM1 OUTPUT
U BACKWARDS - 0 - - - 0 - - - FILE RECORD SEOUENTIAL INPtlT
T KEYED - - 0 0 I -. 0 I I FILE RECORD
E TRANSIENT - - - - I - - - - FILE
EXCLUSIVE - - - - - - - 0 0 FILE RECORD
ENVIRONMENT I I S S S I S S S FILE
0
P
FIFBIFSIFBSIVI I S - - - S - - -
VBIVSIVBSIU VS and VBS are invalid with STRE1\M
T FIFBIDIDBlu S S - - - - - - - ASCII data sets only
I FIVIVSIU - - - S - - S - S Only F for REGIONAl, (1) and (2)
0 FIFBIVIVB
N RECSIZE(n)
- - S - - - - S - vs invalid with mmUF
I I I I I I I I I One or both must be specified for
S BLKSIZE(n) I I I I - I I I I { CONSECUTIVE, INDEXED, and RFGIONAL fi lese
ASCII 0 0 - - - - - - -
0 BUFOFF(n) 0 0 - - - - - - -
F CTLASAICTL360 - 0 - - - 0 - - - } invalid for ~SCII data sets.
SCALARVARYING - 0 0 0 - 0 0 0 0
E LEAVE 0 0 - - - 0 - - -
N REREAD 0 0 - - - 0 - - -
V COBOL - 0 0 0 - 0 0 0 0
I BUFFERS(n) I I I I I - - - -
R CONSECUTIVE - D - - - D - - -
0 INDEXED - - S - - - - S -
N REGIONAL - - - S - - S - S
M ({11213})
E TP ({MI R}) - - - - S - - - -
N KEYLENGTH(n) - - S S - - S S S for REGIONAL (2) ann (3) OUTPUT only
T KEYLOC(n) - - 0 - - - - 0 -
NCP(n) - 0 0 0 - 0 0 0 0
TRKOFL - 0 - 0 - 0 0 - 0 invalid for REGIONAL (3)
INDEXAREA(n) - - - - - - - 0 -
ADDBUFF(n) - - - - - - - 0 -
NOWRITE - - - - - - - 0 - UPDATE files only.
GENKEY - - 0 - - - - 0 - INPUT or UPDATE files only; KEYED
is required.
TOTAL 0 0 0 0 0 0 0 0 0
Additional Notes:
Figure 1.2. File declarations (files associated with non-VSAM data sets)
6. If abased variable is used to refer 2. The size for areas of static storage
to a generation of another variable, class must be specified as a decimal
the ALIGNED and UNALIGNED attributes integer constant. The theoretical
of both variables must agree. maximum size permitted is 16,111,200
bytes; in practice the maximum depends
1. The alignment of string data depends on the amount of main storage
not only on the use of ALIGNED or available to the program.
UNALIGNED, but also on whether the
strings are fixed-length or varying- 3. An asterisk may be used to specify the
length. A summary of string alignment size if the area variable being
is included in figures K.1 and K.2. declared is controlled or is a
parameter. In the case of a
8. TASK r EVENT r and AREA cannot be controlled area variable that is
unaligned. declared with an asterisk, the size
must be specified in the ALLOCATE
9. If an unaligned fixed-length bit statement used to allocate the area.
string is used as the argument of the In the case of a parameter that is
ADDR function, or appears as the first declared with an asterisk, the size is
element of a based structure which is inherited from the argument.
used in a LOCATE or ALLOCATE
statement, the locator value returned 4. Data of the area type cannot be
may not address the bit string at the converted to any other type; an area
first bit position. can be assigned to an area variable
only.
Assumptions:
5. No operators can be applied to area
1. Defaults are applied at element level. variables.
The default for bit-string data,
character-string data, and numeric 6. An area variable cannot be unaligned.
character data is UNALIGNED; for all
other types of data, the default is 1. If an area has the BASED attribute,
ALIGNED. the size attribute must be a decimal
integer constant unless the area is a
2. For all operators and user-defined and member of a based structure and the
built-in functions, the default for REFER option is used (see chapter 8,
ALIGNED or UNALIGNED is applicable to ·storage Control").
the elements of the result.
8. For RECORD input/output, only the
3. Constants take the default for ALIGNED extent (rather than the declared size)
or UNALIGNED. and control information of an area is
transmitted (except when the area is
in a structure and is not the last
item in it - then, the declared size
is transmitted).
Assumptions:
The AREA attribute defines storage that, on 1. If the size specification is omitted,
allocation, is to be reserved for the a default value is assumed. For this
allocation of based variables. storage implementation, it is 1000.
thus reserved can be allocated to and freed
from based variables by naming the area 2. An area variable can be contextually
variable in the IN option of the ALLOCATE declared by its appearance in an
and FREE statements. Storage that has been OFFSET attribute or an IN option.
freed can be subsequently reallocated to a
based variable.
BACKWARDS
The BACKWARDS attribute specifies that the BIT, CHARACTER, and VARYING
records of a SEQUENTIAL INPUT file
associated with a data set on magnetic tape
are to be accessed in reverse order, i.e., Abbreviations: CHAR for CHARACTER
from the last record to the first record. VAR for VARYING
l
conflicts with the STREAM attribute. BIT
It implies RECORD and SEQUENTIAL. (length)] [VARYING]
CHARACTER
2. The BACKWARDS attribute applies to
magnetic tape files only. General rules:
Assumptions:
CHARACTER
An identifier that appears with the
CONDITION condition in an ON, SIGNAL, or
see BIT. REVERT statement is contextually declared
to be a condition name.
CONDITION
1. A base variable may be, or may 2. The defined variable must have the
contain, a VARYING string, provided dimension attribute. In the
that the corresponding part of the declaration of the defined array, the
defined variable is a VARYING string base array must be subscripted, and
of the same maximum length. the subscript positions cannot be
specified as asterisks.
Examples:
3. The POSITION attribute cannot be used
DCL A(lO,lO,lO), in iSUB defining.
Xl(2,i,2) DEF A,
X2(10,10) DEF A(*,*,S), 4. An iSUB variable is a reference, in
X3 DEF A(L,M,N); the subscript list for the base array,
to the ith dimension of the defined
Xl is a three-dimensional array that array. At least one subscript in the
consists of the first two elements of base-array subscript-list must be an
each row, column and plane of A. X2 iSUB expression which, on evaluation,
is a two-dimensional array that gives the required subscript in the
consists of the fifth plane of A. base array. The value of i ranges
X3 is an element that consists of the from 1 to n, where n is the number of
element identified by the subscript dimensions in the defined array. The
expressions L,M,and N. number of subscripts for the base
array must be equal to the number of
DCL B CHAR(lO), dimensions for the base array.
Y CHAR(S) DEF B;
S. As well as the general rules for
Y is a character string that consists evaluation, the following should be
of the first five characters of B. noted:
2. Both the defined and the base 7. Under the optimizing compiler, an
variables must belong to the bit array overlay-defined on another array
class, or both must belong to the is always assumed to be in unconnected
character class. The bit class storage. Under the checkout compiler,
consists of: it is treated as being in unconnected
storage only when the bounds of the
a. Fixed-length bit strings. base and defined items differ.
Assumptions:
4. A dummy argument is created for a file The FIXED and FLOAT attributes cannot be
constant argument to a CALL statement specified with the PICTURE attribute.
or function reference.
Assumptions:
5. A file variable may be specified in a
CHECK prefix list. Tqe CHECK Undeclared identifiers (or identifiers
condition is not raised for such a declared only with one or more of the
file variable by its appearance as a dimension, ALIGNED or UNALIGNED, scope, and
FILE option in ON, SIGNAL, and REVERT storage class attributes) are assumed to be
statements. arithmetic variables with aSSigned
attributes depending upon the initial
6. The value of a file variable may be letter. For identifiers beginning with any
transmitted by record-oriented letter I through N, the standard default
transmission statements. The value attributes are REAL FIXED BINARY (15,0).
may not be valid after transmission. For identifiers beginning with any other
alphabetic character, the standard default
7. The values of two file expressions may attributes are REAL FLOAT DECIMAL (6). If
be compared using either the = or BINARY or DECIMAL and/or REAL or COMPLEX
comparison operator. The expressions are specified, FLOAT is assumed.
compare equal only if they represent
file values, all of whose parts are
equal.
Assumptions:
A: PROC: entry-constant
DCL B GENERIC (C WHEN(FIXED),
D WHEN(FLOAT»: file-constant
CALL E(B):
E: PROC (P): label-constant
DCL P ENTRY(FIXED):
[+1-1real-constant{+I-limaginary
constant
END E:
END A: The term "expression" denotes an
element expression used to provide an
When procedure E is invoked, C is initial value to be assigned to the
selected and passed as the argument, initialized data item. An expression
since the parameter of entry name is always enclosed in parentheses when
parameter is declared to be FIXED. specified in the INITIAL attribute.
The term ~reference" denotes a
reference to a variable or a function
which can be used for the initial
value of the data item.
INITIAL
3. The time at which the INITIAL
attribute is applied depends on the
Abbreviation: INIT storage class of the variable.
The INITIAL attribute has two forms. STATIC: When the external procedure
The first specifies a constant, expression, in which the variable is declared
or function reference, whose value is to be is entered.
assigned to a data item when storage is
allocated to it. The second form specifies AUTOMATIC: When the block in which
that, through the CALL option, a procedure the variable is declared is
is to be invoked to perform initialization entered.
at allocation. The variable is initialized
by assignment during the execution of the CONTROLLED: When the ALLOCATE
called routine (rather than by this routine statement is executed.
being invoked as a function that returns a
value to the point of invocation). BASED: When an ALLOCATE or a LOCATE
statement is executed for the
General format: variable. If the variable is
referenced only by setting a
1. INITIAL (item [,item1 ••• ) pOinter and is never specified in
an ALLOCATE or LOCATE statement,
2. INITIAL CALL entry-expression the INITIAL attribute specified in
[argument-list1 a DECLARE statement is never
applied.
General rule:
4. Only one initial value can be
The INITIAL attribute cannot be given to specified for an element variable:
constants, defined data, structures or more than one can be speCified for an
parameters (except CONTROLLED parameters). array variable. A structure variable
can be initialized only by separate
Rules for form 1: initialization of its elementary
2. Form 2 cannot be used to initialize The INPUT, OUTPUT, and UPDATE attributes
STATIC data. indicate the function of the file. INPUT
specifies that data is to be transmitted
from auxiliary storage to the program.
Examples: OUTPUT specifies that data is to be
transmitted from the program to auxiliary
a. DECLARE SWITCH BIT (1) storage either to create a new data set or
INITIAL ('l'B); extend an existing one. UPDATE specifies
that the data can be transmitted in either
b. DECLARE MAXVALUE INITIAL (99), direction; that is, the file is both an
MINVALOE INITIAL (-99); input and an output file.
Z(2): A = A + B + C * D; Assumptions:
INTERNA~
GO TO Z(I);
See EXTERNAL.
EXIT: RETURN;
1 A, 2 C, 3 G, 3 H
Length Attribute
1 B LIKE A.C is expanded to give:
See BIT. 1 B, 3 E, 3 F
2. The options can be specified in any where i,j, ••• are decimal integers,
order. and the option is to apply to the ith,
jth, ••• items in the argument list of
3. The COBOL option specifies that the procedure reference.
designated entry point is in a COBOL
subprogram. Only the arguments to which this
option applies are specified in the
4. The FORTRAN option specifies that the argument list; they can be specified
designated entry point is in a FORTRAN in any order.
subroutine or function.
If there is no argument list for an
5. The ASSEMBLER option specifies that option, the option is assumed to apply
the designated entry point is in an to all the arguments passed on
assembler subroutine; this option aids invocation of the entry name.
invocation of the entry pOint from a
PL/I program, by causing arguments to An OPTIONS specification should not
be passed directly to the subroutine, include the same argument in more than
rather than via PL/I control blocks. one specified or assumed argument
The option is subject to the following list.
rules:
1. The INTER option specifies that the
a. An entry name declared with the PL/I interrupt handling facilities are
OPTIONS (ASSEMBLER) attribute to deal with those interrupts
cannot be used as a function occurring during execution of a non-
reference. PL/I routine or subprogram that are
not handled by the invoked program or
b. Any number of arguments can be its associated facilities. Note that
passed in the CALL statement routines executed with the INTER
invoking the entry, from zero up option must follow certain PL/I
to the number implied by the entry conventions if the interrupt is to be
declaration, but intervening successfully handled by PL/I. (See
arguments cannot be omitted. the programmer's guide for the
compiler. )
c. If the INTER option (see rule 1)
is omitted, a warning diagnostic ~ For Models 91 and 195, the INTER
will be issued, and INTER will be option will pass all interrupts to the
assumed; the PL/Iinterrupt PL/I interrupt handler, never to the
handling facilities will deal with appropriate non-PL/I routines.
interrupts that are not handled by
the assembler routine, provided 8. The RETCODE option specifies that, on
that certain PL/I conventions are return from the non-PL/I routine, the
followed. (see the programmer's value in the lower half of register 1~
guide for the compiler.) is to be saved as the PL/I return
code. This option enables non-PL/I
d. Multitasking options cannot be routines to pass return codes to PLiI.
used when invoking subroutines for The value of the return code can be
which OPTIONS(ASSEMBLER) has been interrogated by means of the PLIRETV
specified. built-in function.
Assumptions:
see INPUT.
If attributes are not supplied in a
DECLARE statement, default attributes are
applied, depending on the initial letter of
Parameter Attribute the parameter identifier and on any
associated DEFAULT statement. A parameter
has the INTERNAL attribute by default.
The parameter attribute specifies that a
name in an invoked procedure represents an
argument passed to that procedure.
PICTURE
General rules:
Assumptions:
The RECORD and STREAM attributes specify
The standard defaults for precision are the kind of data transmission to be used
as follows: for the file. STREAM indicates that the
data of the file is considered to be a
(5,0) for DECIMAL FIXED continuous stream of data items, in
(15,0) for BINARY FIXED character form, to be assigned from the
(6) for DECIMAL FLOAT stream to variables, or from expressions
(21) for BINARY FLOAT into the stream. RECORD indicates that the
file consists of a collection of physically
separate records, each of which consists of
one or more data items in any form. Each
record is transmitted as an entity to or
from a variable.
General format:
RECORD I STREAM
General rules:
The PRINT attribute specifies that the data
of the file is ultimately to be printed. 1. A file with the STREAM attribute can
The PAGE and LINE options and format items be specified only in the OPEN, CLOSE,
of the PUT statement and the PAGESIZE GET, PUT, ON, and aSSignment
option of the OPEN statement can be used statements.
only with files having the PRINT attribute.
These options are described in section J, 2. A file with the RECORD attribute can
"Statements" • be specified only in the OPEN, CLOSE,
READ, WRITE, REWRITE, LOCATE, UNLOCK,
General format: DELETE, ON, and assignment statements.
2. The PRINT attribute conflicts with the 4. A file with the RECORD attribute
RECORD attribute. (However RECORD cannot have the PRINT attribute.
files can be associated with the
printer~ see chapter 12, "Record- Assumptions:
Oriented Transmission".)
Default is STREAM. If a file is
3. The PRINT attribute causes the initial implicitly opened by a READ, WRITE,
data byte.within each record to be REWRITE, LOCATE, UNLOCK, or DELETE
reserved for ANS printer control statement, RECORD is assumed.
characters. These control characters
are set by the PAGE, SKIP, or LINE
format items or options.
Assumption:
REDUCIBLE
If no FILE or STRING specification
appears in a PUT statement, the standard
output file SYSPRINT is assumed. See IRREDUCIBLE.
5. string lengths and area s~zes must be 2. Task variables can also have the
specified by decimal integer following attributes:
The ALLOCATE statement causes storage to be Syntax rules 7 and 8 apply only to
allocated for specified controlled or based Option 2:
data.
7. The based variable appearing in the
General format: ALLOCATE statement may be an element
variable, an array, or a major
ALLOCATE option[,optionJ ••• ; structure. When it is a major
structure, only the major structure
where ·option" has one of two forms: name is specified.
element-variable} [,element-variable]
{pseudovariable = element-expression:
,pseudovariable
option 2 (Array Assignment)
array-variable ,array-variable structure-expression (,BY NAMEl}
{pseudovariable } [ ,pseudovariable ] = { array-expression
element-expression
(,BY NAMEl :
In this case, the entry expression 1. Execution of a CHECK statement has the
must be an entry constant, and it must effect of enabling a CHECK condition-
be eqUivalent to both the name by prefix, or of modifying an existing
which the procedure is known in CHECK condition-prefix, for every
external storage and a point through statement that is executed after the
which the procedure may be entered: execution of the CHECK statement.
and the same constant must have
appeared in a FETCH or RELEASE The prefixes thus derived operate in
statement compiled at the same time as the same way as ordinary prefixes. If
the CALL statement. A main procedure the condition is raised, any CHECK on-
may not be dynamically loaded. A unit established is executed. If
fetched procedure may not fetch a there is no on-unit, the standard
further procedure. system action for the CHECK condition
is taken. The situations in which the
CHECK condition is raised are
described in ·CHECK Condition·, in
section H, ·On-Conditions".
Syntax rules:
The CLOSE statement dissociates the named 2. "Level" is a nonzero unsigned decimal
file from the data set with which it was integer constant. If a level number
associated by opening in the current task. is not specified, level 1 is assumed
for all element and array variables.
General format: Level 1 must be specified for all
major structure names. A blank space
CLOSE FILE(file-expr ) must separate a level number from the
[ENVIRONMENT({LEAVEIREREAD})] identifier following it.
[,FILE(file-expr )
[ENVIRONMENT({LEAVEIREREAD})]] ••• ; 3. Attributes specified in DECLARE
statements are separated by blanks.
General rul es : Except for the dimenSion, length, and
precision attribute specifications,
1. The FILE(file-expression) option they may appear in any order. The
specifies which file is to be closed. dimension attribute specification must
It must appear once. Several files immediately follow the array name; the
can be closed by one CLOSE statement. length and preciSion attribute
There must be a FILE option for each specifications must follow one of
one. their associated attributes. A comma
must follow the last attribute
2., A closed file can be reopened. specification for a particular- name
(or the name itself if no attributes
3. Closing an unopened file, or an are specified with it), unless it is
already closed file, has no effect. the last name in the DECLARE
statement, in which case the semicolon
4. The CLOSE statement cannot be used to is used.
close a file in a task different from
the one that opened the file. If a 4. "SYSTEM" specifies that the standard
file is not closed by a CLOSE default attributes are to be applied
statement, i t is automatically closed to the associated identifier;
at the completion of the task in which attributes are not taken from DEFAULT
i t was opened. statements. "SYSTEM" may appear
before, after, or between the other
6. All input/output events associated attributes.
with the file that have a status value
of zero when the file is closed are Factoring of Attributes
set complete, with a status value of
1. Attributes common to several names can
be factored in a declaration to eliminate
1. A CLOSE statement unlocks all records repeated specification of the same
in the file previously locked in the attribute for many identifiers. Factoring
task in which the CLOSE appears. is achieved by enclOSing the names in
parentheses, and following this by the set
8. The ENVIRONMENT attribute with either of attributes which apply. All factored
the REREAD or LEAVE options can be attributes must apply to all of the names.
given. No factored attribute can be overridden for
"simple-specification" is
RANGE(.) [attribute-specification]
DESCRIPTORS [attribute-specification]
"factored-specification" is
({simple-specificationlfactored-specification}
[,(simple~specificationlfactored-specification}] ••• )
(attribute-specification]
"attribute-specification" is
attribute... (VALUE(VaIUe-specificatiOn)]}
{ VALUE (value-specification)
l---------------------------------------------------------------------------------------J
Figure J.2. General formats of the DEFAULT statement
statement Ll is all identifiers in the The base and scale attributes may be
procedure P beginning with the factored, if, when expanded, the above
characters XY, together with all format is used.
identifiers in begin block Q beginning
with the characters XY, except for
those beginning with the characters The size of AREA data, or length of
XYZ. The range and scope of the BIT or CHARACTER data, can be an
DEFAULT statement L2 is all the expression or a decimal integer
identifiers in begin block Q beginning constant, or can be specified as an
with characters XYZ. asterisk.
Example:
3. VALUE (value-specification) may appear
anywhere within an attribute DEFAULT RANGE(A:C)
specification, except before an array VALUE (FIXED DECIMAL(10),
dimension attribute. FLOAT DECIMAL(14),
AREA(2000»;
4. VALUE establishes any default rules DECLARE B FIXED DECIMAL, C FLOAT
for a string length, area size, and DECIMAL,
preCision. The base and scale A AREA;
attributes in the value specification
must be present to identify a These statements are equivalent to:
particular precision specification
with a particular attribute. DECLARE B FIXED DECIMAL(10), C FLOAT
DECIMAL(14), A AREA(2000);
5. A value specification is a list of one
or more of the following in any order; 6. RANGE deSignates the particular
identifiers to which the attributes
a. AREA (size) specified in a DEFAULT statement
apply.
b. BIT (length)
a. The form of RANGE(identifier) is
c. CHARACTER (length) used when the default rules are to
apply to those identifiers which
d. {base-attribute scale-attribute I contain the letters indicated in
scale-attribute base-attribute} "identifier" as their first and
(precision[,scale factor]) subsequent letters. For example:
The DELAY statement causes the execution of 5. The EVENT option allows processing to
a task to be suspended for a specified continue while a record is being
period of time. deleted.
DISPLAY
The DISPLAY statement causes a message to The DO statement heads a do-group and can
be displayed to the machine operator. A also be used to specify repetitive
response may be requested. execution of the statements within the
group.
General format:
General formats:
option 1.
The three format types for the DO
DISPLAY (element-expression); statement are shown in Figure J-3.
option 2. Syntax rules:
DISPLAY (element-expression) 1. In all three types, the DO statement
REPLY (character- is used in conjunction with the END
variablelpseudovariable) statement to delimit a do-group. Only
[EVENT (event-variable)]; Type 1 does not provide for the
repetitive execution of the statements
General rules: within the group.
1. Execution of the DISPLAY statement 2. In Type 3, the variable or
causes the element expression to be pseudovariable must represent a Single
evaluated and, where necessary, element; "variable" may be subscripted
converted to a varying character and/or qualified. (The following
string of implementation-defined pseudovariables may not be used under
maximum length (126 characters ). the optimizing compiler: COMPLETION,
This character string is the message COMPLEX, PRIORITY, STRING.) Real
to be displayed. arithmetic variables are generally
used, but all variable types are
2. In Option 2, the character variable or allowed, provided that the expansions
pseudovariable receives a string that given in the general rules below
is a message to be supplied by the result in valid PL/I programs. Note
operator. The STRING pseudovariable that if ·variable· is a progra~
must not be used. The message cannot control variable, the BY and TO
exceed 126 characters. options cannot be used in
"specification·.
3. In Option 2, if the EVENT option is
not specified, execution of the 3. Each expression in a specification
program is suspended until the must be an element expression.
operator's message is received. In
option 1, execution continues 4. If ·BY expression3· is omdtted from a
uninterrupted. "specification," and if "TO
expression2· is included,
4. If the EVENT (event-variable) option ·expression3· is assumed to be 1.
is given, execution will not wait for
the reply to be completed before 5. If "TO expression2" 1s omitted from a
continuing with subsequent statements. ·specification,· and if ·BY
pseudovariable }
Type 3. DO = specification [,specification] ••• :
{ variable
LABEL: DO variable=
expressionl statement-m
TO expression2 LABELl: IF (expressionS) THEN
BY expression3 GO TO NEXT:
WHILE (expression4) LABEL3: v=expression6;
UNTIL(expressionS); GO TO LABEL2;
statement-l NEXT: statement
In the above expansions, p is a
compil,er-created pOinter: v is a
statement.;.m compiler-created based-variable based
LABELl: END: on p and with the same attributes as
NEXT: statement -variable-. -el," "e2,· and "e3" are
compiler-created variables having the
For a variable that is not a attributes of -expressionl,·
pseudovariable, this is exactly -expression2,- and -expression3,"
equivalent to the following expansion: respectively. Note that the
generation of the control variable is
LABEL: p=ADDR(variable): established once outside the loop,
el=expressionl; immediately before the initial value
e2=expression2: expression (expressionl) is evaluated.
e3=expression3:
v=el: Additional rules for the above
LABEL2: IF (e3>=O)& (v>e2)I expansions follow:
(e3<O)&(v<e2)
THEN GO TO NEXT; a. The above expansions only show the
IF (expression4) THEN: result of one ·specification." If
ELSE GO TO NEXT: the DO statement contains more
statement-l than one "specification," the
statement labeled NEXT is the
first statement in the expansion
for the next "specification." The
statement-m second expansion is analogous to
LABELl: IF (expressionS) THEN the first expansion in every
GO TO NEXT; respect. Note, however, that
LABEL3: v=v+e3: statements 1 through !!! are not
GO TO LABEL 2 ; actually duplicated in the
NEXT: statement program.
If the specification includes the b. If the WHILE clause is omitted,
REPEAT option, the action of the do- the IF statement immediately
group is defined by the following: preceding statement-l in each of
the expansions is omitted.
LABEL: DO variable=
expressionl c. If the UNTIL clause is omitted,
REPEAT expression6 the IF statement immediately
WHILE (expression4) following statement-m in each of
UNTIL(expressionS); the expansions is omitted.
statement-l
d. If -TO expression2- is omitted,
and -BY expression3" is included,
the statement "e2=expression2- and
statement-m the IF statement identified by
LABELl: END: LABEL2 in the first expansion are
NEXT: statement omitted.
For a variable that is not a e. If -BY expression3· is omitted,
pseudovariable, this is exactly and -TO expression2- is included,
equivalent to the following expansion: the statement "e3=expression3" in
a. The number of the statement that 2. At least one "label" must be specified
causes the transfer of control for a FORMAT statement. One of the
labels (or a label variable or a
b. The number of the statement to function reference representing the
which control is transferred value of one of the labels) is the
statement label designator appearing
A flow comment is written after in a remote format item.
control is transferred, but before
execution of the target statement is General rules:
commenced.
1. A GET or PUT statement may include a
2. When a subtask is first attached, its remote format item, R, in the format
FLOW/NOFLOW status is the same as that list of an edit-directed data
of the attaching task at the point specification. That portion of the
where the CALL statement is executed. format list represented by R must be
Thereafter, the status of the subtask supplied by a FORMAT statement
can be altered only by FLOW and NO FLOW identified by the statement label
statements executed within the specified with R.
subtask.
2. The remote format item and the FORMAT
3. The flow comment is written only when statement must be internal to the same
the transfer of control is to a point block.
within the task that contains the FLOW
statement. If control passes to a 3. If a condition prefix is associated
point outside this task, (becaus€ the with a FORMAT statement, i t must be
task terminates), no further flow identical to the condition prefix
comments are written. associated with the GET or PUT
Iterative DO statement, either when the Istatement that follows the matching END
statement list has been executed in full, I statement
or when the statement list is not to be I
executed I
END statement that terminates an IStatement to which the on-unit returns
on-unit, or a single statement (except Icontrol normally
GO TO or CALL) that is an on-unit I
Statement (including SIGNAL) that resultslFirst, or only, statement of the on-unit
in an interrupt for which there is an I
on-unit I
After execution of a "Qnit" following IThe first executable statement following the
a WHEN or OTHERWISE clause, provided that Iselect-group
the unit does not alter the normal flow I
L---------------------------------------------------------------------------------------J
Figure J.4. Transfer and destination statements
Syntax rules:
General format:
2. If a specified nonbased identifier has
no allocated storage at the time the GET option-list:
FREE statement is executed, it is a
no-operation. Following is the format of -option
list-:
Rules 3 through 6 apply only to Option 2.
[FILE (file-expression)
3. If the based variable is not ISTRINGCcharacter-string-expression)]
explicitly qualified by locator [data-specification]
qualification, the locator declared [COPY[ (file-expression)]]
with the based variable will be used (SKIP[(expression)]]
to identify the generation of data
occupying the portion of storage to be General rules:
freed. If no locator has been
declared the statement is in error. 1. If neither the FILE option nor the
STRING option appears, the file option
4. The amount of storage freed depends FILE(SYSIN) is assumed.
upon the attributes of the based
variable, including bounds and/or 2. One data specification must appear
lengths at the time the storage is unless the SKIP option is specified.
freed, if applicable. The user is
responsible for determining that this 3. The options may appear in any order.
amount coincides with the amount
allocated. If the variable has not 4. The -file-expression- of the FILE
been allocated, the results are option represents a file which has
unpredictable. been aSSOCiated, by opening, with the
data set which is to provide the
5. A based variable can be used to free values. It must be a STREAM INPUT
storage only if that storage has been file.
allocated for a based variable having
identical data attributes. The wfile-expression- of the COpy
option represents a file associated
6. The IN option must be specified or with the data set Which is to receive
implied, if the storage to be freed the values. It must be a STREAM
was allocated in an area. The option OUTPUT file.
task being executed in conversational mode after which control passes to the next
under the checkout compiler to be statement.
interrupted and control passed to the
terminal. When the ELSE clause is not specified,
the following occurs:
General format:
If any bit in the string is 1, -unit-
HALT: 1- is executed, and-control passes to
the statement following the IF
General rules: statement. If all bits are 0, -unit-
1- is not executed and control passes
1. The HALT statement is only effective to the next statement.
in a conversational environment. In a
non-conversational environment and Each -unit- may contain statements
under the optimizing compiler, the that specify a transfer of control
HALT statement is a null operation. (e.g., GO TO): hence, the normal
sequence of the IF statement may be
2. The HALT statement remains effective overridden.
until the programmer at the terminal
causes execution to be resumed. An array or structure variable can
appear in the element expression only
as an argument to a function that
returns an element value.
2. IF statements may be nested: that is,
either -unit-, or both, may itself be
The IF statement tests the value of a an IF statement. Since each ELSE
specified expression and controls the flow clause is always associated with the
of execution according to the result of innermost unmatched IF in the same
that test. block or do-group, an ELSE with a null
statement may be required to specify a
General format: desired sequence of control. Under
the optimizing compiler, the maximum
IF element-expression permissible depth of nesting is 49.
THEN unit-1 There is no restriction under the
[ELSE unit-21 checkout compiler.
NOCHECK
LOCATE
The NOCHECK statement suppresses the action
of the CHECK statement for the specified
The LOCATE statement, which applies to names.
BUFFERED OUTPUT files, causes allocation of
a based variable in a buffer; it may also The PL/I checkout compiler implements
cause transmission of a based variable the NOCHECK statement in this sense, but
previously allocated in a buffer. the PL/I optimizing compiler implements
this statement by checking the syntax and
General format: then ignoring it.
1. The options may appear in any order. 1. The optional -name-list- is one or
more names separated by commas; a name
2. The -variable- must be an can be qualified, but cannot be
unsubscripted level 1 based variable. subscripted or locator-qualified.
General format:
NOFLOW
ON condition [SNAP] {SYSTEM; lon-unit}
PROCEDURE
4. The ·options-list" of the OPTIONS
option specifies one or more
The PROCEDURE statement has the following additional implementation-defined
functions: options. These are:
2. It can cause the values in one or more 5. Under the checkout compiler, the ALL
internal storage locations to be option causes all information provided
assigned to an internal receiving by the SNAP and FLOW options to be put
field (represented by a character- into the SYSPRINT stream, together
string variable). with certain other debugging
information. A description of this
3. Under the checkout compiler, it can information is given in chapter 15,
cause program checkout information to -Execution-time Facilities of the
be written onto the SYSPRINT file. Checkout Compiler-. Under the
optimizing compiler, the syntax of the
General format: option is checked, then it is ignored.
The value of the character-string-
PUT [FILE (file-expression)] I expre~sion must be one or more of the
[STRING (character-string-variable)] option characters O,S,F,C,T,n
[data-specification] I concatenated to form a string without
[SNAP] I blanks or punctuation marks, n being
[FLOW [ (n)]] I one through four digits.
9. The options may appear in any order: When a SKIP option is specified On the
at least one must appear. first PUT statement of a file, the
data set is positioned at the start of
General rules: the ~h line on the first page. If ~
is zero or one, it is positioned at
1. If the FILE option is specified, and the start of the first line.
the "file-expression" refers to an
unopened file, the file is opened
implicitly as an OUTPUT file. When printing at a terminal in
conversational mode, no more than
2. If the STRING option is specified, the three lines may be skipped: SKIP(w)
PUT operation begins assigning values with w greater than 3 is equivalent to
to the beginning of the string (that SKIP(3).
is, at the left-most character
position), after appropriate
conversions have been performed. 6. The LINE option causes a new current
Blanks and delimiters are inserted as line to be defined for the data set.
usual. If the string is not long The expression is converted to an
enough to accomodate the data, the integer!!.. The LINE option specifies
ERROR condition is raised. that blank lines are to be inserted so
that the next line will be the wth
3. The PAGE and LINE options can be line of the current page. If at least
specified for PRINT files only. All !! lines have already been written on
of the options take effect before the current page or if ~ exceeds the
transmission of any values defined by limits set by the PAGESIZE option of
the data specification, if given. Of the OPEN statement, the ENDPAGE
the three, only PAGE and LINE may condition is raised. If w is less
appear in the same PUT statement, in than or equal to zero, it-iS assumed
which case, the PAGE option is applied to be 1. If ~ specifies the current
first. line, ENDPAGE is raised except when
the file is posi~ioned on column 1: in
4. The PAGE option causes a new current this case, the effect is as for a
page to be defined within the data' SKIP(O) option.
set. If a data specification is
present, the transmission of values
occurs after the definition of the new If the LINE option is specified in the
page. The page remains current until same statement as a PAGE option, the
the execution of a PUT statement with PAGE option is executed first.
the PAGE option, until a PAGE format
item is encountered, or until the
ENDPAGE condition is raised, resulting When printing at a terminal in
in the definition of a new page. A conversational mode, the LINE option
new current page implies line one. causes three lines to be skipped.
General format:
6. The KEYTO option can be given only if
READ option-list; the file has the SEQUENTIAL and KEYED
attributes. It specifies that the key
The format of the option list is shown of the record being read is to be
in figure J.5. assigned to the "character-string
variable" according to the rules for
General rules: character-string assignment. The
KEYTO option can specify any string
1. The options may appear in any order. pseudovariableother than STRING. It
cannot specify a variable declared
2. The FILE option specifies the file with a numeric picture specification.
from which the record is to be read. The maximum permissible length for the
This option must appear. If the file character string is 256.
specified is not open in the current
task, it is opened. Assignment to the KEYTO variable
always follows assignment to the INTO
3. The INTO(variable) option specifies variable. If an incorrect key
the variable into which the record is specification is detected, the KEY
to be read. If· the variable is an condition is raised. For this
aggregate, it must be in connected implementation, the value assigned is
storage; certain uses of unaligned as follows:
fixed-length bit strings are
disallowed (for details, see "Data a. For REGIONAL(l), the eight
Transmitted" in chapter 12, "Record- character region number, padded or
Oriented Transmission"). truncated on the left to the
declared . 1ength of the character-
string variable. If the
4. The KEY and KEYTO options can be character~string variable is of
specified for KEYED files only. varying length, any leading zeros
in the region number are truncated
5. The KEY option must appear if the file and the string length is set to
has the DIRECT attribute. The the number of significant digits.
"element-expression" is converted to a An all-zero region number is
character string that represents a truncated to a single zero.
key. It is this key that determines
which record will be read. b. For REGIONAL(2} and REGIONAL(3),
the recorded key without the
The KEY option may also appear for a region number, padded or truncated
file having INDEXED or VSAM on the right to the declared
organization and the SEQUENTIAL and length of the character-string
KEYED attributes. In such cases, the variable.
The REWRITE statement can be used only for b. If the last record was read by a
update files. It replaces an existing READ statement with the SET
record in a data set. option, the record will be updated
by whatever assignments were made
General format: in the buffer identified by the
pointer variable in the set
REWRITE FILE (file-expression) option. When the records are
[FROM(variable)] blocked, a REWRITE statement
[KEY (element-expression)J issued for any record in the block
[EVENT (event-variable)]; causes the complete block to be
rewritten even i f no REWRITE
Syntax rules: statements are issued for other
General format:
SIGNAL
STOP;
Syntax rule:
1. When a SIGNAL statement is executed, The UNLOCK statement makes the specified
i t is as if the specified condition locked record available to other tasks for
has actually occurred. sequential operations on the record.
execution is interrupted and control
is transferred to the current on-unit General format:
for the_specified condition. After
the on-unit has been executed, UNLOCK option-list;
standard system action for the
condition is performed. This usually FollOWing is the format of Woption
results in control returning to the list":
statement immediately following the
SIGNAL statement. However, for the FILE (file-expression) KEY(expression)
Abbreviation: %DCL
'assignment statement
The 'DECLARE statement establishes an
identifier as a preprocessor variable or a
The %assignment statement is used to preprocessor procedure name and also serves
evaluate preprocessor expressions and to to activate that identifier.
assign the result to a preprocessor
variable. General format:
General format:
A preprocessor GO TO statement
appearing within a preprocessor
Syntax rule: procedure cannot transfer control to a
point outside of that procedure. In
The Wift represents a preprocessor other words, the label following GO TO
variable, and ·ml," "m2," and "m3" are must be contained within the
preprocessor expressions. procedure.
The ~IF statement can control the flow of 1. Each "ddname" and "member name" pair
the scan according to the value of a identifies the external text to be
preprocessor expression. incorporated into the source program.
This external text must be a member of
General format: a partitioned data set.
3. If ·code" has a value other than those 2. One of the attributes CHARACTER or
listed above, a diagnostic message is FIXED must be specified in the RETURNS
produced and a default value is taken. attribute list to indicate the type of
If the value is less than zero or value retUrned by the function
greater than 16, severity U is procedure. There can be no default.
assumed. otherwise, the next higher
severity is assumed. General rules:
g. the preprocessor RETURN statement Note that the rules for preprocessor
expressions do not permit the value
h. the preprocessor NOTE statement returned by a preprocessor procedure to
contain preprocessor statements.
i. the iPAGE listing control
statement.
1. the INOPRINT listing control The checkout compiler FORMAT option, when
statement specified, may be activated and deactivated
by the iCONTROL statement. Onder the
All of these statements and the do- optimizing compiler, the syntax of the
group must adhere to the syntax and statement is checked, then it is ignored.
general rules given for them in
this section, except that, for 'a' General format:
through 'he, the initial percent
symbols must be omitted. ICONTROLCFORMATINOFORMAT):
print/noprint status that was in I The SPRINT statement causes printing of the
effect when the IINCLUDE status was ,source and insource listings to be resumed
executed. In this case, however, the ,from the following statement.
original status is not restored at the I
end of the included text. , General format:
This section describes structure mapping with another unit, and so on until the
and alignment of records in buffers. The complete structure has been mapped. The
information is included because, under rules for the process are therefore
certain circumstances, it should be borne categorized as:
in mind when a program is being written.
However, the information is not essential Rules for determining the order of
to programmers using stream-oriented pairing
transmission or unaligned data (other than
bit strings): it is intended for those Rules for mapping one pair
using record-oriented transmission
(particularly locate mode) with aligned These rules are described below, and an
structures. example shows an application of the rules
in detail.
Note: To follow these rules, it is
Structure Mapping necessary to appreciate the difference
between logical level and level number.
The item with the greatest level number is
For any structure (major or minor), the not necessarily the item with the deepest
length, alignment requirement, and position logical level. If thE structure
relative to a doubleword boundary will declaration is written with consistent
depend on the lengths, alignment level numbers or suitable indentation (as
requirements, and relative positions of its in the detailed example given after the
members. The process of determining these rules), the logical levels are immediately
requirements for each level in turn and apparent. In any case, the logical level
finally for the complete structure, is of each item in the structure can be
known as structure mapping. determined by applying the following rule
to each item in turn, starting at the
During the structure mapping process, beginning of the structure declaration:
the compiler minimizes the amount of unused
storage (padding) between members of the "The logical level of a given item is
structure. It completes the entire process always one unit deeper than that of the
before the structure is allocated, most immediate of its containing
according (in effect) to the rules structures."
discussed in the following paragraphs. It
is necessary for the user to understand For example:
these rules for such purposes as
determining the record length required for DeL 1 A, 4 B, 5 C, 5 D, 3 E, 8 F, 1 G;
a structure when record-oriented
input/output is used, and for determining 1 2 3 3 2 3 3
the amount of padding or rearrangement
required to ensure correct alignment of a The lower line shows the logical level for
structure for locate-mode input/output (see each item in the declaration.
"Record Alignment", at the end of this
section).
structure mapping is not a physical RULES FOR ORDER OF PAIRING
process. Although during this discussion
such terms as "shifted" and "offset" are
used, these terms are used purely for ease The steps in determining the order of
of discussion, and do not imply actual pairing are as follows:
movement in storage; when the structure is
allocated, the relative locations are 1. Find the minor structure with the
already known as a result of the mapping deepest logical level (which we will
process. call logical level n).
The mapping for a complete structure 2. If the number of minor structures at
reduces to successively combining pairs of logical level n exceeds one, take the
items (elements, or minor structures whose first one of them as it appears in the
individual mappings have already been declaration.
determined). Once a pair has been
combined, it becomes a unit to be paired 3. Using the rules for mapping one pair
p > 15
1-----------------
IFullword binary
I integer
BINARY FLOAT (p) Data may
P < 22 I Short 4 Full begin on
-------------------Ifloating-point word byte 0 or
DECIMAL FLOAT (p) I 4 only
p < 7 I
-------------------------------------
POINTER1 I
IOFFSET1 I
1-------------------------------------1
1FILE I - I
1-------------------------------------------------------
IENTRY I I
1-------------------------------------1
I LABEL I I
a
1-------------------------------------------------------
ITASK I - I 16
1-------------------------------------------------------
IEVENT I I 32
L---------------------------------------------------------------------------------------J
Figure K.l (Part 1 of 2). Summary of alignment requirements for ALIGNED data
H I
~ ,
Step I
Step 2
•
G
Figure K.3. Mapping of minor structure G
F G
Step 0
~~~~~~~~~~~~~~~_P~~~~~~~~~~~~~~_+_
F G
Step 2
F G J
Step 3
E
Figure K.4. Mapping of minor structure E
Step I
P Q R
,.-A---w •
Step 2
,
•
N
Figure K.5. Mapping of minor structure N
T
I
Step I o
Step 2 0
, ",
S
Figure K.6. Mapping of minor structure S
step 3 D
through Double 38 0 5
K
L Word q 0 3 2 qO
I Double I 3 I I
L--------------------_________________________________
C qq 0
-----------------J
D E (I~ngth 24)
Step I
D E (length 24) K
, ,A, , • .. .,.,...,.,.....,
D E (I eng th 24) K L
, ~ , , ~ ~,. ,
Step 3
l0ll 121314151617~1415)()f7IOII 1213141516171°11 121314151bl7io
,
c
Figure K.1. Mapping of minor structure C
N s
Step I 0
~~~~+_~~_+-L~~~~~L4~-L~4_~~~~~-L~~L-~~
N s
Step 2
N S w
Step 3
,
M
Figure K.8. Mapping of minor structure M
step 2 *B Word 4 4 1 0
C Double 44 0 3 0 4
Step 3 B
through Double 48 4 3
C
M Double 28 4 1 0 48
Step 4 B
through Double 16 4 1
M
X Byte 4 0 3 0 16
---------
A
-------------
Double
----------------------------------------------
80 I 4 I 3 I I
_________________ -----------------J
L------------------------~-----------
*First item shifted right
B C (I ength 44)
Step I
B C
Step 2
B C M (length 28)
, " '" ,. Vi ,., •
B C M X
• A .... ~.. ,. \,,'&.
Step 4
101 I 121314ISI6171°1')()f314ISI6171°1')(,6314ISI6171°1'121314IS1& 17 1°
,
A ('e",th 10)
Figure )(.9. Mapping of major structure A
The user must pay attention to record If, however, a structure is defined as:
alignment within the buffer when using
locate mode input/output. The first data 1 SBASED BASED(P) LIKE S;
byte of the first record in a block is
generally aligned in a buffer on a and READ SET(P) statements are used,
doubleword boundary (see figure K.~4); the reference to SBASED.B will, for the first
next record begins at the next available record in the block, be to data aligned at
byte in the buffer. The user must ensure a doubleword plus one byte, and will
that the alignment of this byte matches the probably result in a specification
alignment requirements of the based interrupt.
variable with which the record is to be
associated. The same problem would have arisen had
the file originally been created by using
For blocked records, doubleword the statement:
alignment of the first byte of data in each
record in the block is ensured if the LOCATE SBASED SETCP);
record length (RECSIZE) is a multiple of
eight. For spanned records, the block size Again, for the first record in the
(BLKSIZE) must be a multiple of eight if block, P would be set to address a
this alignment is required. For data read doubleword and references to SBASED.B would
from ASCII data sets, the first byte of the be invalid.
block prefix is doubleword-aligned; to
ensure similar alignment of the first byte In both cases the problem is avoided if
of the first record, the prefix length must the structure is padded in such a way that
be a multiple of eight bytes, less four to B is always correctly aligned:
allow for the four record length bytes.
1 S,
Most of the alignment problems 2 PAD CHAR(3),
described here occur in ALIGNED based or 2 A CHAR(l),
non-based variables. If these variables 2 B FIXED BINARY;
were UNALIGNED, the preservation of the
record alignment in the buffer would be The block format would now be as in figure
considerably easier. K.13; B is always on a word boundary.
padding may be required at the beginning
If a VB-format record is to be and end of a structure to preserve
constructed with logical records defined by alignment.
the structure:
The alignment of different types of
1 S, record within a buffer is shown in figure
2 A CHAR(l), K.14. For all organizations and record
2 B FIXED BINARY(3l,0); types, except FB, V and VB records in
INDEXED data sets with KEYLOC = 0 or
this structure is mapped as in figure K.ll. unspecified, the first data byte in a block
(or hidden buffer) is always on a
r-----------------------,
I IA I B I
doubleword boundary. The position of any
successive records in the buffer depends on
I--J--J--------J--J--J--I the record format.
t t t
W W W For INDEXED data sets with unblocked F-
format records, the LOCATE statement will
W Word boundary use a hidden buffer if the data set key
length is not a multiple of eight and the
Figure K.ll. Format of structure S KEYLOC value is 1, 0 or is not specified
(that is, RKP = 0). The pointer variable
will pOint at this hidden buffer.
If the block was created using a
sequence of WRITE FROM(S) statements, the A special problem arises when using
format of the block would be as in figure locate mode input/output in conjunction
K.l2, and i t can be seen that the alignment with a based variable containing adjustable
in the buffer differs from the alignment of extents, i.e., containing a REFER option.
S. Consider the following structure:
r---------------------------------------------------------------------------
I BL I RL IA I B I RL IA I B I
I--J __ J--J-----J--J--J------~-J--J--J-----J--J--J--------J--J--J------------
t t t t t t
o W D W D W
BL = Block length D Doub~eword boundary
RL =Record length W = Word boundary
r---------------------------------------------------------------------------------------
I BL I RL I PAD I }'a_I B I RL I PAD I AI B I
I--J--J--J-----J--J--J-----J--J--------J--J--J-----J--J--J-----J--J--------J--J--J------
t t t t t t t t
o W D W D W D W
BL = Block length D Doubleword boundary
RL Record length W Word boundary
INDEXED
KEYLOC RKP
F 1 0
I
~data~
0 0 I
r----data~
FB 1 0 I
~data~~data---..
>1 >0 I
----data~~data~
0 0
...-data~ ~data--'"
v 1 4 EKI J
.....-d at a---.
>1 >4 lEKl J
~data~
0 4 I
...-data--...
VB 1 4
I
~data.--.· ~data---...
>1 >4 I
~data~ ~data~
0 4 I
~data~ ~data ....
REGIONAL
F,V,VS,U data I
Notes:
1. EK = embedded key K = key 1 = record length
2. Each I/O operation sets the pointer to the beginning of the data in the records.
3. For CONSECUTIVE data sets with VBS-format records, if the record length is greater
than the block size, the record is moved to a hidden buffer, with the first data
byte on a doubleword boundary.
Figure K.14. Alignment of data in a buffer in locate mode input/output, for
different formats and data set organizations
The tables in this section list the Figures L.2 and L.3 show differences
principal differences between the that do not arise directly from differing
optimizing and checkout compilers. compiler functions. Figure L.2 contains
general syntactic and semantic differences,
Figure L.1 gives the differences that and figure L.3 shows differing quantitative
arise from the differing functions of the restrictions on the use of various
two compilers. There are, for" instance, facilities of the language.
keywords concerned with the checkout and
conversational facilities of the checkout
compiler that are not implemented by the
optimizing compiler, and optimization The section is applicable only to
keywords that are not implemented by the error-free programs processed in batch
checkout compiler. mode.
CHECK prefix specifying I CHECK raised for the CHECK not raised for
label of statement to I label the label
which prefix is I
attached I
LIKE attribute Not allowed NO co~responding rule
specifying a minor
structure that is
contained in a major
structure of which
some other minor
structure is declared
with LIKE attribute
access: the act that encompasses the 5. The state in which a task is said to
references to and retrieval of data. be before it has been terminated.
action specification: in an ON statement, additive attributes: attributes for which
the on-unit or the single keyword SYSTEM, there are nO defaults and which, if
either of which specifies the action to be required, must always be added to the list
taken whenever an interrupt results from ot specified attributes or be implied
raising of the named on-condition. The (i.e., they have to be added to the set of
action specification can also include the attributes, if they are required).
keyword SNAP.
address: a specific storage location at
activate (a block): to initiate the which a data item can be stored.
execution of a block. A procedure block is
activated when it is invoked at any of its adjustable extent: bound (of an array),
entry points; a begin block is activated length (of a string), or size (of an area)
when i t is encountered in normal flow of that may be different for different
control, including a branch. generations of the associated variable.
Adjustable bounds, lengths, and sizes are
activation (of a block): specified as expressions or asterisks (or
by REFER options for based variables),
1. The process of activating a block. which are evaluated separately for each
generation. They cannot be used for static
2. The execution of a block. variables.
Glossary 511
ancestral task: the attaching task or any evaluation yields an array of values.
of the tasks in a direct line from the
given task to, and including, the major
task. array of structures: an ordered collection
of identical structures specified by giving
~: a declared portion of contiguous the dimension attribute to a structure
main storage identified by an area variable name.
and reserved, on allocation, for the
allocation of based variables. aSSignment: the process of giving a value
to a variable.
area variable: a variable with the AREA
attribute; its values may only be areas. asynChronous operation: the overlap of an
input/output operation with the execution
argument: an expression in an argument of statements or the concurrent execution
list as part of a procedure reference. of procedures using multiple flows of
control for different tasks.
argument list: a parenthesized list of one
or more arguments, separated by commas, attachment of a task: the invocation of a
following an entry-name constant, an entry- procedure and the establishment of a
name variable, a generic name, or a built- separate flow of control to execute the
in function name. The list is passed to invoked procedure (and procedures it
the parameters of the entry point. invokes) asynchronously with execution of
the invoking procedure.
arithmetic constant: a fixed-point
constant or a floating-point constant. attention: an occurence, external to a
Although most arithmetic constants can be task, that could cause an interrupt to the
signed, the sign is not part of the task.
constant.
attribute:
arithmetic conversion: the transformation
of a value from one arithmetic 1. A descriptive property associated with
representation to another. a name to describe a characteristic of
items that the name may represent.
arithmetic data: data that has the
characteristics of base, scale, mode, and 2. A descriptive property used to
precision. It includes coded arithmetic describe a characteristic of the
data and pictured numeric character data. result of evaluation of an expression.
closing (of a file): the dissociation of a condition name: a language keyword (or
file from a data set. CONDITION followed by a parenthesized
programmer-defined name) that denotes an
coded arithmetic data: arithmetic data on-condition that might arise within a
that is stored in a form that is task.
acceptable, without conversion, for
arithmetic calculations. condition prefix: a parenthesized list of
one or more language condition names,
comment: a string of zero or more prefixed to a statement. It specifies
characters used for documentation, that is' whether the named on-conditions are to be
preceded by /* and terminated by */ and enabled.
which is a separator.
connected reference: a reference to
commercial character: the following connected storage: it must be apparent,
picture specification characters; prior to execution of the program, that the
Glossary 513
storage is connected. data aggregate: a logical collection of
two or more data items that can be referred
connected storage: main storage of an to either collectively or individually; an
uninterrupted linear sequence of items that array or structure.
can be referred to by a single name.
data character set: all of those
constant: an arithmetic or string data characters whose representation is
item that does not have a name and whose recognized by the computer in use.
value cannot change; an unsubscripted label
prefix or a file name or an entry name. data-directed transmission: the type of
stream-oriented transmission in which data
contained text: all text in a procedure is transmitted as a group, comprising one
(including nested procedures) except it~ or more items separated by commas or
entry names and condition prefixes of th~ blanks, terminated by a semicolon, where
PROCEDURE statement; all text in a begin each item is of the form:
block except labels and condition prefixes
of the BEGIN statement that heads the name = value
block. Internal blocks are contained in
the external procedure. The name can be qualified and/or
subscripted.
contextual declaration: the appearance of
an identifier that has not been explicitly data format item: a specification used in
declared, in a context that allows the edit-directed transmission to describe the
association of specific attributes with the representation of a data item in the
identifier. stream.
control format item: a specification used data item: a Single unit of data; it is
in edit-directed transmission to specify synonymous with element.
positioning of a data item within the
stream or printed page. data list: a parenthesized list of
expressions or repetitive specifications,
control variable: a variable used to separated by commas, used in a stream-
control the iterative execution of a group. oriented input or output specification that
See iterative do-group. represents storage locations to which data
items are to be assigned during input or
controlled parameter: a parameter for values which are to be obtained for output.
which the CONTROLLED attribute is specified
in a declare statement; i t can be data set: a collection of data external to
associated only with arguments that have the program that can be accessed by the
the CONTROLLED attribute. program by reference to a single file name.
Glossary 515
constant is passed as an argument or is not contained in any other procedure.
assigned to a statement-label variable, and
it is passed or assigned along with the factoring: the application of one or more
constant. attributes or of a level number to a
parenthesized list of names.
epilogue: those processes that occur
automatically at the termination of a block field (in the data stream): that portion
or task. of the data stream whose width, in number
of characters, is defined by a single data
evaluation: reduction of an expression to or spacing format item.
a single value, an array of values, or a
structured set of values. field (of a picture specification): any
character-string picture specification or
~: an activity in a program whose that portion (or all) of a numeric
status and completion can be determined character picture specification that
from an associated event variable. describes a fixed-point number.
event variable: a variable with the EVENT ~: a named representation, within a
attribute, which may be associated with an program, of a data set or data sets. A
event; its value indicates whether the file is associated with the data set or
action has been completed and the status of data sets for each opening.
the completion.
file attribute: any of the attributes that
explicit declaration: the appearance of an describe the characteristics of a file.
identifier in a DECLARE statement, as a
label prefix, or in a parameter list. file constant: a name declared for a file
and for which a complete set of file
exponent characters: the follOwing picture attributes exists during the time that the
specification characters: file is open.
1. K and E, which are used in floating- file expression: an expression whose
point picture specifications· to evaluation yields a file name.
indicate the beginning of the exponent
field. file name: a name declared for a file.
2. F, the scaling factor character, file variable: a variable to which file
specified with an integer constant constants can be assigned; it must have
which indicates the number of decimal both the attributes FILE and VARIABLE. No
positions the decimal point is to be file-name attributes, other than FILE, can
moved from its assumed position, to the be specified for a file-name variable.
right (if the constant is positive) or
to the left (if the constant is fixed-point constant: see arithmetic
negative) • constant.
expression: a notation, within a program, floating-point constant: see arithmetic
that represents a value, an array of constant.
values, or a structured set of values; a
constant or a reference appearing alone, or flow of control: sequence of execution.
combinations of constants and/or references
with operators. format item: a specification used in edit-
directed transmission to describe the
extent: representation of a data item in the stream
(data format item) or to specify
1. The range indicated by the bounds of positioning of a data item within the
,an array dimension, the range stream (control format item).
indicated by the length of a string,
or the range indicated by the size of format list: a parenthesized list of
an area. format items required for an edit-directed
data specification.
2. The significant allocations in an
area. fully-qualified name: a qualified name
that is complete, i.e., that includes a11
external name: a name (with the EXTERNAL names in the hierarchical sequence above
attribute) whose scope is not necessarily the structure member to which the name
confined only to one block and its refers, as ·well as the name of the member
contained blocks. itself.
external procedure: a procedure that is function: a function procedure
Glossary 517
a direct-access data set. See source key stream-oriented transmission in which data
and recorded key. in the stream appears as constants
separated by blanks or commas and for which
keyword: an identifier that is part of the formatting is provided automatically.
language and which, when used in the proper
context, has a specific meaning to the locator qualification: in a reference to a
compiler. based variable, either a locator variable
or function reference· connected by an arrow
known: (applied to a name) recognized with to the left of a based variable to specify
its declared meaning; a name is known the generation of the based variable to
throughout its scope. which the reference refers, or the implicit
connection of a locator variable with the
label: a name used to identify a statement based reference.
other than a PROCEDURE or ENTRY statement;
a statement label. locator variable: a variable whose value
identifies the location in main storage of
label constant: an unsubscripted name that a variable or a buffer.
appears prefixed to any statement other
than a PROCEDURE or ENTRY statement. locked record: a record in an EXCLUSIVE
DIRECT UPDATE file that is available to
label list (of a statement): all of the only one task at a time.
label prefixes of a statement.
logical level (of a structure member): the
label list (of a label variable depth indicated by a level number when all
declaration): a parenthesized list of one level numbers are in direct sequence, that
or more statement-label constants is, when the increment between successive
immediately following the keyword LABEL to level numbers is one.
specify the range of values that the
declared variable may have; names in the logical operators: the bit-string
list are separated by commas. When operators, (not), , (and), and I (or).
specified for a label array, it indicates
that each element of the array may assume lower bound: the lower limit of an array
any of the values listed but no other. dimension.
label prefix: a label prefixed to a major structure: a structure whose name is
statement. declared with level number 1.
label variable: a variable declared with major task: the task that has control at
the LABEL attribute and thus able to assume the outset of execution of a program. It
as its value a label constant. exists throughout the execution of the
program.
language character set: a character set
whiah has been defined to represent program minor structure: a structure that is
elements in the source language (in this contained within another structure. The
context, character-string constants and name of a minor structure is declared with
comments are not considered as program a level number greater than one.
elements).
mode (of arithmetic data): a
leading zeros: zeros that have no characteristic of arithmetic data; real or
significance in the value of an arithmetic complex.
integer; all zeros to the left of the first
si~nificant integer digit of a number. multiple declaration: two or more
declarations of the same identifier
level number: an unsigned decimal integer internal to the same block without
constant in a DECLARE or ALLOCATE statement different qualifications, or two or more
that specifies the position of a name in external declarations of the same
the hierarchy of a structure. It precedes identifier with different attributes in the
the name to which it refers and is same program.
separated from that name by the name's
delimiter. Level numbers appear without mUltiprocessinq: the use of a computing
the names in a parameter descriptor of an system with two or more processing-units to
ENTRY attribute specification. execute two or more programs
simultaneously.
level-one variable: a major structure
name; any unsubscripted variable not mUltiprogramming: the use of a computing
contained within a structure. system to execute more than one program
concurrently, using a single processing
list-directed transmission: the type of unit.
Glossary 519
character description of the composition reference.
and characteristics of decimal picture data
and character-string picture data. processor: a program that prepares source
program text (possible preprocessed text)
picture specification character: any of for execution.
the characters that can be used in a
picture specification. See decimal picture program: a set of one or more external
data and character-string picture data. procedures, one of which must have the
OPTIONS (MAIN) option in its PROCEDURE
point of invocation: the pOint in the statement.
invoking block at which the procedure
referenceto the invoked procedure appears. proqram control data: data used in a PLII
program to effect the execution of the
pointer variable: a locator variable with program. Program control data consists of
the POINTER attribute, whose value the following types: entry, task, file,
identifies an absolute location in main label, event, pointer, offset, and area.
storage.
prologue: the processes that occur
precision: the value range of an automatically on block activation.
arithmetic variable expre'ssed as a total
number of digits and, for fixed-point pseudovariable: any of the built-in
variables, the number of those digits function names that can be used to specify
assumed to appear to the right of the a target variable.
decimal or binary point.
qualified name: a hierarchical sequence of
prefix: a label or a parenthesized list of names of structure members, conrtected by
one or more condition names connected by a periods, used to identify a component of a
colon to the beginning of a statement. structure. Any of the names may be
subscripted. See also locator
prefix operator: an operator that precedes qualification.
an operand and applies only to that
operand. The prefix operators are + ranqe (of a default specification): a set
(plus), - (minus), and ~ (not). of identifiers and/or parameter descriptors
to which the attributes in a default
preprocessor: a program that examines the specification of a DEFAULT statement apply.
source program for preprocessor statements
which are then executed, resulting in the record: the logical unit of transmission
alteration of the source program. in a record-oriented input or output
operation.
preprocessor statement: a special
statement appearing in the source program recorded key: a key recorded in a direct-
that specifies how the source program text access volume to identify an associated
is to be altered; i t is executed as it is data record.
encountered by the preprocessor.
recursive procedure: a procedure that may
primary entry point: the entry point be reactivated while still active in the
identified by any of the names in the label same task.
list of the PROCEDURE statement.
reentrant procedure: a procedure that may
priority: a value associated with a task, be reactivated while active in another
that specifies the precedence of the task task.
relative to other tasks.
REFER expression: the expression preceding
problem data: string or arithmetic data the keyword REFER, from which an original
that is processed by a PL/I program. bound, length, or size is taken when a
based variable containing a REFER option is
procedure: a collection of statements, allocated, either by an ALLOCATE or LOCATE
headed by a PROCEDURE statement and ended statement.
by an END statement, that is a part of a
program, that delimits the scope of names, REFER Object: the unsubscripted element
and that is activated by a reference to one variable appearing in a REFER option that
of its entry names. specifies a current bound, length, or size
for a member of a based structure. It must
procedure reference: an entry constant or be a member of the structure, and it must
variable or a built-in function name. The precede the member declared with the REFER
name may be followed by one or more option.
argument lists. It may appear in a CALL
statement or CALL option or as a function reference: the appearance of a name,
scope (of a declaration): the portion of a source program: the program that serves as
program throughout which a particular input to the compiler. The source program
declaration is a source of attributes for a may contain preprocessor statements.
particular name.
source variable: a variable whose value is
scope (of a name): the portion of a to be aSSigned or to take part in some
program throughout which the meaning of a other operation.
particular name does not change.
standard default: the alternative
secondary entry point: an entry point attribute or option assumed when none has
identified by any of the names in the label been specified and there is no applicable
list of an ENTRY statement. DEFAOLT statement.
Glossary 521
by the language to be taken in the absence in which they appear, their attributes, and
of an on-unit for an on-condition. their logical level (but not necessarily
their names or declared level numbers).
statement: a basic element of a PL/I
program that is used to delimit a portion
of the program, to describe names used in subfield (of a picture specification):
the program, or to specify action to be that portion of a picture specification
taken. A statement can consist of a field that appears before or after a V
condition list, a label list, a statement picture specification character.
identifier, and a statement body that is
terminated by a semicolon. subroutine: a procedure that is invoked by
a CALL statement or CALL option. A
statement body: that part of a statement subroutine cannot return a value to the
that follows the statement identifier, if invoking block, but it can alter the value
any, and is terminated by the semicolon: it of variables.
includes the statement options.
SUbscript: an element expression that
statement identifier: the PL/I keyword specifies a position within a dimension of
that indicates the purpose of the an array. A subscript can also be an
statement. asterisk, in which case it specifies the
entire extent of the dimension.
statement-label constant: see label
constant. subscript list: a parenthesized list of
one or more subscripts, one for each
statement-label expression: see label dimension of an array, which together
expression. uniquely identify either a single element
or cross section of the array.
statement-label variable: see label
variable. subtask: a task that is attached by the
given task or any of the tasks in a direct
static storage allocation: the allocation line from the given task to the last
of storage for static variables. attached task.
structurinq: the makeup of a structure, in upper bound: the upper limit of an array
terms of the number of members, the order dimension.
Glossary 523
Index
Index 525
alternative attributes 123 array (continued)
BUFFERED and UNBUFFERED 124 dimension 25
INPUT, OUTPUT, and UPDATE 124 extent 25
SEQUENTIAL, DIRECT and TRANSIENT 124 infix operators with 44
STREAM and RECORD 124 parameter 119
ambiguous references 80 prefix operators with 44
amending a program 237 subscripts 26
American standard code for information array expressions 35
interchange (ASCII) 153 converting 44
ANY built-in function 365 data conversion in 45
application of attributes 81 evaluation of 43
application of standard defaults 81 in IF clauses 44
problem data 82 array of structures 29
program control data 82 cross-sections or 29
area 155,98 array-and-array operations 44
ALLOCATE statement with IN option 100 array-and-element operations 44
assignment 101 array-and-structure operations 45
condition 101,393 array-handling built-in functions 354,355
condition codes 386 ASCII (American standard code for
data 25 information interchange) 153
EMPTY built-in function 101 ASCII data sets 153,177
extent of 99 block prefix fields 153,178
FREE statement with IN option 101 BUFOFF option 153,178
input/output of 102 D-format record 154
locator conversion 99 D-format records 178
offset expressions 100 DB-format record 154
offset variables 99 DB-format-records 118
parameter 120 default rules 154,118
variables 155,99 ASCII option 153,171
AREA attribute 408 ASIN built-in function 365
AREA condition 101 ASSE~mLER option 432
ARGn option 291 assignment
argument 119 and initialization 281
aggregate 356 area 101
area parameter 120 BY NAME 46.
array parameter 119 data conversion 36
conversion of 354 editing by 201
dummy 113 other forms of 208
element parameter 119 statement 12,441,51
entry expressions as 115 associating data sets with files 128
entry parameter 119 asterisk (*) notation
file parameter 119 ALLOCATE statement 90
label parameter 119 array cross-sections 21
locator parameter 120 controlled parameters 118
null 356 CONTROLLED variables 90
preprocessor functions 244 simple parameters 11.8
string parameter 120 asynchronous operation 158,251
structure parameter 119 ATAN built-in function 365
arithmetic ATAND bUiit-in function 365
built-in functions 353,355 ATANB built-in function 365
conversion 36 ATTENTION
operation 282 condition 393
operators 10 condition code 386
overflow 17 attribute 405
arithmetic built-in function additive 123,125
arithmetic built-in functions ALIGNED 31,405
arithmetic data alternative 123
base 16 AREA 408
description 15 AUTOMATIC 408
mode 16 BACKWARDS 125,410
precision 16 BASED 408
scale 16 BINARY 410
arithmetic operations 353 BIT 410
general discussion 38 BUFFERED 124,411
results of 38 BUILTIN 411
array 25 CHARACTER 410
bounds 25 COMPLEX 19,412
cross-sections 27 CONDITION 412
526
attribute (continued) BASED attribute 408
CONNECTED 412 based storage 91
CONTROLLED 408 ADDR built-in function 93
DECIMAL 410 ALLOCATE statement 97
declarations 279 area assignment 101
default 81 areas 98
DEFINED 30,413 based variables 91
dimension 411 based variables and input/output 93
DIRECT 417 FREE statement 97
ENTRY 106,114,418 input/output of areas 102
ENVIRONMENT 125,148,162,199,421 list processing 96
EVENT 421 locator qualification 91
EXCLUSIVE 125,423 multiple generations of based
EXTERNAL 423,78 variables 91
file 123,423 multiple locator qualification 102
FIXED 424 NULL built-in function 98
FLOAT 424 pOinter variables 92
GENERIC 425 self-defining data (REFER option) 95
INITIAL 32,426 types of list 98
INPUT 428 based variables 91,93
INTERNAL 423,78 ALLOCATE statement for 97
IRREDUCIBLE 428 and input/output 93
iSUB defining 415 FREE statement for 97
KEYED 125,429 multiple generations of 97
LABEL 429 processing mode 93
length 410 based variables and input/output
LIKE 30,430 LOCATE statement 94
merging of 127 READ with SET statement 94
of returned values 109 batch processing 227
OFFSET 431 begin block 63
OPTIONS 432 as on-unit 63
OUTPUT 428 definition 13
parameter 117,434 termination of 67
parameter descriptor lists 418 BEGIN statement 443,53
PICTURE 19,22,434 BINARY attribute 410
POINTER 431 BINARY built-in function 365
POSITION 30,413 binary digit (bit) 9
prec:1.s:1.on 435 binary fixed-point data 17
PRINT 125,436 default precision 17
processes in application of 81 maximum length 17
REAL 412 binary floating-point data 18
RECORD 124,436 default precision 19
REDUCIBLE 428 extended form 19
RETURNS 110,431 long form 19
SEQUENTIAL 417 maximum size 19
simple defining 414 short form 19
size 408 bit (binary digit) 9
specifications 83 BIT attribute 410
specifying 15 BIT built-in function 214,366
STATIC 408 bit comparisons 39
STREAM 124,436 bit to arithmetic conversion 331
string overlay defining 416 bit to character conversion 346
targets in aSSignment 43 bit to numeric character conversion 344
TASK 437 bit-string
TRANSIENT 202,417 data 22
UNALIGNED 31,405 handling 213
UNBUFFERED 124,411 operations 38
UPDATE 428 operators 10
VARIABLE 438 unaligned 155
VARYING 21,410 BKWD option 170
AUTOMATIC attribute 408 BKWK option 162
automatic storage 87,88 blanks 10
BLKSIZE option 150,166
block
B insertion character 319 activation of 65
B-format item 326 begin 63
BACKWARDS attribute 125,410 definition 13
base of arithmetic data 16 external 64
Index 527
block (continued) built-in function (continued)
general discussion 63 EXP 370
internal 64 FIXED 370
nested 64 FLOAT 370
prefix fields 153,118 FLOOR 370
procedure 63 HBOUND 370
termination of 61 HIGH 215,370
BOOL built-in function 215,366 I MAG 370
in bit-string operations 39 INDEX 214,370
Boolean algebra 39 input/output 354
bounds LBOUND 371
·controlled parameter 118 LENGTH 215,371
simple parameter 118 LINENO 371
bounds of array dimension 25 LOG 371
buffer allocation 152,161 LOG10 371
BUFFERS option 152,161 LOG2 371
DCB subparameter 152 LOW 215,372
BUFFERED attribute 124,411 mathematical 353,355
BUFFERS option 152,161 MAX 372
BUFND option 162,110 MIN 372
BUFNI option 162,110 miscellaneous 354
BUFOFF option 153,118 MOD 372
BUFSP option 162,110 MULTIPLY 312
built-in multitasking 354
functions 111 NULL 373,98
subroutines 112 null arguments 356
built-in function OFFpET 373
ABS 364 ONCHAR 373
accuracy of mathematical functions 355 ONCODE 373
ACOS 364 ONFILE 373
ADD 364 ONKEY 373
ADDR 364,93 ONLOC 374
aggregate arguments 356 ONSOURCE 373
ALL 364 PARMSET 374
ALLOCATION 364,91 PLIRETV 375
ANY 365 POINTER 375
arithmetic 353 POLY 375
array-handling 354,355 PRECISION 375
ASIN 365 preprocessor 354
ATAN 365 PRIORITY 375
ATAND 365 PROD 376
ATANH 365 REAL 376
BINARY 365 REPEAT 215,376
B:::T 214,366 ROUND 376
BOOL 215,366 SAMEKEY 376
CEIL 366 SIGN 377
CHAR 214,366 SIN 377
classification of 353 SIND 377
COMPILETIME 336 SINH 377
COMPLETION 257,366,400 SQRT 377
COMPLEX 367 STATUS 257,377
condition-handling 354 STORAGE 377
CONJG 367 storage control 354
conversion of arguments 354 string 214,215,378
COS 367 string-handling 353,355
COSD 367 SUBSTR 214,378
COSH 367 SUM 379
COUNT 367 TAN 379
COUNTER 368 TAND 379
CURRENTSTORAGE 368 TANH 379
DATAFIELD 368 TIME 379
DATE 369 TRANSLATE 215,379
DECI~..AL 369 TRUNC 380
DIM 369 UNSPEC 215,380
DIVIDE 369 used in data conversion 37
EMPTY 101,369 VERIFY 215,381
ERF 369
ERFC 369 BUILTIN attribute 411
528
BY NAME option 46 characteristics, data 15
BY option 56 characters
byte 31 special 9
CHECK condition 221,393
CHECK condition codes 386
C-format item 327 CHECK condition prefix 394
CALL option 32 CHECK statement 228,445,61
CALL statement 253,444,59 checkout compiler, facilities of 6
EVENT option 253 classes of statements 49
PRIORITY option 254 descriptive statements 49
TASK option 253 DISPLAY statement 51
case selection procedure blocks 63
(see select-group) classification
CEIL built-in function 366 key (GENKEY) 114
CEIL values of built-in functions 353
table of 333 of conditions 392
chained list 97 of statements 49
channel programs (NCP) classification of built-in functions 353
number of 115 arithmetic built-in functions 353
CHAR built-in function 214,366 array-handling built-in functions 354
character condition-handling built-in
• (period) 211 functions 354
+ picture 322 input/output built-in functions 354
* zero suppression 318 mathematical built-in functions 353
/ insertion 319 miscellaneous built-in functions 354
, (comma) 211 multitasking built-in functions 354
, insertion 318 preprocessor built-in functions 354
alphabetic 9 storage control built-in functions 354
alphameric 9 string-handling built-in functions 353
B (insertion) 211 classification of conditions 392
B insertion 319 AREA condition 393
comparisons 39 ATTENTION condition 393
CR picture 322 CHECK condition 393
DB picture 322 COMPLETION built-in func~ion 400
E picture 324 CONDITION condition 396
F picture 324 CONVERSION condition 396
-I picture 322 ENDFILE condition 396
insertion 318 ENDPAGE condition 391
K picture 324 ERROR condition 397
picture 211,322 FINISH condition 398
picture specification 315 FIXEDOVERFLOW condition 398
R picture 322 KEY condition 398
S picture 322 NAME condition 399
special 10 OVERFLOW condition 400
T picture 322 PENDING condition 400
Z zero suppression 318 RECORD condition 400
zero suppression 311 SIZE condition 401
CHARACTER attribute 410 STRINGRANGE condition 401
character sets 301 STRINGSIZE condition 402
introduction 9 SUBSCRIPTRANGE condition 402
use of 10 TRANSMIT condition 402
with EBCDIC and card-punch codes 307 UNDEFINEDFILE condition 403
48-character set 308 UNDERFLOW condition 404
60-character set 307 ZERODIVIDE condition 404
character specifications clause
numeric 209 "ELSE 481
character strings "THEN 481
and comments 241 ELSE 461
PICTURE attribute 22 OTHERWISE 414
character to arithmetic conversion 331 THEN 461
character to bit conversion 348 WHEN 414
character to numeric character CLOSE statement 130,446
conversion 343 clOSing file 126
character-string data 21 in dynamically-loaded procedure 10
picture characters for 315 clOSing nested blocks and groups 64
repetition factors 21 closure of blocks 61
character-string picture COBOL interface 297
specifications 212 COBOL option 291
Index 529
COBOL routine comparison (continued)
passing arguments to 290 operators 10
termination of 296 program control data 39
code tables for 353
AREA condition 386 compile-time operations 6
ATTENTION condition 386 compiler
card punch 307 differences 505
CHECK condition 386 facilities of 6
condition 383 COMPILETIME built-in function 366
condition built-in functions 223 COMPLETION
CONDITION condition 386 built-in function 251,366,400
CONVERSION condition 386 pseudovariable 361
EBCDIC 307 complex arithmetic data 16,19
ENDFILE condition 384 COMPLEX attribute 19,412
END PAGE condition 385 COMPLEX built-in function 367
ERROR condition 384 COMPLEX pseudovariable 367
FINISH condition 384 complex to real conversion 331
FIXEDOVERFLOW condition 385 compound statement 12
information interchange 122 computational statement type 51
KEY condition 384 concatenation operations 40
NAME condition 384 concatenation symbol (II) 40
OVERFLOW condition 385 concepts of PL/I 1
PENDING condition 385 blanks 10
RECORD condition 384 identifiers 10
return 299 string data 21
SIZE condition 385 condition
STRINGRANGE" condition 386 AREA 393
STRINGSIZE condition 385 ATTENTION 393
SUBSCRIPTRANGE condition 386 built-in functions 223
TRANSMIT condition 384 CHECK 221,393
UNDEFINEDFILE condition 384 classification of 392
UNDERFLOW condition 385 codes (ON-codes) 383
ZERODIVIDE condition 385 condition 221,396
coding format 9 condition code 386
coding source programs for optimizing CONVERSION 396
compiler disabling 12
aliased variable 276 ENDFILE 396
common expression elimination 276 END PAGE 391
other optimization features 278 ERROR 202,391
redundant expression elimination 278 FINISH 398
transfer of invariant expressions 277 FIXEDOVERFLOW 398
collections, data 4 KEY 398
COLUMN format item 327 list of 392
comments 11,241 NAME 399
commercial nat" sign (w) 9 OVERFLOW 400
common errors and pitfalls 278 PENDING 203,400
arithmetic and logical operations 282 prefix 12.,217
assignments and initialization 281 RECORD 202,400
data aggregates 285 SIZE 17,222,401
declarations and attributes 219 STRINGRANGE 222,401
do-groups 284 STRINGSIZE 402
functions and pseudovariables 285 SUBSCRIPTRANGE 222,402
input/output 286 TRANSMIT 202,402
on-conditions and on-units 285 UNDEFINEDFILE 403
operating system and job control 218 UNDERFLOW 404
program control 279 ZERODIVIDE 404
source program and general syntax 218 CONDITION attribute 412
strings 285 condition codes (ON-codes) 383
common expression AREA condition codes 386
elimination 276 ATTENTION condition code 386
interrupt handling 274 CHECK condition codes 386
common storage 293 CONDITION condition code 386
communication, inter language 289 CONVERSION condition codes 386
comparison 39 ENDFILE condition code 384
bit 39 ENDPAGE condition code 385
character 39 ERROR condition code 384
conversion of operands in 39 FINISH condition codes 384
operations 39 FIXEDOVERFLOW condition code 385
530
condition codes (ON-codes) (continued) conversion (continued)
KEY condition codes 384 of program control data 37
NAME condition codes 384 rules 33!>
OVERFLOW condition code 385 type 36
PENDING condition code 385 CONVERSION condition 396,41
RECORD condition codes 384 conversion of arguments 354
SIZE condition code 385 array-handling built-in functions 355
STRINGRANGE condition code 386 mathematical built-in functions 355
STRINGSIZE condition code 385 string-handling built-in functions 355
SUBSCRIPTRANGE condition code 386 conversion of data
TRANSMIT condition codes 384 by built-in function 37
UNDEFINEDFILE condition codes 384 in arithmetic operations 38
UNDERFLOW condition code 385 in assignments 36
ZERODIVIDE condition code 385 in comparison operations 39
CONDITION condition 221,396 in operational expressions 36
condition-handling built-in functions 354 coordination and synchronization of
CONJG built-in function 367 tasks 255
CONNECTED attribute 412 DELAY statement 257
connected storage 117 sharing files between tasks 256
CONSECUTIVE data sets 152,168 testing and setting event variables 256
CONSECUTIVE option 162 WAIT statement 256
consecutive organization 178 coordination of tasks
sequential update 179 sharing data between tasks 255
constant COpy option 135
definition 15 COS built-in function 367
file 122 COSO built-in function 361
contained in, definition 75 COSH built-in function 361
contextual declaration 76 COUNT built-in function 367
control COUNTER built-in function 368
format items 325 CR picture character 322
printer/punch 112 creating data set 183,189,190
program 279 creation of tasks 253
storage 81 call statement 253
control area 122 priority of tasks 254
control data, program 23 credit, debit, and overpunched signs 322
control format CR picture character 322
control interval 122 DB picture character 322
control statement I picture character 322
listing 249,483 R picture character 322
type 54 T picture character 322
control variable 55 cross sections
CONTROLLED arrays 27
data 10 arrays of structures 29
parameter 117 CTLASA option 112
storage 88 CTL360 option 172
structures 91 currency symbol ($) 9,319
CONTROLLED attribute 408 current status list 232
controlled parameter PUT ALL statement 236
bounds, lengths, and sizes 118 PUT FLOW statement 235
controlled storage 88 PUT SNAP statement 235
ALLOCATE statement 89 PUT variables 232
ALLOCATION built-in function 91 CURRENTSTORAGE built-in function 368
controlled structures 91
FREE statement 89
multiple generations 90 D option 162
controlled variables O-format record 154,178
ALLOCATE statement for 89 data
FREE statement for 89 aggregates 155,285
multiple generations of 90 binary fixed-point 17
conversational processing 227 binary floating-point 18
conversion conversion 271
arithmetic 36 deCimal fixed-point 16
condition 396 description 3
condition codes 386 elements 15
data 271,35 format items 325
in concatenation operations 40 interchange (COBOL) 173
locator 99 lists 136
of arguments 354 mapping 290,487
Index 531
data (continued) data-directed transmission 133
organization 25 DATAFIELD built-in function 368
problem 290,82 DATE built-in function 369
program control 290,82 DB option 162
set organization 152,168 DB picture character 322
sets 121 DB-format. record 154,178
specifications 136 DCB sUbparameter 152,176
string 21 DECIMAL attribute 410
transmission statements 134,155 DECIMAL built-in function 369
transmitted 155 decimal digit 9
types 3,15,290 decimal digit specifier 317
data conversion 271,35 decimal fixed-point data 16
and expression evaluation 335 default precision 17
exceptional conditions 47 maximum length 17
expressions and 35 deCimal floating-point data 18
in array expres~ions 45 default precision 18
in assignments 36 maximum length 18
in operational expressions 36 decimal-point specifier 317
source to target rules 335 declaration
data lists 136 attributes 279,49
repetitive specification 137 contextual 76
transmission of data-list elements 138 examples 77
data management optimization 174 explicit 75
ADDBUFF option 174 implicit 77
INDEXAREA option 174 record files 205
NOWRITE option 174 DECLARE statement 446,49
data mapping 290,487 default
record alignment 502 assumptions 3
structure mapping 487 attributes 81
data movement statement type 51 record format 151,167
DATA option 140 restoring standard 84
data set 121 rules 154,178
ASCII 153,177 specification, factored 85
CONSECUTIVE 152 statement 83
creating 183,189,190 default attributes 81
information interchange codes 122 application of standard defaults 81
organization 152,168 control of by programmer 49
teleprocessing 171 processes in application of
data set organization attributes 81
CONSECUTIVE 152,168 default precision
INDEXED 168 b~nary fixed-point data 17
REGIONAL 168 binary floating-point data 19
VSAM 168,192 decimal fixed-point data 17
data specification 136 decimal floating-point data 18
data lists 136 default statement 447,49,83
data-directed 140 attribute specifications 83
edit-directed 143 DESCRIPTORS option 83
list-directed 138 factored default specification 85
data transmission statements 134,155 programmer-defined defaults 85
DELETE statement 156 restoring standard defaults 84
LOCATE statement 156 restrictions 85
READ statement 156 scope of 84
REWRITE statement 156 DEFINED attribute 30,413
UNLOCK statement 156 defining
WRITE statement 156 iSUB 415
data transmitted 155 simple 414
area variables 155 string overlay 416
data aggregates 155 DELAY statement 257,450
unaligned bit strings 155 DELETE statement 156,450
varying-length strings 155 descendant on-units
data-directed data specification 140 descriptive statements 49
data-directed data in stream 140 descriptor lists, parameter 114
data-directed data specification for DESCRIPTORS option 83
input 141 device-associated files 176
data-directed data specification for diagnostic statements 61
output 142 differences, compiler
example 143 digit
length of output fields 143 binary (bit) 9
532
digit (continued) END statement 101,454,53,59
decimal 9 as procedure delimiter 52
digit specifier 317 with nested blocks and groups 64
DIM built-in function 369 ENDFILE
dimension attribute 25,417 condition 396
direct access 183,187,190,191 condition code 384
DIRECT attribute 417 END PAGE
disabling conditions 12 condition 391
DISPLAY statement 451,51 condition code 385
DIVIDE built-in function 369 entry attribute 106,114,418
Do loops 451 entry expressions as arguments 115
DO statement 451,55 parameter descriptor lists 114
do-group 284 entry data 24
definition 13 entry expressions as arguments 11S
preprocessor 247 entry parameter 119
doubleword 31 entry pOints
dummy arguments 113 fUnctions 106
dummy records 183,189,185,190 primary 66
dynamic 69 secondary 66
allocation of storage 70 subroutine 106
loading of external procedure 69 ENTRY statement 455,52
dynamically descendant on-units 219 environment
establishing FORTRAN 294
establishing PL/I 294
E picture character 324 interlanguage 294
E-format item 328 ENVIRONMENT attribute 125,199,421
EDIT option 143 for RECORD files 162,114
edit-directed data specification 143 ADDBUFF option 114
format lists 144 ASCII option 177
edit-directed format items 325 BKWD option 110
alphabetic list 326 BLKSIZE option 166
control format items 325 block prefix fields 118
data format items 325 buffer allocation 167
remote format item 326 BUFFERS option 161
table of CEIL values 333 BUFND option 170
edit-directed transmission 134 BUFRI option 110
editing by assignment 207 BUFOFF option 118
altering length of string data 207 BUFSP option 110
picture specification 209 COBOL option 173
editing characters CONSECUTIVE option 168
numeric picture specification 20 CTLASA option 112
element CTL360 option 112
data 15 D-format record 118
expression 35 data interchange (COBOL) 173
parameter 119 data management optimization 114
elimination data set organization 168
common expression 276 DB format record 118
redundant expression 276,218 device-associated files 116
ELSE clause 461 GENKEYoption 114
embedded keys 180 in-line code optimization
EMPTY built-in function 101,369 (TOTAL) 114
enabled conditions INDEXAREA option 174
CHECK condition 221 INDEXED option 168
condition built-in functions 223 key classification (GENKEY) 114
condition codes 223 key length option (KEYLENGTB) 116
CONDITION condition 221 key location option (KEYLOC) 116
condition prefixes 217 KEYLENGTB option 116
dynamically descendant on-units 219 KEYLOC option 116
null on-unit 219 LEAVE option 111
ON statement 218 magnetic tape handling options 171
on-units 219 NCP option 175
REVERT statement 221 NOwRITE option 174
scope of condition prefix 218 number of channel programs
scope of ON statement 219 (NCP) 115
SIGNAL statement 221 optimization options 170
SIZE condition 222 PASSWORD option 169
STRINGRANGE condition 222 printer/punch control 172
SUBSCRIPTRANGE condition 222 record format options 162
Index 533
ENVIRONMENT attribute (continued) expression (continued)
for RECORD files (continued) notation 118
RECSIZE option 165 offset 100
REGlbNAL option 168 operational 35
REREAD option 111 operations 37
REUSE option 110 pOinter 92
SCALARVARYING option 115 preprocessor 242
SIS option 169 simplification 216
SKIP option 169 structure 35
teleprocessing 111 expression and data conversion
TOTAL option 170,114 ambiguous references 80
TP(M) option 111 classes of statements 49
TP(R) option 171 default attributes 81
track overflow (TRKOFL) 175 default statement 83
TRKOFL option 115 EXTERNAL attribute 78
VSAM option 168 INTERNAL attribute 18
for STREAM files 148 multiple declarations 80
ASCII data sets 153 prologues and epilogues 12
block prefix fields 153 expressions and data conversion 35
buffer allocation option 152 extended floating-point form 19
BUFFERS option 152 extent
BOFOFF option 153 of area 99
CONSECUTIVE option 152 of array dimension 25
D-format record 154 EXTERNAL attribute 423,18
data set organization options 152 external blocks 64
DB-format record 154 external names
LEAVE option 153 format restrictions 10
magnetic tape handling options 153 truncation of by compiler 10
record format options 149 external procedure
REREAD option 153 definition (>4
epilogue 13 dynamic loading 69
ERF built-in function 369 external text
ERFC built-in function 369 inclusion of 241
error
condition code 384
conditions 12 F option 162
handling 202 F picture character 324
ERROR condition 202,391 F-format item 329
error condition code 384 facilities
established action interlanguage 289
establishing FORTRAN environment 294 traCing 228
establishing PL/I environment 294 factor, scaling
EVENT attribute 421 factored default specification 85
event data 24 FB option 162
EVENT option 158 FBS option 162
exception control statements 59 FETCH statement 456,53,69
exceptional conditions fetched procedures
during data conversion 41 file
EXCLUSIVE attribute 125,423 additive attributes 125
execution-time facilities 6 alternative attributes 123
EXIT statement 107,456,59 associating data sets with 128
exit-points of subroutine 106 attribute 123
EXP built-in function 310 closing 126
explicit declaration 15 constant 122
scope of 76 data 2~
exponent specifiers 324 expression 123
E picture character 324 in dynamically loaded procedure 10
K picture character 324 opening 126
expression option 156
and data conversion 35 paramefer 119,219
array 35 PRINT 141
as subscript 21 standard 130
common 213 SYSIN 130
element 35 SYSPRINT 130,148
elimination 216,218 variable 123,219
evaluation 335 FILE attribute 423
file 123 FILE option 135,156
general discussion 4
534
FINISH functions (continued)
condition 398 mathematical built-in 353,355
condition codes 384 miscellaneous built-in 354
FIXED attribute 424 multitasking built-in 354
fixed binary data 17 preprocessor built-in 354
FIXED built-in function 370 RETURN statement 109
fixed decimal data 16 storage control built-in 354
fixed-length records 149,164 string built-in 214
FIXEDOVERFLOW string-handling built-in 353,355
condition 398,47
condition code 385
FLOAT attribute 424 general syntax 278
float binary data 18 generiC
FLOAT built-in function 370 entry names 110
float decimal data 18 key 174
FLOOR built-in fUnction 370 references 110
flow of control, modifying statements 54 selection 110
FLOW option 468 GENERIC attribute 425
FLOW statement 230,235,457,61 GENKEYoption 174
format GET statement 459
coding 9 STRING option in 208
list-directed input 139 global optimization 276
list-directed output 139 GO TO statement 109,296,460,54
lists 144 groups 13
format item
alphabetic list of 326
COLUMN 327 halfword 31
control 325 HALT statement 461,59
data 325 handling
edit-directed 325 bit-string 213
LINE 330 error 202
PAGE 330 interrupt 294
remote 326 string 273
SKIP 331 handling options
FORMAT statement 457 magnetic tape 153,171
FORTRAN HBOUND built-in function 370
environment 294 HIGH built-in function 215,370
interface 297
library functions 112
FORTRAN option 291 I picture character 322
FORTRAN routine I/O
passing arguments to 290 general discussion 5
termination of 296 identifiers 10
FREE statement 458,53 definition 10
£o~ based variables 97 format restrictions 10
for controlled variables 89 keywords 10
with IN option 101 IF statement 461
freeing as flow mOdifier 54
implicit 90 comparison operation 40
main storage 69 IGNORE option 151
FROM option 157 IMAG
FS option 162 built-in function 370
function reference operands pseudovariable 370
definition 42 imaginary data 19
functions 108 immediate mode 227
and pseudovariables 285 implicit
and subroutines 105 declaration 77
arithmetic built-in 353,355 freeing 90
array-handling built-in 354,355 opening 121
as expression 42 IN option
as target of assignment 42 ALLOCATE statement with 100
attributes of returned values 109 FREE statement with 101
built-in 111 in-line code optimization (TOTAL) 174
condition-handling built-in 354 in-line operatiOns 271
exit-points of 106 data conversion 271
FORTRAN library 112 string handling 273
GO TO statement 109 inclusion of external text 247
input/output built-in 354 INDEX built-in function 214,246,370
Index 535
INDEXAREA option 174 intermediate result in arithmetic
INDEXED data sets 168 operations 38
INDEXED option 162 intermediate storage of results 43
indexed organization 179 internal
creating data set 183 blocks 64
direct access 183 procedure 64
dummy records 183 INTERNAL attribute 423,78,80
keys 119 internal to, definition 75
sequential access 183 interrupt
infix operators facilities 1
definition 38 handling 294
with arrays 44 multiple 391
with structures 46 interrupt handling 294
information interchange codes 122 by condition prefix 12
INITIAL attribute 32,426 for programs with common expression
initial procedure 67 elimination 274
initialization INTO option 157
assignments and 281 invariant expressions 274
of static variable 87 invocation 291,293
input of preprocessor procedures 243
data-directed 141 of procedure 66
general discussion 5 invoking block 66
list-directed 139 IRREDUCIBLE attribute 428
operation 208 iSOB defining 415
INPUT attribute 124,428 item
input/output 286 A-format 326
based variables and 93 C-format 327
of areas 102 COLUMN format 327
operations 170 data format 325
statement type 50 E-format 328
input/output built-in functions 354 edit-directed format 325
insertion characters 211,318 F-format 329
• insertion character 211 LINE format 330
/ insertion character 211,319 P-format 330
, insertion character 211,318 PAGE format 330
B insertion character 211,319 R-format 331
numeric picture specification 20 remote format 326
insource listing 239 SKIP format 331
integral boundary X-format 331
definition 31 iteration factors
INTER option 291 in initialization 33
interchange (COBOL) iterative do-group 55
data 113
interchange codes 122
interface job control 278
COBOL 297 joining strings(see concatenation)
FORTRAN 297
interlanguage environment 294
establishing FORTRAN environment 294 K picture character 324
establishing PL/I environment 294 key 179,184
GO TO statement 296 classification (GENKEY) 174
interrupt handling 294 condition 398
multitasking 297 condition codes 384
termination of FORTRAN and COBOL embedded 180
routines 296 generic 174
interlanguage facilities 289 length option (KEYLENGTH) 116
COBOL interface 297 location option (KEYLOC) 176
data mapping 290 option 158
data types 290 recorded 179,185
FORTRAN interface 297 source 119,185,188
interlanguage environment 294 key classification 174
invocation 291,293 key classification (GENKEY)
passing arguments to COBOL or FORTRAN generic key 114
routine 290 GENKEY option 114
passing ~rguments to PL/I procedure 292 KEY option 158
problem data 290 KEYED attribute 125,429
program control dat~ 290 KEYFROM option 158
using common storage 293 KEYLENGTH option 162
536
KEYLOC option 162 locator (cont~nued)
KEYTO option 158 parameter 120
keyword qual~fication 91
and keyword abbreviation 309 locator data 24
general definition 10 conversion of 37
statement 12 locator qualif~cation 91
keyword arguments 243 levels of 102
multiple 102
locked record 125
label LOG built-in function 311
data 23 logical operation 282
parameter 119 logical operators 39
prefix 12 LOG10 built-in function 311
LABEL attribute 429 LOG2 built-in function 311
language characteristics long floating-point form 19
general discussion 3 loop, do 55
LBOUND built-in function 311 LOW built-in function 215,312
LEAVE option 153,171
LEAVE statement 462,58
length machine independence of PL/I 3
built-in fUnction 215,311 magnetic tape handling options
of data-directed output fields 143 LEAVE 153,111
parameter bounds, 117 REREAD 153,171
length attribute 410 MAIN option 13
LENGTH built-in function 215,311 main procedure
levels of locator qualification 102 identifying 13
library functions passing argument to 120
FORTRPu~ 112 mapping
LIKE attribute 30,430 data 290,487
LINE rules 488
format item 330 structure 487,96
option 136 mathematical built-in functions 353,355
LINENO built-in function 371 accuracy of 355
LINESIZE option 464 MAX built-in function 372
list function 372
chained 91 maximum size of numeric picture 20
current status 232 member names of external structures
data 136 scope of 80
format 144 merging of attributes 127
of conditions 392 message control program 199
parameter descriptor 114 MIN built-in function 312
processing 96 miscellaneous built-in functions 354
threaded 97 MOD built-in function 312
types of 98 mode 337
LIST option 138 conversion 331
list processing 96 immediate 221
chained list 97 locate 161
threaded list 97 move 159
list-directed 139 of arithmet~c data 16
data in stream 139 processing 93
data specification 138 move mode 159
input format 139 multiple
output format 139 ambiguous references 80
transmission 133 assignment statements 52
listing declarations 80
control statements 249,483 interrupts 391
insource 239 labels 12
source 239 locator qualification 102
listing control statements 249,60 multiple closure of blocks 65
ICONTROL 483 multiple generations
INOPRINT 484 of based variables 91
I PAGE 484 of controlled variables 90
IPRINT 484 MULTIPLY built-in function 372
ISKIP 485 multitasking 291
locate mode 161 built-in functions 354
LOCATE statement 156·,462,94 general discussion 5
locator
conversion 99
Index 531
name on-unit
generic entry 110 dynamically descendant 219
qualified 28 file parameters 219
recognition of 75 file variables 219
symbolic 15 null 219
name (see identifiers) on-conditions 285
NAME condition 384,399 ONCHAR
NAME condition codes 384 built-in function 373
nested blocks pseudovariable 373
definition 64 ONCODE
maxi»um depth 64 (see condition codes)
NOCHECK statement 228,462,61 ONCODE built-in function 373
NOFLOW statement 232,463,61 ONCOONT built-in function 373
NOLOCK option 159 ONFILE built-in function 373
NOMAP option 291 ONKEY built-in function 373
NOMAPIN option 291 ONLOC built-in function 374
NOMAPOOT option 291 ONSOORCE
non-connected storage 117,30 built-in function 374
noniterative DO statement 58 pseudovariable 374
normal termination of program 69 OPEN statement 126,464
notation opening and closing files 126
asterisk 118 associating data sets with files 128
expression 118 CLOSE statement 130
syntax 305 implicit opening 127
NOWRITE option 174 in dynamica1ly-loaded procedure 70
null merging ot attributes 127
ar~Qments 356 OPEN statement 126
built-in function 373,98 standard files 130
character string 21 TITLE option 128
on-unit 219 operand
statement 12,463 definition 35
NULL built-in function 373,98 operating system and job control 278
number of channel programs (NCP) 175 operating system facilities
number sign (#) 9 available to programmer 7
numeric character data 19 operation
picture characters for 316 arithmetic 282,38
numeric character specifications 209 asynchronous 158,251
sign specification in 212 bit-string 38
numeric character to arithmetic combinations of 40
conversion 337 comparison 39
numeric character to bit conversion concatenation 40
numeric character to character expression 37
conversion 346 in-line 271
numeric picture specification infix 36
insertion characters 20 input 208
IIliIxilRWR size 20 logical 282
repetition factors in 19 output 208
prefix 36
synchronous 251
object of REFER option 95 using built-in functions 38
offset operational expressions
expressions 100 definition 35
variables 37,99 operators
OFFSET attribute 431 arithmetic 10
OFFSET built-in function 373 bit-string 10
ON statement 218,463,59 comparison 10
scope of 219 infix 38
with BEGIN block 53 prefix 38
ON-codes priority of 41
(see condition codes) string 10
ON-conditions 383 optimdzation 261
and en-units 285 data management 174
classification of conditions 392 features 278
conditioa codes (ON-codes) 383 in-line code 174
example of use of 223 of input/output operations 170
list of conditions 392 optimizing compiler
multiple interrupts 391 facilities of 6
option 156,95
538
option (continued) option (continued)
ADDBUFF 174 TITLE 128
ALL 62 UNTIL 56
ARGn 291 WHEN 425
ASCII 153,177 WHILE 56
ASSEMBLER 432 OPTIONS attribute 432
BKWD 170 OPTIONS option 466
BLKSIZE 150,166 order
BUFFERS 152,167 of evaluation of expressions 41
BUFND 170 of pairing 481
BUFNI 170 ORDER option 215
BUFSP 170 organization
BY 56 consecutive 118
COBOL 291 data 25
COpy 135 data set 152,168
CTLASA 172 indexed 119
CTL360 172 regional 184
DATA 140 REGIONAL(l) 185
DESCRIPTORS 83 REGIONAL(2) 188
EDIT 143 REGIONAL(3) 190
EVENT 158,253 OTHERWISE clause 414,55
FILE 135,156 output
FLOW 468 data-directed 142
FORTRAN 291 general discussion 5
FROM 157 list-directed format 139
GENKEY 114 operation 208
IGNORE 157 preprocessor 239
INDEXAREA 174 OUTPUT attribute 428
INTER 291 overflow
INTO 157 arithmetic 17
KEY 158 track 11~
KEYFROM 158 OVERFLOW condition 400,41
KEYLENGTH 162,176 OVERFLOW condition code 385
KEYLOC 162,176 overlay defining 416
KEYTO 158 overpunched sign specification
LEAVE 153,171 characters 212
LINE 136
LlNESIZE 464
magnetic tape handling 153,171 P-format item 330
NOLOCK 159 packed decimal form 17
NOMAP 291 PAGE
NOMAPIN 291 format item 330
NOMAPOUT 291 option 135
NOWRITE 174 PAGESIZE option 464
of transmission statements 135,156 pairing 481
OPTIONS 466 parameter
ORDER 215 allocation of 117
PAGE 135 area 120
PAGESIZE 464 array 119
PASSWORD 169 attribute 117
PRIORITY 254 bounds 117
record format 149,162 controlled 111
RECSIZE 150,165 descriptor lists 114,418
RECURSIVE 466 element 119
REENTRANT 466 entry 119
REORDER 275 file 119
REPEAT 56 label 119
REREAD 153,171 . lengths 111
RETURNS 110 locator 120
REUSE 110 preprocessor functions 244
SCALARVARYING 175 relationship with arguments 113
SET 157 simple 117
SIS 169 sizes 117
SKIP 135,169 string 120
STATEMENT 482 structure 119
statements and 203 type 119
STRING 135 parameter attribute 434
TASK 253
Index 539
parameter descriptors POINTER attribute 431
programmer-defined defaults for 85 POINTER built-in function 375
parentheses POLY built-in function 375
PARMSET built-in function 374 POSITION attribute 30,413
passing arguments pOSitional arguments 243
to COBOL routine 290 precision attribute 435
to FORTRAN routine 290 PRECISION built-in function 375
to main procedure 120 precision of arithmetic data 16
to PL/I procedure 292 prefix operation 36
PASSWORD option 169 prefix operators
PENDING definition 38
condition 203,400 with arrays 44
condition code 385 with structures 45
PICTURE attribute 434 prefixes
character strings 22 condition 12,217
numeric character data 19 label 12
picture character 316,322 preprocessed text 239
$ (currency symbol) 211 preprocessor
* (asterisk) 210 do-group 247
'9' in character specification 210 expressions 242
character-string data 315 fUnctions 244
credit 322 input 239
debit 322 output 239
decimal-point specifier 317 procedures 243
digit specifier 317 invocation 243
exponent specifiers 324 keyword arguments 243
factor 324 positional arguments 243
for character-string data 315 STATEMENT option 243
for numeric character data 316 RETURN 483
insertion characters 318 scan 239
overpunched signs 322 stage 239
scaling factor . 324 statements 248,478
signs and currency symbol 319 variables 242
V (decimal point specifier) 211 preprocessor built-in functions 354
Z (zero suppression) 210 preprocessor scan 239
zero replacement 322 character strings and comments 241
zero suppression characters 317 res canning and replacement 240
picture specification 209,22 preprocessor statements 248,60
characters 315 IACTIVATE 418
insertion character. 211 lassignment 419
insertion character / 211 IDEACTIVATE 419
insertion character, 211 IDECLARE 479
insertion character B 211 IDO 480
numeric character 209 lEND 480
overpunched characters 212 IGO TO 480
picture character $ 211 "IF 481
picture character * 210 I INCLUDE 481
picture character '9' 210 I NOTE 482
picture character V 211 Inull 482
picture characters 210 IPROCEDURE 482
repetition factors 22 RETURN 483
sign specification 212 primary entry point 66
picture.specification characters 315 PRINT attribute 125,436
picture specifications PRINT files 141
character-string 212 standard file SYSPRINT 148
pitfalls and common errors 278 printer/punch control (CTL360/CTLASA) 112
PL/I priority
concepts of 1 of operands 41
environment 294 of operators 41
procedure 292 of tasks 254
PLIRETV built-in function 375 PRIORITY built-in function 375
point of invocation of procedure 66 PRIORITY option 254
point specifier PRIORITY pseudovariable 316
V decimal 317 prOblem data 290,82
pointer definition 15
built-in function 375 procedure
expression 92 blocks 63
variables 37,92 labels On 63
540
procedure (continued) PUT statement 468
main 13 PUT variables 232
preprocessor 243
recursive 71
reference 65 qualification
termination of 68 locator 91
procedure block multiple locator 102
definition 13 qualified names 28
invoking 13 of structure elements 28
PROCEDURE statement 466,52 quotation marks 21
processes in application of attributes 81
processing
batch 227 R picture character 322
conversational 227 R-format item 331
list 96 RANGE option 448
mode 159,93 reactivation of active procedure 71
processing modes 159 READ statement 156,470,94
locate mode 161 real arithmetic data 16
move mode 159 REAL attribute 412
processor stage 239 REAL built-in function 376
PROD built-in function 376 REAL pseudovariable 376
program recognition of names 75
amending 237 record
control 279 alignment 502
control data 290,82 condition codes 384
elements 9 D-format 154,178
interrupt handling for 274 DB-format 154,178
message control 199 dummy 183,185,189,190
organization 63 files 205
structure 3,12 fixed-length 149,164
termination 69 locked 125
program control data 290,82 transmission 50
area 25 undefined-length 150,165
comparisons 39 variable-length 149,164
definition 15 RECORD attribute 124,436
entry 24 RECORD condition 202,400
event 24 record format defaults 151,167
file 23 record format options 149,162
label 23 BLKSIZE option 150,166
locator 24 fixed-length records 149,164
restriction on conversion of 37 RECSIZE option 150,165
task 24 undefined-length records 150,165
program organization statement type 52 variable-length records 149,164
programmer-defined default 85 recorded key 179,185
programming example 258 RECSIZE option 150,165
programming techniques for optimizing recursion 71,88
compiler RECURSXVE option 466
in-line operations 271 REDUCIBLE attribute 428
prologues 72 redundant expression elimination 278
pseudovariable reentrability 252
COMPLETION 367 REENTRANT option 466
COMPLEX 367 REFER option 95
definiton 42 reference
general description 356 generic entry names 110
IMAG 370 subroutine 107
nesting restriction 356 REGIONAL data sets 168
ONCBAR 373 regional organization 184
ONSOURCE 374 keys 184
PRIORITY 376 types of 185
REAL 376 REGIONAL(l) organization 185
STRING 378 creating data set 185
SUBSTR 379 direct access 187
ONSPEC 3-80 dummy records 185
punch, card sequential access 187
POT ALL statement 236 REGIONAL(2) organization 188
PUT diagnostic statements 61 creating data set 189
PUT FLOW statement 235 direct access 190
PUT SNAP statement 235 dummy records 189
Index 541
REGIONAL(2) organization (continued) self-defining data (REFER option) 95
sequential access 189 object of REFER option 95
source keys 188 structure mapping 96
REGIONAL (3) organization 190 sequential 124
cre~ting data set 190 access 183,189,187,191
direct access 191 update 179
dummy records 190 SEQUENTIAL attribute 417
sequential access 191 SET option 157
relationship of arguments and setting
parameters 113 event variables 256
allocation of parameters 117 pOinter variables 92
argument and parameter types 119 sharing data between tasks 255
dummy arguments 113 sharing files between tasks 256
entry attribute 114 short floating-point form 19
RELEASE statement 472,53,69 SIGN built-in function 377
remote format item 326 sign specification in numeric character
REORDER option 275 specifications 212
REPEAT built-in function 215,376 SIGNAL statement 221,475,60
REPEAT option 56 signs and currency symbol 319
repetition factors + picture character 322
in character string data 21 $ currency symbol 322
in numeric picture specifications 19 picture character 322
repetitive specification 137 S picture character 322
replacement 240 simple defining 414
REREAD option 153,171 simple parameter 111
rescanning 240 simple statement 12
reserved words 75 simplification, expression 216
restoring standard defaults 84 SIN built-in function 317
results of arithmetic operations 38 SIND built-in function 371
results of assignments 43 SINH built-in function 371
RETURN SIS option 162,169
preprocessor statement 483 SIZE
return codes 299 condition 11,222,401
RETURN statement 107,109,472,59,68 condition code 385
returned value 244 raised in data conversion 47
attributes of 109 size attribute 408
RETURNS attribute 110,437 SIZE condition 11
RETURNS option 110 SKIP
programmer-defined default for 85 format item 331
RETURNS attribute and 106 option 135
REUSE option 162,170 SKIP option 162,169
REVERT statement 221,473,60 SNAP option 235
REWRITE statement 156,473 source 335
ROUND built-in function 376 key 119,185
keys 188
listing 239
S picture character 322 program 218
SAMEREY built-in function 376 to target rules 335
SCALARVARYING option special characters 9
varying-length string option specification
(SCALARVARYING) 175 attribute 83
scale of arithmetic data 16 character 212
scaling factor 324 character-string picture 212
scan, preprocessor 239 characters 315
scope data 136
of condition prefix 218 data-directed data 140
of contextual declaration 76 edit-directed data 143
of declaration of name 75 factored default 85
of DEFAULT statement 84 list-directed data 138
of explicit declaration 76 numeric cha~acter 209
of member names of external picture 209
structures 80 picture character '9' 210
of ON statement 219 repetitive 131
secondary entry point 66 specification for input
SELECT statement 474,55 data-directed data 141
select-group 55 specification for output
definition 13 data-directed data 142
selection, generic 110
542
specifier statement (continued)
decimal digit 317 null 463
decimal-point 317 ON 218,463
digit 317 OPEN 126,464
exponent 324 preprocessor 248,418
V decimal point 317 PROCEDURE 466
SQRT built-in function 377 PUT 468
stage PUT ALL 236
preprocessor 239 PUT FLOW 235
processor 239 PUT SNAP 235
standard defaults READ 156,410
application of 81 RELEASE 412
restoring 84 RETURN 101,109,472
standard file 130 (preprocessor) 483
input file SYSIN 130 REVERT 221,413
output file SYSPRINT 130,148 REWRITE 156,413
statement SELECT 414
IACTIVATE 418 SIGNAL 221,415
lassignment 419 STOP 101,415
"CONTROL 483 UNLOCK 156,475
IDEACTlVATE 419 WAIT 256,416
IDECLARE 479 WRITE 156,417
100 480 STATEMENT option 482
lEND 480 statement prefixes
"GO TO 480 condition 12
"IF 481 label 12
"INCLUDE 481 STATIC attribute 408
INOPRINT 484 static storage 81
"NOTE 482 allocation of 70
Inull 482 initialization of 87
"PAGE 484 static variables 70
"PRINT 484 STATUS built-in function 251,311
"PROCEDURE 482 status list, current 232
"SKIP 485 STOP statement 107,475,59
ALLOCATE 439 storage
and options 203 automatic 87
assignment 441 based 91
BEGIN 443 connected
CALL 253,444 general discussion 111
CHECK 228,445 controlled 88
classes of 49 non-connected
CLOSE 130,446 and DEFINED attribute 30
data transmission 134,155 general discussion 117
DECLARE 446 static 87
DEFAULT.447,83 using common 293
DELAY 257,450 storage allocation 70
DELETE 156,450 types of 4
descriptive 49 STORAGE built-in function 377
DISPLAY 451,51 storage control
DO 451 automatic storage 87
END 101,454 based storage 91
ENTRY 455 built-in functions 354
EXIT 101,456 controlled storage 88
FETCH 456 statement type 53
FLOW 230,451 static storage 87
FORMAT 457 STREAM attribute 124,436
FREE 458 stream transmission
general discussion 12 data-directed data 140
GET 459 list-directed data 139
GO TO 109,296,460 statement type 50
GOTO 101 string 285
HALT 461 built-in function 215,378
IF 461 data 21
LEAVE 462 handling 213
listing control 249,483 operator 10
LOCATE 156,462,94 overlay defining 416
NOCHECK 228,462 parameter 120
NOFLOW 232,463 pseudovariable 318
Index 543
string (continued) subroutine and functions (continued)
unaligned bit 155 entry pOints of 106
STRING built-in function exit-points of 106
in array expressions 44 FORTRAN library functions 112
string built-in functions 214 functions 108
BIT 214 generic entry names and references 110
BOOL 215 paSSing argument to main procedure 120
CHAR 214 relationship of arguments and
HIGH 215 parameters 113
INDEX 214 RETURNS attribute and RETURNS
LENGTH 215 option 106
LOW 215 subroutines and functions 105
REPEAT 215 subscripted qualified names
STRING 215 definition 29
SUBSTR 214 SUBSCRIPTRANGE
TRANSLATE 215 condition 222,402
UNSPEC 215 condition code 386
VERIFY 215 subscripts
string data expressions used as 21
altering length of 207 of arrays 26
bit 22 SUBSTR built-in function 214,246,318
character 21 SUBSTR pseudovariable 319
qualified names 28 SUM built-in function 379
STRING option 135 suppression character
in GET statement 208 * 318
in PUT statement 208 Z 318
STRING pseudovariable 378 zero 311
string-handling built-in functions 353,355 symbol
STRINGRANGE $ currency 322
condition 222,401 symbolic name 15
condition code 386 synchronization of tasks 255
STRINGSIZE 402 synchronous operation 251
condition 402 syntax notation 305
condition code 385 SYSIN standard input file 130
raised in data conversion 47 SYSPRINT
structure 27 standard file 148
arrays of 29 standard output file 130
BYNAME assignm~nts 46
controlled 91
expression 35,45 T picture character 322
infix operators with 46 TAN Quilt-in function 319
mapping 487,96 TAND built-in function 319
operations involving arrays 45 TANH built-in function 319
parameter 119 target variable
prefix operators with 45 attributes of 43
qualified names 28 task
structure mapping 96 coordination 255
example of 489 creation of 253
rules 487 data 24
structure-and-e1ement operations 46 priority of 25lJ
structure-and-structure operations 46 sharing data between 255
structure, program Sharing files between 256
general discussion 3,12 synchronization 255
subparameter, DCB 152,176 termination of 251
subroutine 107 TASK attribute 431
and functions 105 TASK option 253
built-in 112 tasking and reentrability 252
END statement 107 teleprocessing
EXIT statement 107 data sets 171
GOTO statement 107 ENVIRONMENT attribute 199
reference 107 ERROR condition 202
RETURN statement 107 error handling 202-
STOP statement 101 message control program 199
subroutine reference 101 PENDING condition 203
subroutine and functions RECORD condition 202
built-in functions 111 statements and options 203
built-in subroutines 112 TRANSIENT attribute 202
ENTRY attribute 106 TRANSMIT condition 202
544
termination UPDATE attribute 124,428
of blocks 67 update, sequential
of FORTRAN and COBOL routines 296
of program 69
of tasks 257 V decimal point specifier 317
testing event variables 2S6 V option 162
COMPLETION built-in function 257 V picture character 211
STATUS built-in function 2~7 value returned 244
text, preprocessed 239 variable
THEN clause 461 aliased 276
threaded list 97 area 99
TIME built-in function 379 based 91
TITLE option 128 definition 15
TO option 55 file 123
TOTAL option 170 offset 99
tracing facilities painter 92
CHECK statement 228 preprocessor 242
FLOW statement 230 PUT 232
NOCHECK statement 228 setting painter 92
NOFLOW statement 232 static 87
track overflow (TRKOFL) 175 uninitialized 23
transfer VARIABLE attribute 438
of invariant expressions 277 variable-length records 149,164
of invariant expressions or VARYING attribute 21,410
statements 274 varying-length string
TRANSIENT attribute 124,202,417 and area variables 155
TRANSLATE built-in function 215,379 option (SCALARVARYING) 175
transmission VB option 162
data-directed 133 VBS option 162
edit-directed 134 VERIFY built-in function 215,381
list-directed 133 virtual storage tuning 268
of data-list elements 138 VS option 162
transmission statements VSAM data sets 168
data 134,155 VSAM organization 192
options of 135,156
TRANSMIT
condition 202,402 WAIT statement 256,476
condition codes 384 WHEN clause 474,55
transmitted data 155 WHEN option 425
TRUNC built-in function 380 WHILE option 56
tuning a program for virtual storage 268 word 31
type conversion 36 WRITE statement 156,477
types
argument 119
data 290 x picture speCification character 22
of list 98 X-format item 331
of regional organization 185
of statements 49
parameter 119 Y picture character 322
Index 545
OS PLjI Checkout and Optimizing Compilers: Reader's
Language Reference Manual Comment
Order Number GC33-0009-4 Form
Your comments about this publication will help us to improve it for you.
Comment in the space below, giving specific page and paragraph references
whenever possible. All comments become the property of IBM.
Please do not use this form to ask technical questions about IBM systems and
programs or to request copies of publications. Rather, direct such questions or
requests to your local IBM representative.
If you would like a reply, please provide your name and address
(including ZIP code).
Fold on two lines, staple, and mail. No postage necessary if mailed in the U.S.A. (Elsewhere,
any IBM representative will be happy to forward your comments.) Thank you for your
cooperation.
GC33-0009-4
oen
-0
r
::::-
I BM Corporation
P.O. Box 50020
Programming Publishing
San Jose, California 95150
..........................................................................................................................................
Fold and Staple
o
en
."
r-
:::::
r-
Q)
:l
(Q
c:
Q)
(Q
CD
-
::xJ
CD
CD
~
CD
:l
~
~
Q)
:l
c:
~
."
CD
Z
~
(I)
eN
-
c:»
o
en
....,
eN
o
~
<0
.,."
...
:r
a