C28 6594 4_PL1_F_Programmers_Guide_Nov68 4 PL1 F Programmers Guide Nov68

C28-6594-4_PL1_F_Programmers_Guide_Nov68 C28-6594-4_PL1_F_Programmers_Guide_Nov68

User Manual: C28-6594-4_PL1_F_Programmers_Guide_Nov68

Open the PDF directly: View PDF PDF.
Page Count: 288

DownloadC28-6594-4_PL1_F_Programmers_Guide_Nov68 C28-6594-4 PL1 F Programmers Guide Nov68
Open PDF In BrowserView PDF
File No. S360-29
Form C28-6594-4

Systems Reference Library

IBM System/360 Operating System

PL/I (F)
Programmer's Guide
Program Number 360S-NL-Sll

The PL/I
(F) Compiler translates PL/I source
programs
into
object programs in System/360
machine language. This publication describes the
facilities provided by the compiler, and the
conventions and restrictions which the user must
observe.
It explains how to compile, link-edit,
and execute PL/I source programs in the environment of System/360 Operating System. Features of
PL/I which are not supported by the (F) Compiler
are detailed in Appendix H of this publication.

OS

PREFACE

This publication describes the facilities provided by the PL/I (F) Compiler,
which functions under IBM System/360 Operating System.
It covers those language
restrictions and operating considerations
that the user must take into account in
using the (F) Compiler.

Job Control Language Charts,
Form C28-6632

Supervisor and Data
ces., Form C28-6646
system
C28-6550

Management~ervi=

Programmer's

Guide,

Form

PREREQUISITE PUBLICATION
The reader is assumed to have a working
knowledge of PL/I; he should therefore be
familiar with the material contained in the
following publication:

Utilities, Form C28-6586

In addition to those mentioned above,
the following publications contain information which may be helpful to the user.
IBM System/360 Operating system:
The following publications are referred
to in the text for information beyond the
scope of this publication:
!~~_§yst~ffil3£Q_QE~fati~~System:

~i~~~g~_Editof'

Concepts and Facilities, Form C28-6535
Form
Storage Estimates, Form C28-6551

Form C28-6538

~ob Control~~~~age,

Form C28-6539

r-----------------------------------------------------------,

IFifth Edition (November, 1968)
I
I
I
IThis is a major revision of, and obsoletes, C2B-65911-3 andl
ITechnical Newsletters N33-6006 and N33-6007. Changes tol
I the text, and small changes to illustrations, are indicated I
I by a vertical line to the left of the change: changed or I
I added illustrations are denoted by the • symbol to the left I
lof the caption.
I
I
I
IThis edition applies to Release 17, of IBM System/3601
IOperating System, and to all subsequent releases until!
lotherwise indicated in new editions or Technical News-I
I letters • Changes are continually made to the specifica-I
I tions herein: before using this publication in connection I
Iwith the operation of IBM systems, consult the latest IBMI
ISystem/360 Bibliography SRL Newsletter, Form N20-0360, fori
I the
editions that are applicable and current.
I
L
___________________________________________________________
J

Requests for copies of IBM publications should be made to
your IBM representative or the IBM branch office serving your
locality.
A form for reader's comments is provided at the back of this
publication. If the form has been removed, comments may be
addressed to IBM United Kingdom Laboratories Ltd., Programming Publications,
Hurs ley
Park, Winchester, Hampshire,
England.

CI Copyright International Business Machines Corporation 1966,
1967, 196B

RL/1-2~£f~~i~~_~iQra£YL_Co~2~tatiQ~~!
2~Q£Q~~i~~~, Form C28-6590

CONTENTS

INTRODUCTION • • •

• 11

PL/I (F) Compiler.

• 11

Different Versions of the Compiler •
Changes at Second Version •.•
·
Changes at Third Version • •
•
Changes at Fourth Vers ion. .•
•
Changes at Fourth Version,
Release 17. • • • • • • • •
•
Programming Techniques and
Optimization of Source Code.
Compatibility between
Different Versions of the
PL/I Library and Compiled
Code • .•
•
Language Level •
• • • •
Language Support •
Language Features Not Supported
in the Fourth Version •
Compiler Options • • • • • • • •

11
11
12
12

13

14

14

• 16
. 16
• 16
• 16

Processing and the Operating system. • • 16
Job. • • •
• • • •
• 17
Job step •
• • ••
17
Data Set.
. 17
PL/I Processing. • • • •
Data Set Considerations.
Cataloged Procedures

· 19
• 19

JOB PROCESSING • • • •

• 20

• 18

Compiler Processing . • • • • •
• 20
Compiler ddnames. •
• 20
Compiler Device Classes
• 21
Blocking of Compiler Input and
Output • • •
· 23
Blocking of Compiler Input • .
23
Blocking of Compiler output.
• 23
Calculations for Storage
Requirements. • • • • .• • •
· 23
SYSPUNCH/SYSLIN in Batched
Compilations. • • • • • • •
24
Compil er opt ions • . • . • .
· 24
completion Codes for the Compiler • • 30
Job Control Procedure for
Compilation.
• 30
Batched Compilation.
• 30
Compiler Output • • • •
31
Printed Listings • • • •
31
Compiler Options • .
32
Compile-Time Processor Input
Listing • •
32
Source Program Listing • • •
32
Storage Requirements . • . • •
33
A'ttribute and Cross Reference
Table • • • • • • • • • . •
• 33
Aggregate Length Table. • •
• 35
External Symbol Dictionary
Listing • • • • • • • • •
36
0

0

•

•

•

0

00

•

•

•

•

•

•

•

0

•

0

•

•

Description of Contents of ESD
Listing • • • • • • • • • • • •
STATIC INTERNAL Storage Map. • •
Object Program Listing •
•
Diagnostic Messages • • . • • • •
Time of compilation. • • •
·
Object Module output. • • . •
•
Serialization of Object Decks
Abnormal End of compilation •
·

• 36
• 37
• 38
•

39

•
•
•
.

40
40
40
40

Linkage Editor Processing. • • •
••
Linkage Editor Input and output. •
Unit Names and ddnames • • • • • .
Specifying Additional Libraries. •
Link-Editing a PL/I Subroutine
into a Private Library. • • • • •
Linkage Editor Priority. • • • • •
Overlaying of PL/I Programs.. . •
Other Linkage Editor Facilities. •
Options for Linkage Editor
Processing • • • • •
.• • • • .
Job Control Procedure for Linkage
Editor • • • • • • • •
• •
Linkage Editor output .
• •
Size of Load Module.
• • • • •
Module Map • .• .• • •
• •
Cross Reference Table. . • • • • •
Disposition Data • •
• •
Diagnostic Messages • .
· .

40
40
41
41

Load Module Execution.
. .
Execution Device Specification • •
DCB Parameter. •
• • • . . •
Job Control Procedure for
Compiling, Processing by Linkage
Edi tor, and Execut ing. . .
. .
Object Program Outp ut . • •
. •
Stream-Oriented Output.
Record-Oriented Output •
. .
Object Time Diagnostic Messages . •
Operator Messages. • • •
• •
System output . • . • • . •
. •
Use of Cataloged Procedures. .
. .
Compilation with Deck Output • • .
Compilation with Object Modulp
Output. • . • . • • • . • • • . .
Compilation and Link-Editing • • •
Compilation, Link-Editing and
Execution •
••• ••
. .
Link-Editing and Execution • •
Link-Editing and Execution of
Several Separate Compilations . •

41
41
42
44
q4
45
45
45
45
45
45

46
46
46
46
46
47
47
47
48
48
48
48
49
49
49
49
50
50

MANAGING DATA.

• • 51

Files and Data Sets. .
CONSECUTIVE Organization . •
INDEXED Organization. . • •
REGIONAL Organization • . •
Source Keys and Recorded Keys.
REGIONAL (1) Data Sets ••

• • 51
• • 51
• • 51

0

•
•

•

55
55
• 56

REGIONAL (2) Data Sets. • • • • • • 5 (.
REGIONAL(3) Data sets • • • • • • • 57
Dummy Records within REGIONAL
Data Sets • • •
• 58
Data Set Definition. •

• 58

specifying Data Sets • • • • •
•
Naming of the Data Set (DSNAME). •
Extent Allocation (UNIT, VOLUME,
SPACE, LABEL) • • • • • • •
•
Disposition (DISP,SYSOUT) • •
Data Set Attributes (DCB).
• •
File Attributes and the DD
Statement • • • • • • •
• •
Record Format Information •
Record Types • • • • • •
.• •
Block Size • • • • • • .•
Logical Record Length. •
Record Format.
• •
Use of the Various Record
Formats in STREAM I/O • • • • • •
Use of the Various Record
Formats in RECORD I/O • • .•
•
Use of Spanned Records .• • •
•
Spanned Records and LOCATE I/O • •
Number of Buffers. • • • • •
•
Number of Channel Programs •
•
Chained Scheduling • • •
•
Source Code (Paper tape)
•
Density (Magnetic Tape).
•
conversion (Magnetic
tape - 7-track) • • • •
Mode (Card Reader, Punch). •
•
Stacking (Card reader, punch) • • .
Print Spacing (Printer).. • • • • •
UCS Printer - Suppress TRANSMIT. •
Validi ty Check • • • • •
•
Deleted Records. • • • •
Keys • • • • • • • • • •
• •
Extended Search Limit. •
• •
Relative Key position. •
•• •
Master Indexes • • • • •
• •
Independent Overflow Area. • • ••
Cylinder Overflow Area • • •
Data Set Organization. • • •
•
PRINT Files. • • • • • • • •
•
The Tab Control Table. • • •
•
changing the Tab Settings..
•
M

•

Creating and Accessing Data Sets •

•

58
58
58
59
59
59

61
61
62
62
63
64
64
65
65
65
65
65
65
66
66
66
66
66
66
66
66
67
67
67
67
67
67
68
69
69

• 70

• 70
• • 70
• 70
• 70
•
•
•
•

•
•
•
•
•
• •

• 73
• 73
• 74
74
• 75

Processing Modes in Record I/O •
Move Mode • • • • •
Characteristics.
•
Language Forms •
• • • •
File Attributes.
• • • •
Loca te Mode • • '. •
•
Characteristics.
• • • •
Language Forms •
File Attributes.
•

76
76
76
76
76
76
76
77
77

•
•
•
•
•
•

61.

Stream Data Sets • • • • • • • • •
• 70
Creation of STREAM Data Sets
• 70
Accessing of STREAM Data Sets. • • 70
Record Data Sets
• • • .•
•
Use of the EVENT Option.
CONSECUTIVE •
• • • •
Creation of CONSECUTIVE Data
sets. • • • • • • • • •
Accessing of CONSECUTIVE Data
Sets. • • • • • • • • •
INDEXED • • • • • • • • • • • • •
Creation of INDEXED Data Sets.
Accessing of INDEXED Data Sets
SEQUENTIAL Access. •
DIRECT Access. • • • • • • • •

REGIONAL. • • • • • • • • • • • • •
creation of REGIONAL Data Sets •
Accessing of REGIONAL Data Sets.
SEQUENTIAL Access.. •
DIRECT Access. • • •
•

70
71
71
72
72
73

SYSTEM

REQUIREME~S,.

•

• • 78

Minimum system/360 Requirements for
the (F) Compiler. • • • • • •
Instruction Sets • • •
•
Timing Clock ,~ • ,. • • •
•
Printer Character sets •
•
Operator's Console Character
Sets. • • • • • • • • • •
•
System/360 Operating System
Requirements • • • • • • •
•
Primary control Program of the
operating System. • • • •
•
Multiprogramming with a Fixed
Number of Tasks CMFT) • • • • •
Multiprogramming with a Variable
Number of Tasks (MVT) •
•

78
• 78
• 78
• 78
• 78
• 78
• 78
• 79
•

79

Compiler Support

• • 79

Object Program Support • •
control Program Options.
Usage of Data Management
Methods for STREAM I/O.
Usage of Data Management
Methods for RECORD I/O.

79
• • 79
Access
• • • • • 79
Access
•
79

MANAGING PROGRAMS.

• • 81

Program Segmentation •
The MAIN Option:.
communication Between Separate
Compilati ons. • • • • • •
Estimation of Program Size • •

· • 81
• • 81
• • 81
• • 81

Non-PL/I Modules in PL/I Programs • • • •
Combination of PL/I With Other
Languages • '. • • • • •
• •
Variable-Length Argument List. • •
PL/I Library Subroutines
••

82
82
82
83

Conditional Execution of Job Steps • • • 83
Setting Conditions • .. • .• • • • • 83
Return Code Setting by PL/I
Object Program. • •
83
Checkpoint/Restart • • • •
• • • • • 83
Compatibility with Release 11
Checkpoint/ Restart
• • 83
Introduction • • • •
83
Step Restarts. • • •
84.
Checkpoint Restarts.
84

Single Checkpoint. • • • • ,. • • •
Multiple Checkpoints • • • • • • •
Specifying Checkpoint Restart. • •
Restarts • • • • • • • • • • • • •
Data sets for Programmer-Deferred
Checkpoint Restarts. • • • • •
•
Card Input when Using PCP. • • • •
SYSIN.
• • • •
•
SYSOUT - PCP
·
SYSOUT - MVT
•
Preservation of Data sets • • • • • •
Temporary Data sets.
Updated Data Sets. • • •
•
Multitasking • • • • • • • • •
Multitasking Requirements.
Hystem/360 Requirements.
Operating System Requirements • •
Programming Requirements • '.
Mul ti tasking Management • '. • •
Programming considerations • •
Use of Priorities in PL/I.
•
I/O Handling • •
•
Strings. • • • • •
Task Termination •
Multiprocessing • •
Synchronization. • •
object Program Management •
Pseudo-Register Vector (PRV)
PL/I Sort. • • • • • • • • •
PL/I Sort Environment.
User Control of SORT ddnames
sorting Records from One Data
Set to Another. • • • • • •
Sorting Records from a PL/I
Program or Procedure onto a
Data Set. • • • • • • • • •
Sorting Records from a Data Set
into a PL/I Program or
Procedure • • • • • _ • • _ • •
Supplying~ Sorting, and Passing
Back Records to a PL/I
Procedure • • • • • • • • •
Use of PL/I SORT in a
Mul ti tasking Environment. ,.
Data Interchange • • •
PROGRAMMING TECHNIQUES •
1.

·
•
•
•
·
•

84
84
85
86
86
86
86
86
87
87
87
87
87
87
87
87
88
88
88

• 90

• 91

· 92
• 93

• 94
• 94
• 95
• 95

• 95
• 95
• 96

· 97
• 100
• 101
.102
.103
.103

'. .104

Common Errors and Pitfalls
.104
a. Operating System and Job
Control. • • • •
.104
b. Source Program and General
Syntax • • • • • • • • • • • • • • 104
c.
Program Control • • • • • • • • 104
d.
Declarations and ~ttributes • • 105
e. Assignments and
Initialization. • • • • • • • • .107
f.
Arithmetic and Logical
Operations. • • • •
.108
g. DO groups. • • • •
.110
h.
Data Aggregates. •
.111
i. S t r i n g s . . . . .
.111
j.
Functions and
Pseudo-Variables. •
.111
k. ON-Conditions and ON-Units • • 111

1.

Input/Output • • • • • • • . • 112

2. Programming for Increased
Efficiency. • • • • • • • • •
• .115
a. Improving Speed of
Compilation ,. • • • • •
• .115
b.
Improving Speed of Execution .116
c. Decreasing size of
Dict ionary • • • • • •
• .120
d.
Use of Storage • • •
• .122
e~ Use of Compile-Time
Facilities. • • • • •
• • • 123
f.
Use of Input/Output
Facilities. •
• .124
g. Additional Hints
• .126
TESTING PROGRAMS • • •

• .128

Debugging Facilities.
• .128
Control of Interruption and
Error Handl ing,. • • • • •
. .128
ON-Codes • • • • • • • • • • • • • 128
Trace of Active Procedures
•• 131
Symbolic Output. • • . • • • • • .132
Communication with the Program . . 132
User Requested Dump. • • •
•• 132
User Completion Codes for
Abnormal Termination. •
• .133
Return Codes. • • •
.134
APPENDIX

~:

DATA

FOR~TS

•

• .135

compiler Input •

• .135

Representation of Data
Coded Arithmetic Data ••
String Data. _ • • • • • •
Pi ct ured Data. • • • • • •
Data Element Descriptor (DED).
Pointer Data • •
Offset Data •
Label Data •
Task Data • •
Event Data •
~rea Data.
•
Arrays . •
Structures •
The Creation of Dope Vectors •

·
•
·
·
•
•
·
•
·
·

.135
.135
.136
.137
.137
.138
.138
.138
.138
.139

• .139

· .140
• .140
• .140

APPENDIX B: IMPIEMENT~TION CONVENTIONS
AND RESTRICTIONS. • • • • • • • • • • .141
Input/Output Conventions and
Restrictions. • • ,. • • •
PL/I and Data Sets •
DISPLAY • •
PAGESIZE
•
LINESIZE
LINESIZE, SKIP and COLUMN in
Non-PRINT Files • • • • •
Block Size and Record Size • •
Data-Directed Input/Output
Edit-Directed Input/Output
Character Code • • • • • •
48-Character Set • • • • •
The ENVIRONMENT Attribute.
GENKEY Option. •
EVENT Option • • • • • • •

• .141
• .141
• .141
•• 141
• .141
·
·
•
•
•
•
•
•
•

.142
.142
.142
.142
.142
.142
.142
.145
.146

WAIT statement • • • • •
TITLE Option • • • • • •
BASED Variables. •
Initializing LABEL Variables in
structures with the LIKE
Attribute • • • • • • • • •
Compile-Time Processing Conventions
and Restrictions.. • • •
The MACRO Option • • • •
Precision. • • _ • • • •
•
INCLUDE Conventions. • •
Compile-Time Procedures.
Compile-Time DECLARE • •
•
Combined Level of Nesting and
Depth of Replacement. • • • •
Limitations on Size of
compile-Time Processor Input.
Limitations on Number of
Compile-Time Variables.
Output Line Numbering. •

.146
.146
• 146
• 146
• 147
. 147
•• 147
• .147
• 11.n

• • 147
• .147
• .147

.148
• 148

other Compiler conventions and
Restrictions. • • • • • •
• • • • .148
• • • . .148
OPTIONS Attribute. •
Parameter to the MAIN Procedure • • 148
Number of Variables. • • • • • • • 148
Number of Executable Statements. .148
Size of an Individual Statement. • 148
Factoring of Attributes.
.149
Limitations on Nesting •
• 149
The GENERIC Attribute. •
• .149
Number of Blocks in a
Compilation • • • •
• • .149
Level Numbers. • • • • •
• .149
Number of Parameters
.149
Number of Dimensions. •
• .149
Array Boun1s • • • • • •
.149
Data-Directed List.
• • • 150
Structure and Array Expressions • • 150
Constants. • • • • •
.150
Sterling Constants. • •
.150
String Constants • • • •
.150
Floating-Point Constants and E
Format Items. • .
.150
Constants Returned by Procedures .150
Compiler-Generated Names • • • • • 150
Temporary Results in Expression
Evaluation. • • • •
.151
Multiple Assignments and
Pseudo-Variables.
• 151
Function Values. • • • •
• .151
Qualified Names. • •
• •• 151
String Lengths
.151
String Lengths in Intermediate
Result Fields • • • • •
.151
AREA Sizes • • • • • • •
• • .151
LABEL Attribute.
• • • 152
POSITION •
.152
PICTURE. • •
.152
SETS List. • • • • • • •
.152
Scale Factor
• 152
Precision. •
.152
Floating-Point Magnitude
.152
Built-In Functions • • • • • • • • 152
MAX, MIN, MOD Built-In Functions • 152
MOD Built-In Function. • • • • • .153

COMPLETION Built-In Function and
Pseudo-variable • • • •
• .153
STRING Built-In Function •
· .153
Length of Identifiers ••
• .153
Subscripted Identifiers • •
• .153
CHECK Lists. • • • • • •
• .153
Object-Time Conventions and
Restrictions. • • • • • •
• .153
Data-Directed Input. • •
• .153
Edit-Directed Output ••
• .154
CHECK Condition. • • • •
• .154
CONVERSION ON-Condition •
• .154
ON-Units and Entry Parameter
Procedures • • • _ •
· .154
Exponentiation • •
• .154
Collating Sequence
• .154
ENTRY Names as Arguments and ON
Statements in Recursive
Contexts • • • • • • • •
• .154
Concatenated Data Sets •
• .155
Locate Mode • • • •
• .155
ON Conditions. •
· .155
Record Alignment • •
· .155
APPENDIX C: OBJECT PROGRAM
ORGANIZATION AND CONVENTIONS. •
Introduction. • • • • • • •
Pseudo-Register Vector (PRV) •
Run-Time Stack.. • • • • • •
Dynamic Storage Area (DSA) • •
variable Data Area (VDA) • • •
Prologues and Epilogues • • •
Interrupt Activity and control • •
Initial Entry to Procedures with
the MAIN Option. . • • . • • • •
Combination of PL/I with Other
Languages. • . • • • • • • • • •
Calling Sequences and Register
Usage. • • • • • •
• • • • •
Linkage Conventions for Library
Modules. • • • • • • • • •
Presentation of Arguments • •
String Dope Vector (SDV) ••
AREA DOP8 Vector. • • • • •
Array Dope Vector (ADV) • •
Structure Dope Vector • • •
String Array Dope Vector (SADV) •
Structure Mapping • • • • • • • •
Rules for Order of Pairing • •
Rules for Mapping One Pair • •
Effect of UNALIGNED Attribute.
Example of Structure Mapping •
Allocation and Release of Storage
in an Area • • • • • • • • •

•
•
•
•
·
·
•
•

.158
.158
.158
.158
.159
.159
.159
.160

• .160
· .160
• .160
•
•
·
•
•
·
·
•
·
•
•
•

.161
.161
.161
.162
.162
.163
.163
.164
.165
.165
.165
.167

• .174

APPENDIX D: PROGRAMMING EXAMPLE • • • • . 176
APPENDIX E: CATALOGED PROCEDURES • • • • 182
Installation Modifications • • . • 182
Compilation with Deck Output •

• .182

Compilation with Object Module Output •• 183
Compilation and Link-Editing •

.183

compilation, Link-Editing, and
Executi on •
• • .• • •

.184

Link-Editing and Execution

.184

Overriding cataloged Procedures. •
overriding Parameters in the
EXEC statement. • • • •
Overriding and Adding DD
statements • • • • • • '.

.184
.184
.185

APPENDIX F: DYNAMIC INVOCATION OF THE
COMPILER. • • • • • • • • • •

.186

APPENDIX G

.188

DIAGNOSTIC MESSAGES

Source Program Diagnostic Messages • • • 188
Compile-Time Processing Diagnostic
Messages. • • • • • • • • • • • •

.250

Object-Time Diagnostic Messages. •

.260

APPENDIX H: LANGUAGE FEATURES
RESTRICTED OR NOT SUPPORTED IN THE
FOURTH VERSION. • • • • • • •
.272
IDENT Opt.ion • • • • • • • • • • .272

EVENT Option in the DISPLAY
Statement.,........
• .272
EVENT Option in the WRITE
statement • • • • •
• .272
INITIAL Attribute. • • •
• .272
DEFINED Attribute. • • •
• .272
Structures and Arrays of
Structures in Certain special
Contexts • • • • • • • • • • • • • 272
VARYING Strings.. . . . . . . . . 27 3
Interleaved Arrays of Varying
strings Passed as Arguments • • • 273
LABEL Arrays. • •
• • • • • • 273
The FLOAT Attribute • • • • • • • • 273
List Processing, Table Handling,
and Locate-Mode Input/Output
Facilities. • • • • • •
• .273
The SECONDARY Attribute • • • • • • 273
The NORMAL and ABNORMAL
Attributes • • • •
• .274
BASED Variables.. • • • •
• .274
OFFSET and POINTER Built-In
Function s • • • • • • • •
• .274
Based Variable Declaration
• .275
ONCOUNT Built-In Function.
• .275
APPENDIX I: MODEL 91 .

· .276

INDEX • •

• .279

Figure 1. Job Control Language
statements. • • • • • • • ~ •
• 20
Figure 2. Input/Output Data sets
21
Figure 3. Device Class Names • • ••
21
Figure 4. BCD and EBCDIC Punched Card
Codes and Graphics for PL/I
60-character Set. • • • • • • •
• 28
Figure 5. Specimen ESD Listing •
• 36
Figure 6. Linkage Editor Input/Output
Flow. • • • • • • • • • • . • • • • ~ . 41
Figure 7. Linkage Editor ddnames • • • • 42
Figure 8. Example of PL/I Procedure
Using STREAM I/O. • • • • • • • • • • . 47
Figure 9. Example of LIST/DATA/EDIT
Output to PRINT Files using the PUT
Statement • • . • •
• • '" • •
• 48
Figure 10. Invoking the Cataloged
Procedure PL1DFC..
• • • . •
49
Figure 11. Invoking the Cataloged
Procedure PL1LFC. •
• • • • • • • • 49
Figure 12. Invoking the Cataloged
Procedure PL1LFCL •
• • • • • .
49
Figure 13. Invoking the Cataloged
Procedure PL1LFCLG.
• _ • • •
• 50
Figure 14. Invoking the cataloged
Procedure PL1LFLG •
• 50
Figure 15. CONSECUTIVE Data Set
Organization and Applicable Language
Features • • • • • • • • • • • • • • • • 52
Figure 16. INDEXED Data Set
Organization and Applicable Language
Features • • • • • • • • • • • • • • • • 53
Figure 17. REGIONAL Data Set
Organization an1 Applicable Language
Features. • • • • • • • • •
• 54
Figure 18. DCB Subparameters for
STREAM I/O. • • • • • • • • •
60
Figure 19. Additional DCB
Subparameters for RECORD I/O.
• 60
Figure 20. Format of the Tab Control
Table
• ~ • • • • • • • • • • •
69
Figure 21. Control Program Options • • • 79
Figure 22. Usage of Data Management
Access Methods for RECORD-Oriented
I/O . • • • • • • • • • • • • • • • • • 80
Figure 23. Storage Required by PL/I
Library Modules when Opening and
Closing Files • • . • • • • • • • • • • 82
Figure 24. Basic Parameters for the
SYSCHK DD Statements. • • • • • • • • • 85
Figure 24.1. Figure-Length 160-byte
Records, showing Fields on which Sort
97
is to be Made • • • • • • • '" • • • •
Figure 25. Implicit Data Conversions
Performed In-Line • • • • • ~ • • • • .119
Figure 25. Implicit Data Conversions
Performed In-Line (continued) • • • • • 120
Figure 26. Conditions under which the
string Operations are Handled In-Line .121
Figure 27. Conditions under which the
String Functions are Handled In-Line. • 122
o

·

Figure 28.
Situations under which
RECORD Condition is raised in
RECORD-Oriented I/O • .. • • • • •
.126
Figure 29.
Main ON-Code Groupings
.131
Figure 30. Detailed ON-Code Groupings .131
Figure 31. Abbreviations for
ON-Conditions • • • • • • • • • • '" •• 132
Figure 32. Attributes and Precisions
for Coded Arithmetic Data • • • •• • .136
Figure 33. Data Element Descriptor
(DED) • • • • • • • • • • • • • • • • • 138
Figure 34. Eight-Bit Encoded Form of
DE!clared Information in Flags • •
.138
Figure 35. Format of the Task Variable .139
Figure 36. Event Variable Used with
I/O • • • • . • • • • • • • • • • • • .139
Figure 36.1. Event Variable Used with
a Task • • • • • . '" • ~ • • .
. .139
Figure 37.
Format of the Area
Variable. • • • • • • • • • .
• .140
Fiqure37.1. Effect of LEAVE and
RE~WIND Options on Repositioning of
Magnetic-Tape Volumes. •
• .144
Figure 38.
Equivalence of COBOL and
PL/I Data • • • • • • • • • • • • • • • 145
Fisrure 39.
Format of structure s . . . . 156
Figure 40. Block Created from
S1:ructure S • • • • • • • • • • • • • .156
Figure 41. Block Created by structure
s with Correct Alignment. • • •
.156
Figure 42. Alignment of Data in a
Buffer in Locate Mode I/O, for
Different Formats and File
Organizations • • • • • • • •
. .157
Figure 43.
Functional Content of a
Dynamic Storage Area. • • • .
• .159
Figure 44. Initial Entry to Procedures
with the MAIN Option.. '. • • • •
.160
Figure 45.
Format of the String DOpe
Vector (SDV). • • • • .• • • • • • • • .161
Figure 46.
Format of the Array Dope
Vector (ADV) • • • • • • • • • • • • • . 162
Figure 47.
Format of the Structure
Dope Vector (SDV) • • • • • • • • • • • 163
Figure 48.
Format of the Primary
String Array Dope Vector (SADV)
•• 164
Figure 49. Summary of Alignment
Requirements for ALIGNED Data • • • • • 166
Figure 49.1. Summary of Alignment
Requirements for UNALIGNED Data • • • .167
Figure 50. Mapping of Minor Structure
G ••
• • • • • • • • • • • .• • • .168
Figure 51. Mapping of Minor Structure
E
.169
Figure 52. Mapl?ing of Minor Structure
..
N
.170
Figure 53. Mapping of Minor Structure
S
.170
Figure 54. Mapping of Minor Structure
C
.171
Figure 55 • Mapping of Minor Structure
M
.172

··
··
··
··
··

········· ·
· · · ·· ·· ···
········ ··
·· ·········
a

···
···

· · ·
···
· · ···· ·· ·· · ···

Figure 56. Mapping of Major structure
A • • • • • • • • • • • • • '• • • • • • 173
Figure 56.1. Offsets in Final Mapping
of Structure A• • • • • • • • • • • • • 174
Figure 57. AREA Format, Showing
Example of Allocated Storage and Free
Elements • • • • • • • • • • • • • • • • 175
Figure 58. Ca"taloged Procedure
(PL1DFC) for Compilation with Deck
output • • • • • • • • • • • • • • • • • 183

Figure 59,. cataloged Procedure
(PL1LFC) for Compilation with Object
Mo d ul e au tp ut • • • • • • • • • •
• 18 3
Figure 60.
Compilation and
Link-Editing Cataloged Procedure
(PL1LFCL) • • • • • • • • • • • •
.183
Figure 61.
Compilation, Link-Editing,
and Execution cataloged Procedure
(PL1LFCLG) • • • • • • • • • • • • • • . 184
Figure 62. Link-Editing and Execution
Cataloged Procedure (PL1LFLG) • • • • • 184

The PL/I (F) compiler translates PL/I
source programs into object programs in
System/360
machine
language.
It
is
designed to provide fast compilation and
comprehensive diagnostic facilities.

The most significant changes for
second version of the compiler were:

the

RECORD I/O: The statements: READ,
WRITE, REWRITE, and DELETE
The attributes: RECORD, UPDATE,
SEQUENTIAL. DIRECT, BACKWARDS,
BUFFERED, UNBUFFERED, and KEYED

The source program is maintained in
storage throughout the compilation process,
as far as possible, and successive phases
of the compiler are passed against it.
This means that the use of input/output
data sets is kept to a minimum, with a
consequent improvement in performance.

The ON-conditions: RECORD and
KEY

The compiler is of modular construction.
For the compilation of a given source
program,
it uses only those modules that
are
actually
required, and these are
selected automatically.

Note: The usage UPDATE SEQUENTIAL was not supported except
for INDEXED data set organization.

A comprehensive set of compiler options
is available to the user.
The default
values for these options are set at system
generation time, and the options required
for a particular compilation are selected
at compilation time.
Wide use is made of modular library
routines,
us~n~
selective loading techniques to mlnlmize the
storage
space
required by object progr.ams.

The built-in functions: ONFILE
and ONKEY

COMPILE-TIME PROCESSING: The compiletime processing feature of PL/I
COMPILER OPTIONS: Abbreviated names as
alternatives to the full names
for compiler options
ARRAY INITIALIZATION: Initialization of
arrays of STATIC variables by
means of the INITIAL attribute
STREAM I/O: The options PAGESIZE and
LINESIZE
The ON-condition NAME

This edition Form C28-6594-4 of the PL/I
(F) Programmer's Guide documents the fourth
version of the compiler with the improvements incorporated for' Release 17 of the
operating system.

LIST/DATA-DIRECTED OUTPUT: Alignment of
data on preset tab positions
RECORD FORMAT: The use of undefinedformat source records

Earlier versions are:
1st
2nd
3rd
4th

version
version
version
version

Form:
Form:
Form:
Form:

C28-6594-0
C28-6594-11
C28-6594-2
C28-6594-3

The more important differences between
these versions of the compiler are listed
below.
There then follows a statement
concerning the compatibility between compiled code and Library modules of various
versi·ons.

PAPER TAPE: Paper tape as input to the
compiler and object program
OPERATORS: The operators ,> and ,<, and
their 48-character set
equivalents NG and NL
QUALIFIED NAMES: The resolution of
apparently ambiguous name qualification
Introduction

11

OBJECT PROGRAM LISTING: Double-column
format for the object program
listing
OBJECT-TIME ERROR HANDLING: Optional
inclusion of the statement
number in object-time diagnostic messages
Combination of SNAP output with
SYSTEM action for ON statements
RECURSION ENVIRONMENTS: A change in the
interpretation of ENTRY parameters and ON units in recursive
contexts

LINKAGE EDITING: A changed method of
link-editing library routines
into an object program, facilitating both the link-editing of
PL/I object modules from a
library and the use of overlay
technique with PL/I object
modules.
MIXED DEFINING: The severity of diagnostic messages for defined
data of type different from the
type of the base is reduced
from terminal to error, permitting the compilation of programs using mixed defining.

CATAL03ED PROCEDURES: A new cataloged
procedure (PL1LFLG) for linkage
editing and execution
The most significent changes for the
fourth version of the compiler are:
~hanges

LOCATE I/O AND LIST PROCESSING: The
following language is now supported:

at Third Version

The most significant changes
third version of the compiler are:

for the

OBJECT PERFORMANCE: Changes in the
object code generated by the
compiler will result in considerable improvements in the
object-time performance. The
most significant improvements
are in the following areas:
data conversions, the SUBSTR
function and pseudo-variable,
the INDEX function, the UNSPEC
function, object-time error
handling and procedural housekeeping, and the usage GO TO
label-variable.
ARRAY INITIALIZATION: Initialization of
arrays of AUTOMATIC or CONTROLLED variables by means of
the INITIAL attribute.
UPDATE SEQUENTIAL: The usage UPDATE
SEQUENTIAL for CONSECUTIVE and
REGIONAL data set organizations.
ASYNCHRONOUS OPERATION: The EVENT
option on I/O statements, the
COMPLETION built-in function
and pseudo-variable, and the
WAIT statement.
BATCHED COMPILATION: The facility for
batched compilation of programs
and a new compiler option,
OBJNM.
12

Statements and options:
READ FILE(filename) SET{pointer
variable) [KEY{expression) I
KEYTO(character-string
variable)];
LOCATE based variable
FILE (filename) [SET (pointer
variable)] [KEYFROM(expression)];
REWRITE FILECfilename);
ALLOCATE based variable
[IN(area variable)]
[SET{pointer variable)];
FREE based variable [IN (area
variable)];
Assignment:
AREA to AREA
POINTER/OFFSET to
POINTER/OFFSET
Attributes:
AREA[Cexpression)]
BASED (pointer)
OFFSET (based variable)
POINTER
REFERCidentifier)
Built-in functions:
ADDR
EMPTY
NULL
NULLO

Condition:
AREA
Operation:

-> in 60-character set
PT in 48-character set
ASYNCHRONOUS OPERATIONS AND MULTI TASK- :
ING : The following language is
now supported:
Statements and options:
CALL statement with TASK, EVENT
and PRIORITY options in any
combination, .
WAIT statement extended to
allow array names in the
event list
DISPLAY statement with REPLY
and EVENT options
UNLOCK statement
NOLOCK option in READ statement
Assignment:
EVENT to EVENT
Attributes:
EVENT
EXCLUSIVE
TASK
Built-in functions/pseudovariables:
COMPLETION
PRIORITY
STATUS
Multitasking is supported by the
MVT system

INTO or FROM options; the KEY
option in the DELETE statement
is now optional.
The DELETE
statement is now supported for
INDEXED data sets using SEQUENTIAL access.
Four new ENVIRONMENT options (INDEXAREA, NOWRITE, REWIND, and 3ENKEY)
provide improved performance
COMPILER OPTIONS: SIZE and SORMGIN have
been changed, and four new
options (OPLIST, EXTDIC, MACDCK
and NEST) have been added
COMPILE-TIME OPTIMIZATION: Macroprocessor concatenations are
improved
OBJECT PROGRAM OPTIMIZATION: Constant
subscri~t and constant
expres~ion evaluation; some
instances of VARYING strings in
assignment; in-line code for
some VARYING string operations;
prologue optimization; in-line
handling of certain data conversions and some bit-string
assignments; rounding-off
 for Eand F-format output; dope vector initialization improved;
optimization of some IF statements.
LISTING IMPROVEMENTS: More details in
attribute listings; aggregate
listing is in alphabetical
order; sizes of the STATIC and
program control sections are
given; the size of each DSA is
given; statement number provided in diagnostic message for
invalid pictures; improvements
of aggregate length table for
BASED items.

Multiprocessing
DATA INTERCHANGE: The COBOL option in
the ENVIRONMENT attribute; the
ALIGNED/UNALIGNED attributes
(for FORTRAN data interchange)
ASSEMBLER SUBROUTINES: A variablelength argument list can be
passed to assembler subroutines
invoked by a PL/I program
STRING HANDLING: The STRINGRANGE condition for use with SUBSTR; the
STRING function

PROGRAM RESTART: The operating system
checkpoint/restart facility is
available under PCP
EVALUATION OF EXPRESSIONS: The order of
priority is changed; concatenation now comes before the comparison and logical-operators
in the sequence of priority
PL/I SORT: The operating system sort
program is available for use
with PL/I programs

STREAM I/O: LINESIZE. SKIP and COLUMN
in non-PRINT files; PUT DATA
with no data list
RECORD I/O: Some types of VARYING
string may be used with the

The most Significant changes for the
fourth version at Release 17 are:
Introduction

13

RECORD I/O: Spanned records (VS- or
VBS-format) can be specified to
span blocks
Generic keys (GENKEY option)
can be specified to access
groups of records on an INDEXED
data set

2.

In string to arithmetic conversion,
the precision obtained is now the
maximum precision, not the default
precision.

3.

E- and F-format items are now
on output, not truncated.

4.

Multitasking is supported in this version of the compiler.
Therefore a
fourth-version program with the TASK
option will only execute successfully
with programs based on earlier versions if these programs have been
recompiled with the TASK option. Even
then, subprograms of these earlier
programs may need rearranging to execute succesfully.

PL/I SORT: User control of SORT ddnames
for multiple use of PL/I SORT
within a single job step is
provided
MULTIPROCESSING: More than one PL/I
task may be executed simultaneously by a multiprocessing
system
PROGRAM RESTART: Improved checkpoint/
restart facilities are
supported by PCP and MVT systems

A program containing a CALL

statement
with the EVENT option should be compiled with the TASK option in the main
procedure. If the TASK option is not
specified, it is assumed by default.

CATALOGED PROCEDURES: Changes to some
condition codes and to the
dsnames for temporary data sets
have been incorporated into the
PL/I cataloged procedures

~ot~~

There is
an
incompatibility
between multitasking in Release 15 and
multitasking in Release ~6, caused by
the removal of multitasking code from
some PL/I
library modules. Multitasking programs coded using a Release
15 version of the compiler must be
recompiled and re-link edited if they
are to be executed with a Release 16
version.

5Q

If a procedure is to be used recursively or in a reentrant manner,
the
attributes
RECURSIVE
(for
any
procedure) or REENTRANT (for the ma1n
procedure) must be specified in the
PROCEDURE statement. In earlier versions if these attributes were omitted, a procedure would function correctly if used recursively or in a
reentrant manner.

6.

The removal of PACKED from the language, and the introduction of UNALIGNED as the complementary attribute
to ALIGNED, has brought differences
between the current and earlier versions of the compiler in the mapping
of some aggregates and in the application of default attributes.

Details on avoiding common pitfalls and
coding for improved efficiency are given in
t.he section entitled E.rogramming TechniSl};!~~·

Co~atibility between Different Versions of
the FL/I Library and Compiled Code

Certain changes and improvements have
been made to PL/I, the compiler, and the
library between the four versions of the
compiler.
As a result, certain incompatibilities have unavoidably arisen between
library modules of the different versions.
The purpose of this compatibility statement
is to make clear to the user what incompatibilities exist, and how the problems
raised by them can be overcome.
Several changes in the fourth version
prevent this version from being completely
compatible with earlier versions:
1.

14

In the evaluation of expressions, the
pri.ority of concatenation has been
increased so that it now takes precedence over the comparison and logical
operations.

rounded

When
a PL/I program containing a
statement with the PACKED attribute is
compiled by a PL/I (F)
compiler that
supports
ALIGNED/UNALIGNED,
then
PACKED is recognised and ignored, and
the current defaults for the data type
are applied. The mapping is the same
as that formerly obtained with PACKED.
For example:
DCL A(5) BIT(7) PACKED;

is word-aligned,
B is
and C is bit-aligned.

The default for string elements in
aggregates is UNALIGNED, which provides the same mapping as for PACKED.
7.
DCL 1 STR PACKED,
2 A FLOAT(5).,
2 B BIT( 3) ;
The data-type defaults are applied; A
is ALIGNED and B is UNALIGNED.
The
mapping is the same as that
for
PACKED.
It must be remembered that PACKED and
UNALIGNED are not similar in meaning.
If UNALIGNED is substituted for PACKED
in the explicit declaration of a major
structure,
then there may be significant differences in the two mappings.
For example:
DCL 1 STR PACKED,
2 A CHAR(3),
2 B FLOAT DECIMAL(15),
2 C BIT( 2) ;

Exponentation by integers
is
now
changed.
Previously,
both operands
were converted to floating-point,
and
the result precision was the greater
of the operand precisions.
Now,
if
the second operand is a fixed-point
variable with precision (p,O),
the
first
operand
is
converted
to
floating-point, and the prec1s1on of
the result is the precision of the
first operand.

Two definite compatibility statements
can be made about the compilers in general:
1.

Compiled code from any version of the
compiler must always be executed using
a library of the same version or a
later version ..

2.

Library modules of different versions
can be mixed only in the following
circumstances:

Here A would be aligned on a byte
boundary, B on a doubleword, and C on
a bit boundary.
If UNALIGNED were
substituted for PACKED, A and B would
be byte-aligned. and C bit-aligned.
The change in the default attributes
has brought an incompatibility for bit
string arrays.
In the statement:
DCL A(10) FLOAT(5).
B(5) BIT(3);

byte-aligned,

a.

All link-edited modules must be ot
the same version as each other,
and

b.

All dynamically linked or loaded
modules must be of the same version as each other and must be of
at least as late a version as the
link-edited modules.

the former defaults for A and B would
be ALIGNED;
A would be an array of
word~aligned arithmetic
data,
and B
would be an array of byte-aligned bit
strings.
But the default for arrays
is now according to data type; A is
ALIGNED and hence still word-aligned
and B is UNALIGNED and becomes bitaligned.
To make string arrays in
programs with
PACKED
as
default
compatible (without recompiling) with
those in programs with the data-type
default, the latter must be explicitly
declared ALIGNED.

Unless
a user has link-edited PL/I
external procedures with modules from a
PL/I library and placed them in a private
library for future use with main programs
compiled by a later version of the compiler, these incompatibilities should cause no
problems.
Provided the user has installed
the latest compiler and library components,
all future link-editing operations will
result in the incorporation of the correct
library modules.
If. however, he has linkedited some of his external procedures,
then,
if
he intends to use them in
conjunction with a main program containing
later-version library modules,
he
must
remove the earlier-version library modules
from them.

On the other hand, the default mapping
for structures is the same as before.
A structure declared as:

Two methods may be employed to
this out. one temporary and the
permanent:

DCL 1
-2
2
2

STR,
A FLOAT(5),
B CHAR(4),
C(10) BIT(7);

formerly had the default attribute
PACKED; it now has default attributes
that depend on the data type.
The
mapping is the same in both cases: A

1.

carry
other

The linkage editor map for the external procedure is examined to
see
whether any library modules have been
incorporated in the load module; these
can pe identified by the initial letters IHE.
If there are no library
modules present in the load module, no
further
action
is
required.
If
library
modules are present,
then
Introduction

15

every time a main program needs to use
the external procedure. it should be
link-edited with it, using INCLUDE
cards naming the library modules which
are to be replaced (i.e., all of them)
and an INCLUDE card naming the external procedure its elf.
(The latter
must be a separate card and it must
follow the INCLUDE card
for
the
library modules.) This will result in
the incorporation of
the
correct
later-version library modules and then
the external procedure itself.
This
method is temporary.

storage size
Line count
Source program listing
Object program listing
compiler options listing
External reference listing
Attribute listing
Cross reference listing

20

The permanent method is to link-edit
the external procedure
using
the
replace facility on the NAME card. In
other words,
the linkage editor is
executed using the INCLUDE cards naming the library modules which are to
be replaced, followed by an INCLUDE
card naming the external procedure,
followed by a NAME card naming the
external procedure with the replace
option.

LANGUAGE LEVEL
-------------

Object program deck
Object program load file
Production of a NAME card
editor processing

for

linkage

Optimization
Use of either BCD or EBCDIC
Specification of source margins and of
carriage control character for source
program listing
Use of either 48- or 60-character set
Inclusion of source program statement
numbers in diagnostic messages

rh~ language features supported
by the
(F) Compiler are as defined in the publication I!~_~y~~g~Ll~Q_Q~rating System, PL/I
Reference Mdnual. Certain minor restrictions-are-necessary for the efficient operation of the compiler.
For full details of
these restrictions refer to Appendix B of
this publication.

Level at which diagnostic messages
printed

are

Compile-time processing
Compile-time processor input listing
compilation
processing

to

follow

compile-time

Extended dictionary
Nesting
ing

count for source program list-

In addition to the restrictions specified in Appendix B, certain areas of the
language are not implemented in the fourth
version of the compiler.
For
fuller
details of features not supported by this
version, refer to Appendix H of this publication.

For details of these options,
section called "Job Processing."

A number of compiler options are available to the user. These can be specified at
compilation time as parameters on the execute statement (EXEC) card. They include
the following:

The basic units of processing in the
operating system are the job and job step.
The programmer communicates with the PL/I
(F) compiler via the PL/I language; he
communicates with the operating system via
the job control language.

16

Macro-processor card deck
Model 91 option
see

the

JOB: Aircraft test flight
JOB STEP 1 : Refine raw data
On receiving a problem, a programmer
analyzes that problem and constructs a
precise procedure to solve it;
in other
words, he writes a program to solve the
problem. The computer then carries out the
work specified in the programmer's procedure.
The amount of work specified by the
programmer for the computer is called a
job, and is defined by using the JOB
control statement in the job control language.
For example,
executing a single
program to solve an equation is a job to
the computing system.

If the problem is complex, the programmer may break it down into a series of
steps, each step corresponding to a program.
For example, the programmer may
receive a tape containing raw data from an
aircraft test flight.
His objective may be
to transform the raw data into a series of
charts and reports.
He may define the
tnree following steps:
1.

g~ii!!i!!g_g~~_Qat~: Because
of intermittent errors in meters and data
transmission facilities,
errors may
occur in the raw data. The first step
is to compare the raw data to projected data and to eliminate errors.

2.

Q~Y~lQEi!!9. __ ~al~~~:

To use the refined
data and a set of parameters as input
to a set of equations to develop the
values for the creation of charts and
reports.

JOB STEP 2: Develop values
JOB STEP 3 : Generate
graphs

reports

and

Data Set
In the example,
job step 1 used three
collections
of
data
as
input
and
output -- raw data, projected data.
and
refined data. Any job step can use collections of data.
In the System/360 operating
system, a collection of data is called a
data set.
A data set is defined to the
operating system by a DD (Data Definition)
statement of the job control language. ~ne
word "file," as defined for PL/I, may for
the most part be equa~ed with the term
"data se~," as defined for the operating
system.
A data set resides on one or more
volumes.
A volume is a standard unit of
external storage~hat can be written on or
read by an input/output device.
(For example, a volume may be a reel of ta~e, a disk
pack, or a card deck.)
The operating
system provides the feature of device independence; that is, when writing his source
code,
the user need not concern himself
with the physical device from or onto which
he may be reading or writing.
The same
data set may at different times reside on
different
volumes (and hence different
types of device).

The important aspect of a job is that it
is defined by the programmer.
In this
example the job can cover all three steps.
In operating system terminology, a stage of
processing executed to perform part of a
job is called a iQ2-st~E. The programmer
defines the job step to the operating
system by using an EXEC control statement
of the job control language.

The names of data sets and any information identifying the volumes on which they
reside may be placed in a catalog to help
the operating system find the data set.
This catalog resides on the direct-access
volume that contains the operating system.
Any data set whose name and volume identification are placed in the catalog is
called a catal25l.ed data se~. Other information concerning the data set, such as
device specification, the position of the
data set in the volume or the format of
records in the data set,
can also te
accessed by the operating systemo
If the
data set is cataloged when it is first
created, the only information needed to
retrieve the data set is its name.

By designating several related steps as
one job, with each step designated as a job
step, efficient use is made of the operating system. In the aircraft test flight
example, each step may be defined as a job
step in a job encompassing all the required
processing, as follows:

Note: Data set names that begin with the
letters SYS and have a P as the nineteenth
character of the name should not be used.
Data sets with such names are created for
temporary data sets on PCP systems, but not
for temporary data sets on MVT or MFT
systems, and are deleted when the IEHPROGM

3.

9~!!er~~i!!g __ g~Eor~~

and Graphs: To use
the values to develop points for the
charts, and to print the charts and
reports.

Introduction

17

utility is used and the SCRATCH utility
control statement is specified with the
VTOC, PURGE, and SYS keywords.
Furthermore, a hierarchy of indexes may
be devised to enable the operating system
to find data sets faster. For example, an
installation may divide its cataloged data
sets into four groups:
SCIENCE, ENGRNG u
ACCNTS, and INVNTRY.
In turn, each of
these groups may be subdivided into groups.
For example, the SCIENCE group may be
divided into groups called MATH, PHYSICS B
CHEM, and BIOLOGY; MATH may be further
divided into ALGEBRA, CALCULUS, and BOOLm
To find the data set BOOL, it is necessary
to specify the names of all indexes of
which it is a part, beginning with the
largest group (SCIENCE), then the next
largest group (MATH), and finally, the data
set
BOOL.
The complete identification
needed
to find the data set BOOL is
SCIENCE. MATH. BOOL.
Data set names may be either unqualified
or qualified. An ~!lg~lified name is a
data set name that is not preceded by an
index name; for example, in the preceding
text, if data sets were not indexed, BOOL
would be an unqualified name. A gualifieQ
!l~m~
is a data set name preceded by index
names representing index levels; for example, in the preceding text, the qualified
name
of
the
data
set
BOOL
is
SCIENCE. MATH. BOOL.
Data set identification may also be
based upon the time of generation. In the
System/360 operating system, a collection
of successive historically related data
sets is called a generation data group.
Some data sets are updated periodically,
or are logically part of a group of data
sets, each of which is created at a different time: for example, a series of data
sets used for weather reporting and forecasting. The data set name for these data
sets might be WEATHER. A generation number
is attached to the data set name to refer
to
a particular generation.
The most
recently cataloged data set is always 0;
the generation before 0 is -1; the generation before -1 is -2; and so on.
The
generations for the generation dat~ group
WEATHER are:
WEATHER (0)

data set that was WEATHER (0) at the
beginning of the job becomes WEATHER (-1),
and so on, and the oldest one is usually
deleted automatically.

In the System/360 operating system, the
output of the (F) compiler is called an
Q!2~£~_!!!od~!.~ (object program)..
The object
module cannot be
executed
until
the
required references to functions and subroutines are resolved (that i~6 identified
for the use of the operating system), and
the object module is put into a format
suitable for loading.
Its external references are resolved by a program supplied
by IBM called the li!l~~g~_edi1QE.
The output of the linkage editor is
called a load module~ However, the input
to the linkage editor may be either object
modules or load modules.
Linkage- editor
execution- can be expanded further: several
object modules and load modules may be
combined to form one load module. The
linkage editor automatically picks out the
library functions and the requested subroutines and inserts them into the
load
moduLe.
The name of the library is specified to the linkage editor by a SYSLIB DD
card.
For example, if the compiled object
module TEST calls subroutines ALPHA and
BETA (which in this example are assumed to
be object modules) and the library function
SIN (a load module), the linkage editor
combines the object modules ALPHA, BETA,
and TEST and the load module SIN to form a
single load module.
A program written in PL/I may call
subprograms written in the assembler language.
An example is given in Appendix D.
After an object module is processed by
the linkage editor, the resulting load
module may be executed.
Therefore# to
execute a PL/I program, a minimum of three
steps is necessary:
1.

Compile the PL/I source program

2.

Process the resulting object module
and any load modules
(which
may
include any PL/I subprograms) to form
a load module

3.

Execute the load module

WEATHER (-1)
WEATHER (-2)
When a new generation data group is
created, it may be called generation +~.
After a job has created WEATHER (+1), the
operating system changes its name to WEATHER (0), if cataloged automatically. The
18

Compiling, link-editing, and execution are
a series of jobs and/or job steps; to the
operating system, each job and job step is
defined by the programmer.

Each compilation,
the linkage editor
execution, and the load module execution
may be defined as separate jobs.
(If this
is done, there is only one job step in each
job.)
However, several single
job steps
may be combined into one job. For example,
all the compilations may be combined.
In
this case, each compilation is a single job
step.
Furthermore, all of the steps,
compilations,
link-editing, and execution may
be combined into one job.
Then each compilation, the linkage editor processing,
and
the execution of the load module are separate steps.
An exception is that a batched
compilation facility (described later) permits more than one compilation within a
single job step.

includes a directory which is used to
locate a particular member.
One of the
uses of partitioned data sets is the storage of load modules.
In fact,
a load
module can be executed only if it is a
member of a partitioned data set.
cataloged data sets and generation data
groups do not have to reside on directaccess devices. A catalog is maintained by
the operating system for cataloged data
sets and generation data groups.
However,
a PDS must reside on a
direct-access
device,
and its members must be sequential
data sets.
The PDS maintains its own
directory of its members.

To further clarify these distinctions,
assume that a ~30urce program MAIN is to be
compiled and executedQ
MAIN requires the
services of two subprograms, SUB1 and SUB2u
and neither subprogram is compiled.
In
this example,
five steps are used to perform the job:
JOB: Multiple
compilations,
editing, and execution

link-

JOB STEP 1 : Compile MAIN
JOB STEP 2: Compile SUB1
J'j,..) STEP 3 : Compile SUB2
JOB STEP 4 : Process
editor

by

linkage

load
JOB STEP 5: Execute
the
module called MAIN

A data set has been defined as a collection of data.
The (F) compiler and linkage
editor are concerned with two types of data
sets, sequential data sets and partitioned
data sets.
A ~3equential_data~~ is a data set in
which the records are arranged to be read
in the sequence in which they are physically stored.
A sequential data set may
reside on any type of volume.
A ~~titi~~Q~ata ~ (PDS) is a group
of members,
each of which has many of the
properties-of a sequential data set,
and
which can be used individually as a sequential data set.
A partitioned data set must
reside on a direct access volume, and it

An installation may have certain procedures to follow in its daily processing.
For example, weather reporting is processed
daily.
To reduce the possibility of error
in the daily reproduction of these
job
control statements,
a cataloged procedure
may be written. A £~~alQg~~_EEQcedure is a
set of EXEC and DD control statements that
are placed in a PDS accessed by the operating system.
The JOB statement cannot be
cataloged.
To describe a job stef an EXEC
statement may invoke a cataloged procedure.
Because EXEC statements may be cataloged,
the cataloged procedure may consist of a
series of steps.
The equivalent of a job
step in a job is called a procedure step in
a cataloged procedure.
Cataloged procedUres cannot be nested; that is, one cataloged procedure cannot invoke another cataloged procedure.
For a job step, a number of data sets
may be defined by the DD statement.
DD
statements may be written in cataloged
procedures.
To simplify the steps involved
in compiling and link-editing, five cataloged procedures have been supplied by IBM
for the PL/I
(F)
compiler.
These five
cataloged procedures and their uses are:
PL1DFC

compilation with deck output

PL~LFC

compilation with object module
output
for
linkage editor
input

PL1LFCL

compilation and link-editing

PL1LFCLG compilation, link-editing* and
execution
PL1LFLG

link-editing and execution
Introduction

19

JOB PROCESSING

To execute a PL/I program three steps
are required:
compilation, processing of
object output by the linkage editor, and
execution of the load module. These steps
all require the use of job control language
statements. A summary of these statements
is given in Figure 1.

r-----------T-----------------------------,
Function
I

I Statement I

~-----------+-----------------------------~
I JOB
I Indicates the beginning of I
I
I a new job
I
~-----------+-----------------------------i
I EXEC
I First statement for each
I
I
I job step. It indicates the I
I
I
I cataloged procedure or
J program to be executed
I
I
~-----------+-----------------------------i
I DD
I Describes data sets and
I
I
I controls device and volume I
I
I assignment
I
~-----------+-----------------------------i
I delimiter I Used, when data is included I
I in the input stream, to
I
I (/*)
I
I separate data from subI
I
I sequent control statements I
~-----------+-----------------------------i
I null (II) I Marks the end of the last
I
I _____________________________
job in an input stream
LI ___________ L
JI
Figure 1.

Job Control Language Statements

If data is included in the input stream,
the data cards must normally be preceded by
a DD * statement (e.g.,
SYSIN DD *) and
followed by a delimiter statement, although
these are not always necessary when operating with a priority scheduler. For full
details,
refer to the publication 1~~
§~~em/360_Qe~~~igg __ §ystem,
Job Control
Lang£~g~.

Job processing can often be simplified
by using the cataloged procedures described
1n this chapter and in Appendix E of this
publication.

The names for DO statements (ddnames)
connect 1/0 statements in the compiler with
data sets used by the compiler. Names for
1/0
device classes have also been established and must be used by the programmer.
The program name for the compiler is IEMAA,
so that if the compiler is to be executed
in a job step, the parameter PGM=IE~~ must
be used in the EXEC statement. Normally,
20

however, the parameter would appear on
EXEC card within a cataloged procedure.

an

If the compiler is to be dynamically
invoked by the CALL, LINK, XCTL, or ATTACH
macro instructions, details of the method
to be used will be found in Appendix F.
COMPILER DONAMES
The (F) compiler uses a maximum of seven
standard data sets. Each data set has been
assigned a specific ddname in order to
establish communication between the compiler and the programmer. Each data set is
given a specific function which must meet
device requirements for the PL/I (F) compiler. The ddnames l functions, and device
classes for the data sets are given in
Figure 2. These ddnames ~~~~ be specified
as ddnames for compiler DO statements, and
must correspond to the function listed in
Figure 2.
The requirements for each data
set designate which type of inputloutput
device must be used for the data set. In
additLon to the seven standard data sets,
each data set explicitly referenced in a
compile-time INCLUDE statement must also
have a corresponding DD statement. The
device requirements for these data sets are
the same as for the SYSLIB data set.
To compile a PL/I program on the (F)
compiler, two of these data sets are necessary: SYSIN and SYSPRINT, along with the
direct-access
volume that contains the
operating system.
With these two data
sets, only the listing is generated by the
compiler, If an object deck or a MACDCK
deck is to be provided, a SYSPONCH DD
statement must be specified. If the object
module is to be written, a SYSLIN DD
statement must be supplied.
SYSUT1 is
always
required
if
the
SIZE option
(explicitly or by default) specifies a
value less than 53,248. With higher values
of SIZE, the SYSUT1 data set is used only
when the source program and internal tables
cannot be wholly contained in main storage.
The table of space requirements for SYSUT1
(see "Compiler Device Classes") is a guide
to when the data set will be used.
For
practical purposes* however, it is advisable to include the DO statement for SYSUT1
as a matter of course. SYSUT3 is used for
compile-time processing, and for programs
using the 48-character set. SYSLIB is used
for compile-time processing of
INCLUDE
statements in which a ddname is not explicitly specified.

r-----------T-----------------------T-----------------------------------,
ddname
I
Function
I
Possible
I

I
I

I
I
Device Classes
I
~-----------+-----------------------+-----------------------------------~
I SYSIN
I Source Input
I SYSSQ, the input stream device
I
I
I
I (specified by DD *), or paper tapel
I
I
I reader
J
I
I SYSPRINT
I
I S~SPUNCH

I
I Listing Output
I
I Deck and MACDCK

I
I SYSSQ, or SYSOUT device
1
I SYSCP, SYSSQ

I
I
I
I

1

I output, or SYSOUT
I (punch) device

I

I

I
1
I SYSLIN

I
J
I
I
I
I Object Module Output I SYSSQ
I
I
I
I
SYSUr1
I Auxiliary Storage for I SYSDA
I
I
I
I Text and Dictionary
I
I
I
SYSUr3
I Auxiliary Storage for I SYSSQ
I
I Compile-Time Process- I
I
I ing and 48-Character I
I
I Syntax
I
I
I
I
J
SYSLIB
I Default input for
I SYSDA
I
I compile-time INCLUDE I
J
statements
I ___________________________________ JI
___________ LI _______________________
~

Figure 2.

Input/Output Data Sets

r------------T------------------------------------"-----T-----------------------------,
Class Function
I
Device Type
I

I Class Name I

r------------+-----------------------------------------+-----------------------------~
I
SYSSQ
I Writing, reading
I Magnetic tape, DASD
I
~------------+-----------------------------------------+-----------------------------~
I
SYSDA
I Writing, reading, updating records in
I DASD
I
I
I
I
I place
~------------+-----------------------------------------+-----------------------------~
I
SYSCP
I Intermediate or ultimate device for
I Card punch, magnetic tape
I
I ____________ I ________________________________________
punched cards
I _____________________________
DASD
L
J1
~_.

Figure 3.

~

Device Class Names

For the DD statements SYSIN, SYSPUNCH,
or SYSPRINT, an intermediate storage device
may be specified instead of the card reader, card punch, or printer, respectively.
If an intermediate storage device is
specified for SYSIN, the compiler assumes
that the source program deck was placed
there by a previous job or job steps.
If
an intermediate storage device is specified
for SYSPRINT, the listing and diagnostic
messages are written on the device; a new
job or job step can print the contents of
the data set. Similarly, if an intermediate storage device is specified for SYSPUNCH,
the card deck is written on that
device, and another job or job step will be
needed to punch the card deck.
Under the
MVT system, this can be done automatically
by specifying a SYSOur data set.

COMPILER DEVICE CLASSES
Names for input/output device classes
used for compilation are specified to the
operating system at system generation time.
The usual class names, functions, and types
of devices are shown in Figure 3.
The data sets used by the compiler must
be assigned to devices eligible for the
classes listed in Figure 2.
It should be noted that a direct-access
storage device may be used for all compiler
devices.
The SPACE parameter in the DD
statement must be used if there is a
possibility that the data set will be
written on a direct-access device.

Job Processing

21

For
most
practical situations,
the
values used in the SPACE parameters of the
data sets defined in the cataloged procedures in Appendix E will be adequate.
However,
typical space requirements for
various data sets can be calculated from
tne following information (All values given
are in bytes):

r----T------T-----------------------,
I
I
INO. of tracks required 1
I SN I SIZE r-------7-------T-------~
I
1
1 2311 1 2301 1 2321 1
~----+------+-------+-------+-------~
1
1 44K 1
8 I
4 I
22 I
24* I
I
I
1
I
I
I
~------+-------+-------+-------~
I

IR = number of input records (i.e., number of records containing source
text + number of records included
through
the compile-time INCLUDE
statement).
SR

SN

number of records containing source
statements after compile-time time
processing is completed.
number of source statements after
compile-time processing is completed.

VN

of

numb~r

variables

used

in

the

program.

150 I 100K

I

0

I

0

I

0 1

I

t------+-------+-------+-------~

I

I

200K

I

0

I

0

I

0

I

~----+------+-------+-------+-------~

I

1

1

92 I
97* 1

I 5 00 1 100K 1
1
1
I

18 1
22*1

9 I
11*1

27 I
33*1

I

I
1

1

I

I
1

44K

I

31

I

14

J

~------+-------+-------+-------~

~------+-------+-------+-------~

1 200K 1

0 I

0 1

0 I

r----+------+-------+-------+-------~

44K 1
1

64 I
1

1
1

1

r------+-------+-------+-------~

I

t------+-------+-------+-------~

110001 100K 1
1
1
1

68 1
74*1

28 1
1

192 I
202*1

1
1

34 1
37*\

102 1
111*1

\
1 200K 1
15 1
9 1
27 1
1L ____ L1______ L1_______
20*1L _______
12*1L _______
28*1J

* EXTDIC option specified
Space required =
120x( IR
+
+

SR

10xSN

+

+

VN

+

VN
30)

if SOURCE2 op~ion
is specified
if SOURCE option
is specified
if LIST option is
specified
if ATR option is
specified
if XREF option is
specified
bytes if EXTREF option
is specified

Space required = 80 x SN bytes

Source programs which are large enough
to cause the SYSUr1 data set to be used
will compile more efficiently if this
data set resides on a drum or in a
contiguous area on a disk.

Since it is not advisable to use
EXTDIC if SIZE=44K, the figures for this
value must be taken as applying to a 48K
capacity.
22

Space required for 48-character set processing
2 x SR x (average record
length) bytes

Space

required
for
compile-time
processing = size of program after
compile-time processing

Space

required for both 48-character set
and
compile-time
processing =
2 x (size of program after compiletime processing

These formulas give only approximate
answers, in that considerable variation
may result from the nature of individual
source
programs.
The figures given
should provide adequate space in most
cases. The secondary allocation facility
should be used as a protection against
exceptional requirements.

Record parameters on this data set
depend on whether the MACRO or the CHAR48
option is used.

If the MACRO option is specified (with
or without the CHAR48 option), SYSUT3
will be opened with the following parameters:
Record format:

F(available size < 56K)
FB(available size 2 56K)

Recorc1 size:

80 bytes

Blocking factor: 1 (available si~e < 56K)
2(available size 2 56K)
For available size, see 'SIZE Option'.

Of the 44K bytes minimum storage necessary for the F compiler, 1000 bytes are
reserved for two SYSIN buffers, so that the
SYSIN block size can always be up to SOO
bytes (i.e., the size of one SYSIN buffer).
A block size greater than SOO bytes is
allowed if the extra storage necessary for
the SYSIN buffers is available in the
amount of storage requested in the SIZE
option (i.e., SIZE must be at least 44K1K + 2 x block size). If the SIZE option
does not allow for 4~OS6 bytes more than
the additional storage required by the
SYSIN buffers, compilation will be terminated.

If the CHAR48 option (but not the
MACRO option) is specified~ SYSUT3 contains a CHAR48 and a CHAR60 copy of each
source record. It is opened wi t.h the
following parameters:
Record format:

F(available size < 56K)
FB(available size 2 56K)
U(if SYSIN record format
is U)

Record size:

SYSIN record length

Blocking factor: 1 (available size < 56K)
2(available size 2 56K)
For available size., see 'SIZE Option.'
Data set:.

Write-yerifLlQ~2D)

The Write Verify option for DASD is not
fully supported for SYSUT1.
Although the
Wri te VE~rify may be requested by specifying
OPTCD = W in the DCB for SYSUT1, not all
the data blocks written on this data set
will in fact be verified. Specifying the
OPTCD parameter results in write verification only when a new dictionary or text
block is written on the device; reuse of
this block will not result in verification
of the data written.
The Write Verify feature is always available for use with a data block on other
data sets on direct-access devices, and is
obtained
by specifying the appropriate
option on the data set DD card.
(See
'supervisor and Data Management Services~)

The compiler allows the programmer to
request blocked output on SYSPRINT, SYSPUNCH and/or SYSLIN by specifying a BLKSIZE
parameter on the appropriate DO card.
Of the 44K bytes minimum storage necessary for the F compiler, 2S8 bytes are
reserved for two SYSPRINT buffers (129
bytes each), 400 bytes are reserved for the
SYSPUNCH buffer, and 400 bytes are reserved
for the SYSLIN buffer. Thus when SIZE=44K,
SYSPRINT block size must be 129 bytes and
SYSPUNCH and SYSLIN block sizes can be up
to 400 bytes.
Greater block sizes than
these are allowed if extra storage for
larger buffers is specified in the SIZE
option.
(See next section "Calculations
for Storage Requirements.")
If the SYSPUNCH block size or the SYSLIN
block size is greater than 400 bytes and
the SIZE parameter is not great enough to
accommodate it, then the corresponding compiler options will be deleted.
SYSPRINT block size must be of the form
(4 + n x 12S) bytes.
If the SIZE option
does not allow for 4S056 bytes more than
the additional storage required by the
SYSPRINT buffers, compilation will be terminated.
The E-Ievel Linkage Editor cannot accept
blocked input, so the compiler
output
should be blocked only if the F-Ievel
Linkage Editor is in use.

BLOCKING OF COMPILER INPUT AND OUTPUT
Blocking of ComEiler Ineut

Calculations for

The compiler allows the programmer to
request blocked input on SYSIN (other than
SYSIN DO DATA or .) by specifying a BLKSIZE
parameter on the appropriate DD card or by
obtaining the block size from the data set
label (see Appendix A, ftCompiler Input ft ).

Storage requirements for blocking compiler input and output should be based on
the following:

Storagg-E~~i!~m~~~

44K is needed for the compilation,
this

and

Job Processing

of

23

1000 bytes are saved for two SYSIN
buffers (500 bytes each)
258 bytes are saved for two SYSPRINT
buffers (129 bytes each)
400 bytes are saved for the SYSPUNCH
buffer
400 bytes are saved for the SYSLIN
buffer
If

If

SYSIN block size is greater than 500
bytes then (2 x SYSIN block size - 1K)
is subtracted from the storage specified by SIZE.
SYSPRINT block size is greater than 129
bytes then (2 x SYSPRINT block size258)
is subtracted from the remaining
storage.

If SYSPUNCH block size is greater than 400
bytes then (SYSPUNCH block size - 400)
is subtracted from the remaining storage.
If

SiSLIN block size is greater than 400
bytes then (SYSLIN block size 400)
is subtracted from the remaining storage.

COMPILER OPTIONS
A number of compiler options are available to the programmer. These may be passed
to the compiler through the PARM parameter
on the EXEC card at compilation time.
Included in the information that may be
specified to the compiler are the following
items:
The amount of main storage allocated to
the" compiler for this compilation
The number of lines to be printed on
each page of the source listing
Whether a source program listing is
be printed

Whether an object program listing is to
ne printed
Whether a list of the compiler options
specified for the program is to be
printed.
Whether a listing of the External Symbol Dictionary (ESD) is to be provided
Whether a list of the attributes
identifiers is to be provided

The storage that finally remains must be
equal to or greater than 44K.

SYSPUNCH/SYSLIN in Batched Compilations

to

of

Whether a list of cross-references to
identifiers is to be provided
Whether the compiler is to produce an
object module for input to the linkage
editor, output either as a data set on
SYSLIN, or SYSPUNCH, or both, as the
user requires

Once SYSPUNCH or SYSLIN has been opened,
it is left open and buffer space is allocated for all subsequent compilations in
the batch, whether or not there is any
SYSPUNCH or SYSLIN output for those compilations.

Whether the compiler is to produce the
linkage editor control statement NAME
to follow either the object module or
the onject program deck

If SYSPUNCH or SYSLIN block sizes greater than 400 are asked for, the extra space
needed for the larger buffers will be
subtracted from the SIZE specified for each
compilation in the batch before calculating
the text and dictionary block sizes.
In
some cases, compilations which do not have
SYSPUNCH or SYSLIN output may be allocated
smaller text and dictionary block sizes
than they would otherwise get if they
follow a compilation which opened SYSPUNCH
or SYSLIN. If SYSPUNCH or SYSLIN has been
successfully opened with a big block size
and
a
following compilation specifies
SIZE < (44K + extra buffer space needed),
this will be ignored and SIZE = (44K +
extr~ buffer space needed) will be assumed.

Whether
EBCDIC

24

The level of optimization required
the

source

code is in BCD or

The specification of source margins and
the specification of a carriage control
character for the source program listing
The choice of 48- or 60-character set
for source programs
Whether diagnostic messages produced
during execution are to include statement numbers from the source program
The choice of severity level at which
diagnostic messages will be printed

Whether compile-time
required

processing

is

Whether a compile-time processor input
listing is to be printed
Whether compile-time processing
be followed by compilation
Whether
be used

the

is

to

extended dictionary is to

Whether a nesting block level is to be
printed next to each statement number
Whether a sequenced card deck is to be
punched as the macro-processor output
Whether the object program is to
executed on a System/360 Model 91

be

r------------------T------------T---------,
I
Compiler
IAbbreviated IStandard I
I
option
I
name
1default I
~------------------+------------+---------i
\SIZE=yyyKlyyyyyy I
SIZE
1999999
I
ILINECNT=xxx
I
LC
150
I
ISOURCEINOSOURCE
I
SINS
I SOURCE
I
ILISTINOLIST
I
LINL
I NOLIST
I
IOPLISTINOOPLIST
I
OLINOL
\OPLIST
I
IEXTREFjNOEXTREF
I
EINE
INOEXTREF I
IATRINOATR
\
AINA
1NOATR
I
IXREFINOXREF
I
X\NX
I NOXREF
I
IDECKINODECK
I
DIND
I NODECK
I
ILOADINOLOAD
I
LDjNLD
I LOAD
\
IOBJNM=aaaaaaaa
I
N I N o actionl
\ OPT=nn
I
0
I 01
I
IBCDJEBCDIC
I
BlEB
I EBCDIC
I
ISORMGIN=(mmm,nnn[, I
SM
1(2,72)
I
I
ccc] )
I
I
I
\CHAR 60 ICHAR48
I
C60lC48
ICHAR60
I
ISTMTINOSTMT
I
STINST
I NOSTMT
I
IFLAGWIFLAGElFLAGS I
FWIFEIFS IFLAGW
I
IMACROINOMACRO
J
M\NM
1NOMACRO \
!SOURCE2!NOSOURCE2 I
s21 NS 2
ISOURCE2
I
ICOMPINOCOMP
I
CINC
ICOMP
I
IEXTDIC!NOEXTDIC
I
ED1NED
INOEXTDIC]
INESTINONEST
I
NT]NNT
I NONEST
I
IMACDCKINOMACDCK
I
MDINMD
INOMACDCK I
M91 J NOM91
I ____________ LI _________
NOLV191
lI __________________
JI
~

The list of compiler options following
the equals sign in the PARM parameter must
be enclQsed in quotation marks; the separate options are separated by commas.
The
list must not exceed 40 characters including commas,
but excluding the quotation
marks. Because of the 40 character limitation, the compiler has been designed to
accept
the abbreviated compiler option
names given in the table below, as alternatives to the longer mnemonics.
Where an
option includes a numerical specification,
as in SIZE, LINECNT, OPT, and SORMGIN, only
significant digits need be specified by the
user.
There is no required order for
specifying the compiler options,
but if

conflicting options are specified the last
specification in the list will be used.
The default for all options (except OBJNM)
can be set at system generation time to
suit the requirements of the installation.
In the absence of any such setting, the
standard defaults shown in the table below
will be effective. The DELETE parameter of
the system generation PL1 macro instruction
(described
in
the
publication
IEM
§y~te~Ll~Q ___ QEerating
systemL__ ~~!~~
Generation) may be used at system generation time to specify any compiler options
not to be used at compilation time.
SIZE=yyyyyylyyyKl999999 - The SIZE option
indicates to the compiler the amount
of main storage (in bytes) available
for the compilation.
The programmer
specifies this amount as one of the
following:

yyyyyy: This gives the number of bytes
available for the compilation.
For
blocked input, the amount yyyyyy must
be
greater than 45056 + (2*SYSIN
BLKSIZE if BLKSIZE>500) + (2*SYSPRINT
BLKSIZE if SYSPRINT is blocked).
If
it is not, the compiler will terminate
abnormally. For unblocked input, if
the amount yyyyyy is less than 45056,
the default size is taken.
This gives the number yyy of K
units
(K = 1024 bytes) available for
the compilation.
If the number of
bytes specified is less than 44K, a
message is printed and the default
size is taken.

yyy~:

299222: This instructs the compiler to
obtain as much main storage as it can.
If this amount is less than 44K, the
compiler will comment and then will
attempt to continue; later it may
terminate
abnormally.
Because the
compiler calculation of the amount of
storage available is only an approximation, SIZE=999999 should not be used
if the amount of storage available is
less than 48K.
The partition (MFT) or region (MVT) in
which the compilation step is executed
must be at least 8K larger than the
amount specified in the SIZE option.
Failure to ensure this may result in a
system abnormal termination before the
compiler can provide any diagnostic
aid.
The following table shows the text and
dictionary block sizes used for various
core availabilities as specified by the
SIZE option.
The available size is the
amount specified in the SIZE option minus
the extra space needed for larger input and
output buffers.
The text and dictionary
Job Processing

25

block sizes are determined from the amount:
available after any extra storage needed
for larger input/output buffers has been
subtracted from the amount specified in the
SIZE option.
r-------------------~------------,

I
I

Available Size
(bytes)

I Block Size I
I (bytes)
I

r-------------------t------------i
1 45,056 - 57,343 I
I
~,024

I 57,344 - 73,727 I
2.048
I
I 73.728 - 135,167 I
4.096
I
! 135,168 - 172,031 I
8,192
I
~72,032 or more
1____________
16,384
lI ___________________
JI
~

LINECNT=xxx - the LINECNT option informs
the compiler how many lines are to be
printed on a page of listing. The
number
specified
includes heading
lines and blank lines. If a number is
not specified. a standard default of
50 lines is assumed.
SOURCE
or
NOSOURCE
(Source
Program
Listing) - the SOURCE option specifies
that the source program is to be
written on the device indicated on the
SYSPRINT DD card. The source listing
is in the same character set as the
source records. rhe statement number
of the first statement in each line is
printed to the left of that line. but
a statement number is not given on a
line
containing
only a continued
statement. NOSOURCE indicates that no
source listing is required. If ne~~h­
er option is specified, the compiler
assumes the standard default SOURCE.
A description of the listing is given
in the section called "Compiler Output."
LIST or NOLIST (Object Program Listing) the LIST option specifies that generated machine instructions are to be
listed in a format resembling the
listing
output
of
the operating
system/360 assembler program.
(This
output is not suitable for use as
input to the assembler.)
Each line
contains the location counter value
and text in hexadecimal, the mnemonic
symbol for the operation code, and a
variable field in assembler language
format.
Source program identifiers
are used wherever possible, and comments are inserted to assist in correlation with the source program. When
the LIST option is specified, a STATIC
INTERNAL storage map is also printed.
The NOLIST option indicates that no
object
program
listing or STATIC
INTERNAL storage map is to be provid-'
ed.
If no option is specified, the
~tandard default. NOLIST,
is assumed
by the compiler. A description of the
26

object program listing is given in the
section called "Compiler Output."
OPLIST or NOOPLIST - the OPLIST option (the
standard default) causes the list of
compiler options to be printed.
The
NOOPLIST option provides that no such
list shall be printed.
EXTREF or NOEXTREF (External Listing) - the
EXT REF option causes a listing of the
external symbol dictionary (ESD) to be
provided.
The NOEXTREF option specifies that no listing is required and
is the standard default assumed if no
option is specified. A description of
the ESD listing is given in the section called "Compiler output."
ATR

or NOATR (Attribute Table) - the ATR
option gives:
~.

A table showing.
tifier:

fOE

each

~den­

Statement number of the statement
in
which
the
identifier
is
declared
Identifier
structures

and

all

containing

A list of attributes pertaining to
the identifier
2.

A listing showing the length. in
bytes, of every aggregate (array
or structure> variable declared or
allocated with fixed extents within the program.

The list of identifiers is sorted, ignoring the qualification. The NOATR option
specifies that no listing is required and
is the standard default assumed if no
option is specified. A description of the
attribute listing is given in the section
called "Compiler Output."
XREF

or NOXREF (Cross Reference Table) the XREF option produces output showing, for each identifier:
Statement number of the statement
in
which
the
identifier
is
declared
Identifier
structures

and

all

containing

List of all statements in which a
reference is made to the identifier
The list of identifiers is sorted,
ignoring the qualification. The NOXREF option indicates that no cross
reference listing is required~ and is

to the user.
The decimal integer
constant
(nn)
indicates the level
required.
The choice depends upon
whether the prime concern of the user
is
execution speed or object-time
storage space.

the standard default assumed if no
option is specified. A description of
the listing is given in the section
called "Printed Listings."
DECK or NODECK (Object Program Deck) - the
DECK option specifies that the compiled
program
(i.e.
the object
module) is to be output in the form of
a sequenced card deck in linkage editor format.
The data set is defined
by a SYSPUNCH DO statement.
No job
control statements,
(DD cards, etc.)
are generated by the compiler. NODECK
specifies that no object program deck
is required; if NODECK is specified,
the
DD statement SYSPUNCH is not
required. If no option is specified,
the standard default,
NODECK,
is
assumed. A description of the deck is
given in the section called "Compiler
Output."
LOAD or NOLOAD (Object Program output) the LOAD option causes object program
output to be produced as a sequential
data set defined by a SYSLIN DD statement in standard linkage editor input
format.
NOLOAD specifies that no load
module is to be created.
LOAD is
assumed as the standard default if no
option is specified.
If NOLOAD is
specified, the DO statement SYSLIN is
not required.

OPT=OO: in this case, the object-time
storage requirement is kept to a minimum.
OPT=01: in this case, the execution
speed is improved at the expense of
object-time storage space.
The difference in the compilation time
for the two options is negligible.
The standard default assumption if
neither is specified is OPT=01o
BCD

or EBCDIC Source Code - the BCD or
EBCDIC option allows the programmer to
state in which character code his
source program is punched. The BCD
and EBCDIC punched card codes and
graphics for the PL/I 60-character set
are shown in Figure 4. If neither
option
is specified, the standard
default assumption is EBCDIC.

SORMGIN=(mmm,nnn[,ccc]) - the source margin
option allows the programmer to specify:
mmm,nnn - margin for source statements

OBJNM=aaaaaaaa - this option causes the
compiler to produce the linkage editor
control statement NAME following either the object module, the object program deck, or both. If neither LOAD
nor
DECK
has
been
specified
(explicitly or by default), the use of
this option will have no effect.
The
NAME statement produced will be of the
following form:
l:?Q§'!l~1.

2NAMEQaaaaaaaa(R)
where aaaaaaaa represents the name
given, which may have up to eight
characters n and 2 represents one or
more blanks.

ccc - carriage control character position (optional)
The values for these arguments
subject to the constraints:
1.

mmm

2.

ccc must be
(mmm, nnn).

OPT=nn
(Optimization) - two alternative
levels of optimization are available

nnn

$

100
outside

the

range

The carriage control characters are:
b

Skip one line before printing

+

Skip three lines before printing
Suppress space before printing
Skip to Channel 1 (i.e. start
new page>

o Skip two lines before printing

1
Care should be taken when using this
option in conjunction with cataloged
procedures, otherwise the program name
used in the EXEC statement will be
incorrect.
The principal purpose of
this option is to enable the user to
create a partitioned data set of load
modules from a series of batched compilations, by means of the linkage
editor.

$

are

If the source margin is not specified,
a standard default of SORMGIN~(2,72)
is assumed.
The compile-time processor produces output requiring margins (2,72)
and
changes
SORMGIN
accordingly.
The default value for
the
carr1age control character is
installation-defined,
that is, the
user must decide at system generation
whether a default is required and what
it is to be.
Job Processing

27

r------------~---------------T------------'---T------------T---------------T-------------1

I
I

BCD
I
EBCDIC
I Punched
I
BCD
I
EBCDIC I
~-------T-------+-------~----·---i
~-------r-------+-------r-----+
, Card Code I Graphicl PL/I ,Graphicl Pl/I
I Card Code IGraphicl PL/I I Graphic I PL/II
~------------+-------+-------+-------+----.---+------------+-------+-------+-------+-----~
I No punches
I
12-7
GIG
G
G
I 12-8-3
I
12-8
H
I
H
H
H
I 12-8-4
»
J
<
<
12-9
I
I
I
I
I
, 12-8-5
[
%
I
(
(11-1
J
J
J
I 12-8-6
<
<]
+
+
11-2
K
I
KKK
I 12 - 8 - 7
.'
I
I
I
11- 3
L
ILL
L
I 12
& +
+
&
&
11-4
M
I
M
M
M
I 11-8-3
$
$
$
$
11-5
N
INN
N
I 11-8-4
*
*
*
*
11-6
0
I
0
0
0
I 11-8-5
&
11-7
PIP
P
P
I 11-8-6;
11-8
Q
I
Q
Q
Q
I 11-8-7
!J.
11
1'1
11
1 ~-9
R
I
R
R
R
I 11
0-2
SIS
S
S
I 0-1
/
/
/
/
0-3
T
T
T
T
J 0-8-3
,
,
,
,
0-4
U
U
U
U
I 0-8-4
% (
(
%
%
0-5
V
V
V
V
I 0-8-5
"i
0-6
W
W
W
W
I 0-8-6
,
#
>
>
0-7
X
X
X
X
I 0-8-7.
??
0-8
Y
Y
Y
Y
I 8-2
b
@
0-9
Z
Z
Z
Z
I 8-3
#-=
#
#
0
0
0
0
0
I 8-4
@ I
@
@
1
1
1
1
1
I 8-5
2
2
2
2
2
1 8-6
>
>
3
3
3
3
3
, 12-0
??
4
4
4
4
4
I 12-1
A
A
A
A
5
5
5
5
5
1 12-2
B
B
B
B
6
6
6
6
6
I 12-3
C
C
C
C
7
7
7
7
7
I 12-4
D
D
D
D
8
8
8
8
8
I 12-5
E
E
E
E
9
9
9
9
9
12-6
F L_p
F
FLF
l, ____________
LI
_______
_____ LI
_______
_______ L ____________ L _______ LI _______ L _______ LI _____ J
Punched

I

J,

Figure 4.

BCD and EBCDIC Punched Card Codf:s and Graphics for PL/I 60-character Set

CHAR60 or CHAR48 - this option allows th.:
source language to be written in one
of two
character
sets:
60or
48-characters.
The standard default
assumed
if
no
character set is
specified is the 60-character set.
Note that all characters
in
the
60-character set are acceptable to thl:
compiler,
even when the CHAR48 option
has been selected. However, there are
two points to be borne in mind by
anyone intending to use 60-character
set input after selecting the CHAR48
option.
Firstly, the restrictions of
the 48-character set must be observed
in
the
60-character
set
input.
otherwise errors may result. Secondly, such a mode of operation is inefficient, and should not, therefore, be
made a general practice.
STMT

28

or NOSTMT - the STMT option specifies
to the compiler that extra code is to
be produced which will allow diagnostic messages printed during execution of the compiled program to contain statement numbers from the sourCf~

program, in addition to offsets relative to PL/I entry points; these offsets alone are given if NOSTMr is
specified.
The
standard
default
assumed if no option is specified is
NOSTMT.
Note: The average PL/I program can be
executed without significant degradation in speed or space requirements.
However., the use of the STMr option
will cause both the execution time and
the object-code space requirements to
increase in direct proportion to the
number of statements in the program.
The benefits obtained as a result of
the debugging aid that this option
gives, should offset and justify these
increases.
FI.AGWIFLAGEIFLAGS - a high level of diagnostic capability is available in the
(F) compiler. Compile-time processor
diagnostic messages are written after
the SOURCE2 listing and before the
source program listing.
All other
diagnostic messages are written in a

group following the source program
listing.
In both cases, messages are
listed in order of their severitye
There are four classes of diagnostic
messages, which are graded in order of
severity:
Specification
warning (lowest)

FLAGW

error

FLAGE

severe error

FLAGS

terminal error (highest)
A ~~f~!~g is a message that calls attention to a possible error, although the
statement to which it refers is syntactically valid. In addition to alerting the
programmer, it may assist him in writing
more efficient programs in the future.
An Error message describes an attempt to
statement; the programmer is informed of the correction.
Errors do not normally terminate processing
of the t:ext.
correc~-~~-erroneous

A Severe error message indicates an
error whIch cannot be corrected by the
compiler. The incorrect section of the
program is deleted, but compilation is
continued.
Where reasonable, the ERROR
condition will be raised at object time, if
execution of an incorrect source statement
is attempted. If a severe error occurs
during compile-time processing, compilation
will be terminated after the SOURCE listing
has been produced.
A rerminal error message describes an
error whIch;-when discovered, forces the
termination of the compilation.
The choice of the severity level at and
above which diagnostic messages appear on
the output is an option which may be
selected
by the programmer.
FLAGW is
assumed if no level is specified.
A source program message consists of the.
(F) compiler's identification code (IEM)
followed by a number which is unique to
this message. Where applicable, the statement number to which the message refers is
given .next. The message then follows.
It
will normally refer to the number of the
statement which has produced the diagnostic
message with the number corresponding to
that on the source program listing. It may
also contain a numeric parameter, a source
program identifier, or a segment of source
program text. During compile-time processing, messages will contain input line numbers, source text identifiers, or segments
of source text.

IEM0096I 23 SEMI-COLON
NOT
FOUND
~HEN
EXPECTED IN STATEMENT NUMBER
23. ONE HAS BEEN INSERTED.
A detailed list of diagnostic messages
is given in Appendix G of this publication.
MACRO or NOMACRO - the MACRO option indicates that compile-time processing is
required. The NOMACRO option causes
the compile-time processor
to
be
bypassed.
If no option is specified,
the
compiler assumes the standard
default NOMACRO.
SOURCE2 or NOSOURCE2 - the SOURCE2 option
indicates that the input
to
the
compile-time processor is to be listed
on the device indicated on the SYSPRINT DD card. The SOURCE2 listing is
in the same character set as the input
text. Each line is preceded by a line
number.
NOSOURCE2
suppresses the
listing
of
compile-time processor
input. If no option is specified, the
compiler assumes the standard default
SOURCE2. If MACRO has not been specified, the SOURCE2 option is ignored.
COMP

or NOCOMP - the COMP option specifies
that compilation is to proceed after
compile-time processing has been completed.
NOCOMP specifies that compilation is not required.
If neither
option
is specified, the compiler
assumes the standard default COMP. If
MACRO
has
not
been
specified,
COMPINOCOMP is ignored.

EXTDIC or NOEXTDIC - The EXTDIC option provides a compiler dictionary with a
capacity 1.5 times that of the normal
dictionary if the block size is 1K
bytes, and 3.5 times that of the
normal dictionary if the block size is
greater than 1Ko This allows successful compilation of some larger programs that would otherwise overflow
the dictionary capacity. As the use
of EXTDIC reduces compilation speed,
it should be specified only when the
program will not compile with the
normal dictionary.
The default is
NOEXTDIC.
Programs that are large enough to
require the EXTDIC option will compile
very much more efficiently if a large
storage size is available to the compiler. Enough storage should be specified, if possible, for the dictionary
to be held in storage throughout the
compilation. As a rough rule, the
SIZE option should allow about 100,000
bytes plus 75 times the number of
identifiers in the source program.
Job Processing

29

EXTDIC
should
not
SIZE<47104 bytes.
NEST

be

used

terminated and, if the
SOURCE
option has been specified, a listing of the PL/I program text produced by the compile-time processor will be printed

if

or NON EST If NEST is specified, a
number is printed under the heading
LEVEL showing the depth of blocknesting for the first statement on
each line of the
source
program
listing, and a number is printed under
the heading NEsr showing the depth of
DO-group nesting for such statements
which are contained within DO groups.

MACDCK or NOMACDCK - The MACDCR option
causes the output records of the macro
processor to be written on SYSPUNCH as
sequenced card images. rhe default is
NOMACtJCK.
M91 or NOM91 - the M91 option must be specified when the object program is to be
executed on an IBM System/360 Model
91. This option may be specified in
the PARM field of the EXEC card at
compilation time or it may be set
during system generation time. The
standard default for this option is
NOM91.

16

Terminal error messages issued;
compilation terminated abnormally;
successful execution impossible

JOB CONTROL PROCEDURE FOR COMPILATION
An example of a job control procedure
showing the job control cards and deck
required for a compilation is shown below.
IIJOB1
IISTEP 1

JOB
EXEC

Code

30

o

No
diagnostic messages issued;
compilation
completed
with no
errors;
successful
execution
expected

4

Warning messages only issued; program compiled; successful execution is probable

8

Error messages issued; compilation
completed, but with errors; execution may fail

12

Severe error messages issued; compilation may be completed,
but
with errors; successful execution
improbable.
If a severe error
occurs during compile-time processing, the compilation will be

PGM=IEMAA" PARM=
'options'

IISYSPUNCH DD

SYSOUT=B

IISYSPRINT DD

SYSOUT=A

/ISYSUT1

DD

UNIT=SYSDA,
SPACE=(1024, (60, 60}),
SEP=(SYSPRINT,
SYSPUNCH)

IISYSIN

DD

*

COMPLETION CODES FOR THE COMPILER
At the end of compilation, the compiler
returns a completion code to the operating
system indicating the degree of success
achieved in compilation of the source program and anticipated in execution of the
object program. rests of this code may be
requested on the JOB and EXEC cards of the
job control language, allowing later steps
of a job to be suppressed if compilation
has not achieved the required degree of
success.
The compiler completion codes
are:

123,JOHNSMITH,
MSGLEVEL=1

(Source Program Deck)
/*

A facility is available which allows
more than one external procedure to be
compiled within the same job step. This is
achieved by preceding the second (and each
subsequent) compilation by a control record
of the following form:

*

PROCESS('options'):

The first character of the record is an
asterisk. which must appear in column 1.
It denotes the end of the preceding source
deck.
Note that if SORMGIN=(1.72) has been
specified, this facility is obtained only
when there is an asterisk in column 1 and
the first non-blank character string is
PROCESS.
Any number of spaces, or no space,
is
acceptable between the asterisk and the
keyword
PROCESS.
Spaces are permitted
between:

1.

2.

The keyword PROCESS
list delimiter
T Ie option
o itions

list

and

the

delimiter

option

and

//BTCHCP

JOB

//STPCMP

EXEC

the
//PL1L.SYSIN

DD

PL1PROG,MSGLEVEL=1
PROC=PL1LFCL,
PARM.PL1L='LOAD,
NODECK,OBJNM=BATCHA'

*

!

3.

T ,e option
s lmi-colon

list

delimiter

and

source program one

the

Opt ',ons in the list are separated by
commas, as in the PARM field on the EXEC
card.
The options to be listed are the compiler op ,ions to be used in compiling the
source deck that follows.
If any option is
not Ii ted, the installation default is
assume I; there is no carry-over of the
option listed on the preceding EXEC card.
If th' us er dOes not wish to specify any
option explicitly, he can simply place the
termin :ting semicolon immediately after the
word P 'OCESS. The number of characters in
the 0 ~ion list is limited only by the
length of the record, and may exceed 40
characers.

*

PROCESS('LOAb,ATR,NODECK');
source program two

*

PROCESS('LOAD,LIST,ATR,NODECK,
OBJNM=BATCHB');
source program three

/*

//LKED.SYSLMOD DD

OSNAME=PL1.PROGRAMS,
DISP=OLD

//BTCHEX

JOB

PL1PROG,MSGLEVEL=1

//JOBLIB

DO

//STPEXA

EXEC

//SYSPRINT
//STEPEXB
The length of the control record is
limite to the length of the SYSIN record.
The re :ord must be punched in EBCDIC.
I

The return code given for the job step
is the highest code from those which the
indivi ual compilations would return.

The advantages of batched compilation
are
reduction
of
control program
overhe ds, and a reduction in the number of
cards to be punched. The disadvantage is
that
terminal error in one compilation
may re ,ult in termination of the whole
batch.

The following example shows the job
contra statements required (in conjunction
with cltaloged procedure PL1LFCL): to batch
compil e three separate source programs; to
link-e,it source program 1 as one load
module source programs 2 and 3 together as
a seco d load module, and to put both load
module
into an existing cataloged data
set; a ld to execute both load modules.

DD
EXEC

//SYSPRINT

DO

DSNAME=PL1.PROGRAMS,
DISP=(OLD,PASS)
PGM=BATCHA
SYSOUT=A
PGM=BATCHB
SYSOUT=A

COMPILER OUTPUT
The compiler can generate listings of
source statements, compile-time statements,
attributes, cross references, External Symbol Dictionary entries, aggregate lengths
and
object
code.
Source program and
compile-time diagnostic messages are also
produced during compilation.

PRINTED LISTINGS
The first page has the following heading: VERSION x RELEASE zz on the left-hand
side of the page (where x indicates the
version
of
the compiler, and zz the
System/360
operating
system
release
number); OS/360 PL/I COMPILER (F) in the
center of the page; and DATE yy.ddd on the
right-hand side of the page (where yy=year
and
ddd=day).
Page
numbering, which
appears at the top right-hand corner of
each page, begins on this page. Following
the heading is the invocation parameter
list containing the options specified for

I

Job Processing

31

the compilation.
rhe diagnostic messages,
if any,
associated with the specification
of compiler options appear next.
If
the
compiler
options specified
incluje OPLIsr, these diagnostic messages
are followed by a complete list of the
compiler options used for the compilationo
This list includes all options validly
specified at the time of invocation, as
well as those options assumed by default.

specified in the SYSPRINT DD statement, one
input
record per line.
Each line is
assigned a number which appears to the left
of the line.
§.xampl~:

% DCL A CHAR, B FIXED;
2 % A='B+C'; % B=2;
3 X=A;

Each page thereafter has a heading and a
page number.
If the compiler is invoked by
an EXEC statement, the heading used is the
first record of PL/I source text read from
the input source (SYSIN).
The listings consist of the following
items in the order given; items 1 through
10 depend on the appropriate
compiler
options being selected and specified on the
EXEC statement card; items 5 through 9 are
not produced if a terminal error halts the
compilation.

I

1 ..

List of compiler options specified

2.

Compile-time processor input listing

3.

Compile-time processor diagnostic messag8s

Source Program Listing
If the SOURCE option is specified,
the
source program is written on the output
device specified in the SYSPRINT DD statement.
The contents of one card are printed
on one line; if a carriage control character
is specified,
these may be skips
between lines or to a new page.
The number
of the first statement starting on that
line is printed at the left-hand side of
that line.

1 PGMNAME:

40

Source program listing

5 ..

Attribute and/or cross reference table

2 DECLARE

A STATIC,

6.

Aggregate length table

3

B AUTOMATIC; A=B;

7.

Storage requirements listing

ti.

External symbol dictionary listing

90

Assembly listing

10.,

Source program diagnostic messages

rhe time taken for the compilation is also
shown on the listing.

The compiler options listed are those
used for ~he particular compilation. A
description of the options is given in the
section called "Compiler Processing."

If

the

spe~ified,

processor
32

MACRO and SOURCE2 options are
the input to the compile-time
is written on the output device

PROCEDURE;

For numbering purposes, statements contained within compound statements (IF and
ON) are counted, as well as the compound
statements themselves.
In addition# when
an END statement closes multiple groups or
blocks, all implied END statements are
included in the count.
~~~!!!21~:

P:

PROC;

2

X:

BEGIN;

3

IF

A=B

4

THEN

A=1;

5

ELSE

DO;

6

A=O;

7

C=Bi

8

END

10

D=E;

11

END;

Xi

If the input to the compiler is produced
by th~ compile-time processor, the SORMGIN
optio
will be (2,72) and columns 73-80
will ontain auxiliary information.
This
infor ation can be used by the programmer
to de~ermine how the input to the compiler
was g.nerated from the original input.

Storage area for each procedure
Storage area for each begin block
Storage area for each on-unit
Length of program CSECr
Length of static CSECT

columns, which are listed as part
SOURCE listing, are used as follows:

rh~se

of

th~

Contains the input line number
from which this output line was
generated. These numbers correspond to the line numbers printed
with the SOURCE2 listing.

73-77

Contains a two-digit number giving the maximum depth of replacement
which occurred for this
linc~
If
no
replacement
occurred, this field will
be
blank.

78-79

If an error occurs while replacement is being attempted (e.g., a
%
is found in a replacement
value), this column will contain
the letter "E".
Otherwise it
will be blank ..

80

If

th~

NEST option is specified then:

1.

he block level at the begining of the
tatement indicatej is printed next to
he statement number for that line.

2.

in iterative DO level count is printed
~ext to the level count.

STMT

~EVEL

NEST

1
2
3
4

5
6

7
8
9

1
2
2
2
2
3
2

1

1
2
1
1

1

A: PROC OPTIONS (MAIN);
B: PROC (L) ;
DO I = 1 TO 10;
DO J = 1 TO 10;
END;
BEGIN;
END;
END B;
END A;

Th's listing is printed out whenever the
SOURC: option is in effect and gives the
follo~ing information in bytes:

If the ATR option is specified, the
identifiers used in the program are listed
in alphameric order, together with their
explicitly declared and default attributes.
The attributes INTERNAL,
NORMAL, and
REAL are not listed; these attributes can
be assumed unless the conflicting attributes EXTERNAL, ABNORMAL, and COMPLEX are
listed.
For file identifiers. only explicitly
declared attributes are listed, except for
EXTERNAL, which is listed even when applied
by default.

For an array, the dimension attribute is
printed first.
The dimensions are printed
as in the declaration except that expression3 are replaced by asterisks. Constants
and expressions for string lengths are
represented in the length attribute in the
same way as constants and expressions for
array dimensions are represented in the
dimension attribute.
If
an identifier is declared in a
DECLARE statement, it is preceded by the
number of that statement. Statement labels
and entry labels are preceded by the defining statement number.
No statement number
precedes a contextually declared identifier.

If the XREF option is specified in
addition to the ATR option, each identifier
has the numbers of all the statements in
which it occurs printed immediately below
its attributes.
If the XREF option is specified without
the ATR option, the table is printed without the attributes.

Job Processing

33

1
2
3
4
5
6
7
8
9

QQ:

10
11
12
13
14
15

PROCEDURE:
DCL 1 A, 2 B(3), 2 C. 3 0:
DCL G(10.10) CHAR(2);
DCL 1 E# 2 F LIKE C:
DeL I(10) CHAR(2) DEF G(1SUB,1SUB);
DCL 1 J, 2 K BIT(1), 2 L BIT (9):
DCL S(V):
DCL H(10,10) CHAR(2) DEF G:
DCL U(*> CONTROLLED:
DCL 1 M BASED(P), 2 N POINTER, 2 T:
DCL Y(2:4,II);
DCL X (2: II) :
DCL W AREA:
DCL Z(II:JJ,2):
ALLOCATE M IN (W) SET (P):
GET LIST(P->T):
ALLOCATE M IN (W) SET (Q):
GET LISTCQ->T):
P->N=Q:
PUT LIST(Q->T):
R=4:
ALLOCATE U ( R) :

16
17
18
19

20
21
22

150

END QQ:

The foregoing procedure will produce
table ..

the

following

attribute

and

cross

reference

ATTRIBUTE AND CROSS-REFERENCE TABLE
DCL NO.

IDENTIFIER

ATTRIBUTES AND REFERENCES

2

A

AUTOMATIC .• UNALIGNED, STRUCTURE

2

B

(3)IN A, AUTOMATIC, ALIGNED, DECIMAL, FLOAT (SINGLE)

2

C

IN A,AUTOMATIC,UNALIGNED,STRUCTURE

2

D

IN C IN A,AUTOMATIC,ALIGNED,DECIMAL#FLOAT(SINGLE)

4

D

IN F IN E,AUTOMATIC,ALIGNED,DECIMAL.FLOAT(SINGLE)

4

E

AUTOMATIC, UNALIGNED" STRUCTURE

4

F

IN E,AUTOMATIC,UNALIGNED,STRUCTURE

3

G

(10,10)AUTOMATIC,UNALIGNED,STRING(2),CHARACTER

8

H

(10,10)AUTOMATIC.DEFINED,UNALIGNED,STRING(2),CHARACTER

5

I

(10)AUTOMATIC.DEFINED,UNALIGNED,STRING(2),CHARACTER

II

AUTOMATIC,ALIGNED,BINARY,FIXED(15,0)
14,12,11

J

AUTOMATIC, UNALIGNED, STRUCTURE

JJ

AUTOMATIC,ALIGNED,BINARY,FIXED(15,0)
14

K

IN J.AUTOMATIC,UNALIGNED.STRING(1),BIT

6

6

34

6

L

IN J.AUTOMATIC,UNALIGNED,STRING(9).BIT

10

M

BASED(P),UNALIGNED,STRUCTURE
15,17

10

N

IN M.BASED(P),ALIGNED,POINTER
19

P

AUTOMATIC" ALIGNED, POINTER
15,,16,19

Q

AUTOMATIC. ALIGNED, POINTER
17, 18, 19,,20

QQ

ENTRY,DECIMAL~FLOAT(SINGLE)

R

AUTOMATIC, ALIGNED" DECIMAL" FLOAT (S INGLE)
21,22

s

(*)AUTOMATIC#ALIGNED,DECIMAL~FLOAT(SINGLE)

SYSIN

FILE. EXTERNAL
16., 18

SYSPRINT

FILE" EXTERNAL
20

10

T

IN ~BASED(P)~ALIGNED,DECIMAL,FLOAT(SINGLE)
16,18,,20

9

u

1

7

(*)CONTROLLED,ALIGNED~DECIMAL,FLOAT(SINGLE)

22

v

AUTOMATICBALIGNED, DECIMAL, FLOAT (SINGLE)
7

13

w

AUTOMATIC II ALIGNED, AREA
15,17

12

x

(2:*)AUTOMATIC,ALIGNED,DEClMAL,FLOAT(SINGLE)

11

Y

(2:4,*)AUTOMATIC,ALIGNED.DECIMAL,FLOAT(SINGLE)

14

z

(*:*,2)AUTOMATIC g ALIGNED,DECIMAL,FLOAT(SINGLE)

The attributes FLOAT(SINGLE)
and FLOAT(DOUBLE)
refer to the precision
floati g-point data.
These precisions are defined in Figures 32. 49, and 49.1.

SpeCification of the ATR option or the
XREF 'ption produces an aggregate length
which gives,
where possible.
the
in bytes of all major structures and
uctured arrays used in the program.
Each entry in the table consists of the
identi: ier of an aggregate preceded by a
state ~nt number and followed by the length
of th aggregate in bytes.
Th
er of
gate
non-B
ment

statement number is the number eithDECLARE statement for the aggrein the case of a CONTROLLED,
aggregate, of an ALLOCATE statethe aggregate.
An entry appears

of

the

for every ALLOCATE statement involving a
non-BASED aggregate since such statements
may have the effect of changing the aggregate length during execution.
Allocation
of a BASED aggregate does not have this
effect,
and only one entry, which is that
corresponding to the DECLARE statement,
appears for any BASED aggregate.
The length of an aggregate may not be
known at compilation,
either because the
aggregate contains elements having adjustable lengths or dimensions, or hecause the
aggregate is dynamically defined.
In these
cases, the words 'ADJUSTABLE' or 'DEFINED'
appear in the 'Length in Bytes' column.
The entry for a COBOL mapped structure
has the word '(COBOL)' appended.

Job Processing

35

The procedure in the foregoing attribute
and cross reference table example produces
the following aggregate length table.

LENGTH - the length in bytes of the section
(applicable only to SD.
CM, and PR
type entries). expressed as a hexadecimal number

AGGREGATE LENGTH TABLE
The sizes of the program and STATIC
INTERNAL control sections are printed at
the end of the ESD: they are also printed
at the end of the compilation. This makes
the sizes available even if EXTREF is not
specified. The size of each DSA is also
printed at the end of the compilation.
Printing of these sizes is under the control of the SOURCE option.

STATEMENT NO.

IDENTIFIER

LENGTH IN BYTES

2

A

16

4

E

4

3

G

200

8

H

200

5

I

DEFINED

6

J

2

10

M

8

7

S

ADJUSTABLE

22

U

ADJUSTABLE

12

X

ADJUSTABLE

J PGMNAME
J
J PGMNAMEA

11

Y

ADJUSTABLE

l

14

Z

ADJUSTABLE

I

Description of Contents of ESD Listing
The first seven entries are in standard
format, as shown in Figure 5.

r-----------------------------------------,
TYPE
ID
ADDR
LENGTH

I SYMBOL
1

J IHEQINV

) IHESADA

J

J IHESADB
J

If the option EXTREF is specified, all
entries in the external symbol dictionary
(ESD)
are listed.
The information appears
under the following headings:

I IHEQERR
I

so

0001

000000

00033A

SD

0002

000000

00005F

PR

0003

000000

000004

ER

0004

000000

ER

0005

000000

PR

0006

000000

000004

JL _________________________________________
IHEQTIC
PR
0007 000000 000004 J

Figure 5.

Specimen ESD Listing

The seven entries are:
SYMBOL - an eight-character field containing the name identifying the ESD entry

1.

TYPE - two characters from the following
list, to identify the particular type
of ESD entry:

Name of the program control section.
This is the first label in the external procedure statement.

2.

Name of the STATIC INTERNAL control
section. This is the same label as in
1,
(left-filled with asterisks
if
necessary)
to seven characters, with
an eighth character, A.

3.

Pseudo-register
for the invocation
count (the count of the number of
times a block is invoked recursively).

4.

Entry point of the library routine
used to obtain AUTOMATIC storage for a
PL/I block.

5.

Entry point of the library routine
used to obtain storage for some AUTOMATIC variables.

6.

pseudo-register for the error handling
routine.

SO
CM
ER
PR
LD

Section Definition
Named Common
External Reference
Pseudo-register
Label Definition

(For a detailed description of the
different types of ESD entries,
refer
to the publication
IBM
System/36Q
Q£erating sY2teIDL~kage Editor.)
ID - a 4-digit hexadecimal
identifies the symbol

number

which

ADDR - the hexadecimal representation
the compiled address of the symbol
36

of

7.

******XB

pseudo-register used for tasking.

******XC

Tl~e

remainder of the listing is variable,
but the general organization is as
foIl )ws:
1.

Section definition for one-word control section IHEMAIN, which contains
the address of the principal entry
point to the external procedure.
This
item is present only if the external
procedure has the option MAIN.
Section definition for the three-word
control
section
IHENTRY
(always
present), which provides the linkage
with the library at execution time.

2.

LD type items for all names of entry
points
to the external procedure.
except the first, which has been used
as the name of the program control
section ..

3..

A
PR type entry for the display
pseudo-register for each block in the
compilation..
The names are generated
from the external procedure name which
is left-filled to seven characters
with asterisks. The eighth character
is selected from a table of printable
characters which are assigned to names
in the order in which the blocks
appear in the compilation.
If each character in the table has
been used once and more names are
still required, the first character of
the name is replaced from another
(smaller) table and the eighth character recycles. The first and, if necessary, the second character of the
name are allowed to cycle through this
second table ..
If the first or second character overwritten in this way was a character in
the external
procedure
name
(as
opposed to an
asterisk
used
in
padding), a warning message is printed
out, since this could mean that separate external procedures with distinct
names could contain identical generated names.

X: PROC;
Y: PROC;
Z: BEGIN;
END X;
The display pseudo-registers for X, Y,
and Z would have the names:

******XO
4.

ER type entries for all library routines and external routines called by
the compilation. The list of names of
library routines contains the names of
routines which are directly called by
the
compiled
code
(first-level
routines) and the names of modules
which are called by the first-level
routines.
ER type entries for all library routines not directly called by the compiled code but required for successful
compilation.

5.

SO type entries for EXTERNAL FILE
constants and STATIC EXTERNAL variables, except in the case of STATIC
EXTERNAL variables without any initial
text. which have CM type entries ..
File
constants, both internal and
external, have a pseudo-register associated with them, used by the library
for addressing a dynamically allocated
data set control block. For EXTERNAL
FILE
constants the pseudo-register
name is the same as the file name, and
for internal ones it is generated as
for display pseudo-registers.

6.

PR type entries for all CONTROLLED
variables. For external variables the
declared name is used. and for internal variables a name is generated as
for the display pseudo-registers.

A STATIC INTERNAL storage map is produced only when the compiler option LIST is
specified.
The size of this storage area
is given at the end of the compilation.
The first 52 bytes of the STATIC INTERNAL Control Section are of a standard form
and are not listed.
They contain the
following information:
DC
DC

F'4096'
AL4(SI.+X'1000')

DC
DC
DC
DC
DC
DC

AL4CSI.+X·7000')
VL4(IHESADA)
VL4(IHESADB)
A(OSASUB)
ACEPISUB)
A(IHESAFA)
Job Processing

37

SI.
is the address of the STATIC INTERNAL
control section, and IHESADA,
IHESADB and
IHESAFA are library routines.
DSASUB and
EPISUB are compiler routines for getting
and freeing DSAs.
The remainder of STATIC is listed in the
following form:

A sample of a STATIC INTERNAL storage
map is given in Appendix D.

1.

6-character hexadecimal offset

2.

Up to 8 bytes of hexadecimal text

3.

Comment indicating type of item to
which the text belongs (only appears
against first line of text for item)

The possible
(xxx
indicates
identifier):

comments are as follows
the
presence
of
an

OED FOR TEMP
or
OED

Data Element Descriptor
for temporary or for a
programmer's variable

FED

Format Element Descriptor

DV •. xxx

Dope Vector
variable

DVD ••

Dope Vector Descriptor

of

a

If the LINECNT specification for the
listing is 72 or less. and the actual
number of lines to be printed (including
skips) exceeds the LINECNT, double-column
format is used.
If LINECNT is greater than
72, or if the actual number of lines to be
printed (including skips) is less than the
LINECNT, single-column format is used.

STATIC

D.V. SKELETON Dope Vector skeleton for an
AUTOMATIC
or
CONTROLLED
variable

If the LIST option is specified,
a
listing of the object code is produced,
together with its equivalent in a form
similar to assembler language.
If the
LINECNT specification for the listing is 72
or less, and the actual number of lines to
be printed (including skips) exceeds the
LINECNT, double-column format is used.
If
LINECNT is greater than 72, or if the
actual
number of lines to be printed
(including skips) is less than the LINECNT,
single-column format is used.
Comments, of
the form shown below, are included to help
the programmer to identify the functions of
different segments of the object program.

*

STATEMENT NUMBER n - identifies the start
of the code generated for source listing statement number n

RDV ••

Record Dope Vector

*

PROCEDURE xxx - identifies the
the procedure labeled xxx

A•• xxx

Address of EXTERNAL control
section or entry point, or
of an internal label

*

REAL ENTRY xxx - heads the initialization
code for an entry point to a procedure
labeled xxx

*

PROLOGUE BASE - identifies the start of
the initialization code common to all
entry points to that procedure

*

PROCEDURE BASE - identifies the address
loaded into the base register for the
procedure

*

APPARENT ENTRY xxx - identifies the point
of entry into the procedure for the
entry point labeled xxx

*

END PROCEDURE xxx - identifies the end of
the procedure labeled xxx

*

BEGIN BLOCK xxx - indicates the start of
the BEGIN block with label xxx

*

END BLOCK xxx - indicates the end of
BEGIN block with label xxx

*

INITIALIZATION CODE FOR xxx - indicates
that the code following performs initial value assignment or dope vector
initialization for the variable xxx

ARGUMBNT
LIST

Argument list skeleton

CONSTANTS

38

SYMTAB

Symbol table entry

SYM •• xxx

Symbolic name of label constant or label variable

FILE •• xxx

File name

ON •• xxx

Programmer-declared
ON-condition

ATTRIB

File attributes

xxx

STATIC variable.
If the
variable is not initialized,
no
text
appears
against the comment,
and
there is also no STATIC
offset if the variable is
an array.
(This can be
calculated from the dope
vector if required)

start of

the

Whbrever possible, a mnemonic prefix is
used to identify the type of operand in an
instr ction, and where applicable this is
folIo ed by a source program identifier.
The f'llowing prefixes are used:

TMPDV ••

Temporary dope vector, followed
by hexadecimal dictionary reference

VO..

Virtual origin

A ••

Address constant

WP1.

AE.

Apparent entry point (point in
the procedure to which control
passed from the prologue)

Workspace~ followed by decimal
number of block which allocates
workspace

WP2.

Label created for an otherwise
unlabeled block (followed by the
number of the block)

Workspace, followed by decimal
number of block which allocates
workspace

WS1.

followed by decimal
number of block which allocates
workspace

WS2.

Workspace~ followed by decimal
number of block which allocates
workspace

WS3.

Wo~kspaceg followed by decimal
number of block which allocates
workspace

BLO~K.

c.o

constant (followed by a hexadecimal dictiona+y reference)

CL.

A label generated by the
compiler (followed by a decimal
number identifying the label)
Data Element Descriptor

Workspace~

Dope Vector
A listing of the various storage areas
is not produced, but the addresses of
variables can be deduced from the object
program listing.

Dope Vector Descriptor
Data Element Descriptor of
function value

Exampl~:

FVR ...

Function value
A=B+10E1; in the
duces:

Invocation count pseudo
register
ON ...

ON-condition name

PR ••

pseudo-register

source

program

0002CA

78 00 B 058

LE

O,B

0002CE

7A 00

AE

0,C •• 08F4

0002D2

70 00 B 060

STE

O,A

B

064

pro-

Record Definition Vector
A and B a~e STATIC INTERNAL variables at an
offset of X'60' and X'58'g respectively,
from the start of the control section.

Return switch
Address of STATIC INTERNAL
control section
Skeleton dope vector, followed
by hexadecimal dictionary reference
Skeleton parameter list,
followed by hexadecimal
tionary reference

dic-

symbol table entry
Symbolic representation of a
label
Temporary control Area. A word
containing the address of the
dope vector of the specified
temporary
Temporary, followed by hexadecimal dictionary reference

A sample of an object program listing is
given in Appendix DA
The size of this
listing is always printed at the end of the
compilation.

Diagnostic messages are produced whenever the compiler detects an error (or possible error) in the program and are sorted in
order of severity.
The four levels of
severity and types of message are fully
described
in
the
section
"Compiler
Options."
Each error message is preceded by a code
in the form IEMnnnnI, where IEM is the
identification code for the PL/I (F) compiler, and nnnn is a decimal number identifying the message.
Job Processing

39

For a detailed list of the diagnostic
messages refer to Appendix G of this publication.

At the end of a compilation, the time
taken, in minutes
and
hundredths
of
minutes, is printed out, provided that the
appropriate control-program timing options
have been selected at the time of system
generation. The time given is the time
during which the compiler is actually in
control. For details of these options,
refer to 'system Requirements'.

This card appears only when the
option is specified.

OBJNM

Object decks generated as a result of
the use of the DECK option will be serialized in the following manner.
Columns 73 to 76 will contain the first
four characters of the first entry label of
the external procedure. If the label has
fewer than four characters, it will be
left-adjusted in the field and the remainder padded with blanks.
Columns 77 to 80 will contain a fourdigit decimal serial number.
Numbering
starts at 0001 and the increment is 1 each
time.

OBJECT MODULE OUTPUT
The object module is in a form suitable
for direct input into the linkage editor.
It is made up as follows:

ABNORMAL END OF COMPILATION

1.

ESD entries for the object module.

2.

TXT and RLD entries for the compiled
program.
TXT and RLD entries are
intermingled, although RLD entries are
always preceded by their related texto

3.

TXT and RLD entries for the STATIC
INTERNAL control section.

LINKAGE EDITOR PROCESSING

4u

TXT and RLD entries for a one-word
control section IHEMAIN,
whicq contains the address of the principal
entry point to the external procedure.
This control section is produced only
when the external procedure has the
MAIN option; it is used by the library
routines IHESAPA, IHESAPC, IHETSAP and
IHETSAO when passing control to the
program.

5.

TXT and RLD entries for a three-word
control section IHENTRY. This control
section is referenced by the END card
and contains a branch to one of the
four library routines IHESAPA, IHESAPC, IHETSAP or IHETSAO.
The last
two routines are used for tasking.

The linkage editor processes PL/I object
modules, resolves any references to subroutines and functions,
and forms a load
module. To communicate with the linkage
editor program, the programmer supplies an
EXEC
statement and DO statements that
define all data sets. He may also supply
control statements for the linkage editor.
The program name for the linkage editor is
IEWL.
If tne linkage editor is executed as
a
job step, the parameter PGM=IEWL is used
in the EXEC statement.

6.

TXT and RLD entries for all STATIC
EXTERNAL control sections and EXTERNAL
file constant control sections.
The
sections appear in increasing order of
ESD identification.

7.

END statement for the compilation.
This specifies the IHENTRY control
section as the one to be entered.

8.

NAME

40

statement

for

the compilation.

If a program check occurs during a
compilation,
a
diagnostic
message
is
printed giving the type of interruption.

The primary input to the linkage editor
is in the form of object modules and/or
linkage editor control statements.
(A load
module, by itself, cannot be the primary
input.) While processing an object module,
the linkage editor finds any references to
functions or subroutines in the object
module, and uses an automatic library call
to
resolve
them.
The automatic call
library consists of either object modules
and linkage editor control statements, or
load modules, but not both.

r-------,
r---------, r---------,1
ISource 1 ILanguage 1 IObject

t-------,

1
1->ITrans1->1
Ilator
Module
lIPrograml
_______ J
L __________ J1
lI _________
J1

]I

1
]

v

r-------,
r---------,
r---------,1 1r---------,
r---------,] 1r---------,
r--------,
ISource I
ILanguage 1 IObject
Linkage 1 ILoad
Control
I
IMain
I
1
1->ITrans1->1
1->1
1->1
1->1
1->]
1
1L_________
Module
1l _________
Editor
1L_________
Program J1 lIStorage
lIPrograml
_______ J
lIlator
_________ J1
J1
JI
lIModule
_________ J1
________ J1

"
J

I
I

r-------,

r---------,

r---------.,
1
I
r------- J

L_______ J

Iprograml

Ilator
I
L_________ J

Figure 6.

Linkage Editor Input/Output Flow

I Source 1 I Language I IObject
I
1->ITransI->l

Il _________
Module
l
J

The programmer can specify additional
libraries and data sets for use by the
linkage editor; the LIBRARY card is used
for this purpose (see the publication 1~~
~Y~~~~~l£Q_QE~r~tig~_~~!emL
Linkage Editor.)
The output of the linkage editor is
always placed in a library. Error messages
and optional diagnostic messages are written on either an intermediate
storage
device or the printer.
In addition, a work
data set is required by the linkage editor
to do its processing.
Figure 6 shows the
input/output flow in linkage editor processing.

The programmer communicates information
about data sets to the linkage editor
through DD statements identified by specific ddnames, similar to the ddnames used by
the compiler.
The programmer must use
these ddnames and he must meet the functions and requirements for data sets specified in Figure 7.
Any data sets defined by SYSLIB or
SYSLMOD, and any additional data sets, must
be partitioned data sets. The ddname given
to refer to any additional libraries is not
fixed by the linkage editor. L~hkage editor control statements are used to inform
the linkage editor about the additional
libraries.
The data sets used by the linkage editor
are assigned to the device classes listed
in Figure 7.

The user can specify additional libraries by means of the linkage editor control
statements INCLUDE and LIBRARY. These control statements can appear in either the
input stream or the libraries. For details
of these statements refer to the publicati on !~!~L.§y§.!~rn/ 360 _QEer a t i:!!L§y§.!~!!!L_1.!!}~:.
~L~£itQr·

Space can be conserved by link-editing
PL/I subroutines into a private library
with their external references unresolved.
To do this, the linkage editor option NCAL
is specified; the SYSLIB DD statement is
then unnecessary.
It is also possible to
maintain a liorary of PL/I object modules.
Either of these techniques requires considerably less disk space than link-editing
all PL/I object modules with their external
references resolved.

Linkage Editor Priority
If modules with the same name appear in
the input to the linkage editor, the linkage editor accepts the first module which
appears.

Job Processing

41

r------------r-----------------------------·------T-------------------------,
I
I
Possible
I

I

) ddname

I

I

Function

Device Classes

I

.------------+-----------------------------------+-------------------------i
I SYSLIN
I Primary input data, normally the I SYSSQ# or the input
I

I stream device (specifiedl
I
I output of the compiler
I
I
I by DD *)
I
t------------+-----------------------------------+-------------------------~
l SYSLIB
I Automatic call library (usually
I SYSDA
I
I
I
I
I the PL/ I Library)
t------------+----------------------------------·-+-------------------------~
! SYSUT1
I Work data set
I SYSDA
I

.------------+-----------------------------------+-------------------------i

t-~:~:~~~:---t-~~:~~~:~~~-~:::~~::---------·------+-~~~~~~-~:-~~~~~:-~=~~~=-~
I SYSLMOD
I Output for load module
I SYSDA
I
r------------+------------------------------------+-------------------------~

I (userI Additional libraries and data setsl SYSDA
)
lL____________
specified) LI ___________________________________.J.I _________________________ JI
Figure 7.

Linkage Editor ddnames
2.

In order to overlay PL/I programs,
the
user must have some knowledge of the control sections produced by the compiler.
The following control sections are produced
for each external procedure:
One control section containing the executable portion of the program and all
constants.
One control section
INTERNAL data.

containing

(only if
for
the

There is a linkage editor requirement that
each segment of an overlay structure consists of one or more complete control
sections.
No control section can be split
between different segments.
The input to the linkage editor must
contain all external procedures required in
the overlay structure,
together with the
linkage-editor control cards describing the
required structure.
The external procedures may be in the form of:

42

I

JA

One control section IHENTRY.

1.

For a full description of the overlay
facilities, s~e IBM System/360 0Eeratigg
System~ __ bi~~~~__ §gitQr~
The two examples
given below show how the simple overlay
structure illustrated in the diagram can be
produced from each of the forms of external
procedure described above.
Both examples
use cataloged procedures;
the first one
also uses batched compilation methods.

STATIC

One control section for each STATIC
EXTERNAL item or EXTERNAL file name.
(This is a named common control section
only for a non-string scalar variable
declared
without
the
INITIAL
attribute.)
One control section IHEMAIN
oprrONS(MAIN)
is specified
procedure).

Object and load modules in a library.
These modules are called by means of
the linkage-editor INCLUDE statement.

Object modules in the input stream

r------J.------,

I
IB

I

X

JF

+

I
I

IC

I

r---- L - - - - ,

I

Y

I

JD

jE

I
I

I

EX~~El~-1~
§t£~~ The

QQ~ct
Modules in the Input
cataloged procedure PL1LFCLG is
used, with two additional DD statements for
SYSIN in the compilation and link-edit
job
steps.

//jobname
//stepname
//PL1L.SYSIN
•

*

JOB
EXEC
DD

etc.
PL1LFCLG"
PARM.LKED='OVLY'

*

A:PROC OPTIONS(MAIN)i ••• END Ai
PROCESS •••
B:PROC; ••• END B;
PROCESS •••

*
*
*

·..

C:PROC;
END C;
PROCESS •••
D:PROCi
END Di
PROCESS •••
E:PROC;
END Ei
PROCESS •••
F:PROCi
END Fi

·..

· ..

1*

IILKED.SYSIN DD
INSERT A
OVERLAY X
INSERT B
INSERT C
OVERLAY Y
INSERT D
OVERLAY Y
INSERT E
OVERLAY X
INSERT F

*

Note that the DD statement
LKED.SYSIN
allows data in the input stream to be
concatenated with the object file.
~xa~E~~~~

QQiect and Load Modules in a
The cataloged procedure PL1LFCL is
used to compile source modules in a library
LIB.S and to use the object modules from
this as input to the link-edit step.
The
load modules produced are placed in a
library of load modules, LIB.L. Both LIB.S
and LIB.L are cataloged data sets.
Each
external procedure requires:
Li£ra~~

Iistepname
IIPL1L.SYSIN

EXEC
DD

IILKED.SYSLMOD DD

PL1LFCL,PARM.LKED=
'XREF,LIST,NCAL'
DSNAME=LIB.S(member),
DISP=SHR
DSNAME=LIB.L(member>,
DISP=OLD

To create an overlay structure from modules
in LIB.L,
the cataloged procedure PL1LFLG
is used witn the INCLUDE statement:
Iistepname

EXEC

IILKEDePRIVLIB DD

PL1LFLG,PARM.LKED=
OVLY
DSNAME=LIB. L,
DISP=SHR

IILKED.SYSIN
DD
*
INCLUDE PRIVLIB(A,B,C,D,E,F)
INSERT A
OVERLAY X
INSERT B
INSERT C
OVERLAY Y
INSERT D
OVERLAY Y
INSERT E
OVERLAY X
INSERT F
ENTRY IHENTRY

Use of the NCAL option (see below) ensures
that only those modules required are placed
in
the
load
module
library.
The

LKED.SYSLMOD DD statement overrides the DD
statement with the same ddname in the
cataloged procedure. The other DD statements are additions to those in the cataloged procedure.
The basis of the above method is that
all object and load modules appear in the
input
stream before the first OVERLAY
statement. All control sections are therefore placed in the root segment until
explicitly moved to another segment by an
INSERT statement.
Each INSERT statement
moves into the appropriate overlay segment,
only the control section containing executable code.
Since all modules required from the PL/I
library are obtained using the automatic
library call procedure to resolve external
references, all library modules and data
are in the root segment, where they are
available to all other segments.
This is
basically necessary, since PL/I does not
support
exclusive
calls,
i.e.,
calls
between segments which do not lie on a
single path.
For example, in the above
structure, procedures in the segment containing D could call procedures in the
segments containing A, B, C, and D, but not
in the segments containing E or Fo Procedures in the segments containing Band C
could call procedures in the segments containing A,
H, C, D and E, but not in the
segment containing Fa A procedure in, say,
the segment containing B may not call a
procedure in the segment containing A which
in turn calls a procedure in the segment
containing F.
However, certain modules may not be
required ~y all segments, in which case
they can be moved out into a lower segment.
The method of doing this is to compile the
procedures using the compiler option EXTREF
and then to examine the lists of external
references produced. For example, if in
the above structure a module IHExxx is
called only by the segment containing E, it
may be moved into that segment by a control
statement of the form INSERT IHExxx immediately following the statement INSERT E.
Similarly, if module IHEyyy is called only
by the segments containing D and E it may
be moved into the segment containing B or
C. Any module called by both the segment
containing F and anyone or more of the
segments containing B, C, D, and E must
remain in the root segment.
Similarly, data control sections may be
moved from the root structure to segments
lower in the structure. For example:
1~

To move the STATIC INTERNAL control
section for procedure F into the segment containing F,
the
statement
Job Processing

43

INSERT
F
must
INSERT ******FA.
2.

be

followed

To move the STATIC EXTERNAL control
section PQR (which is referenced by B
and C only) into the segment containing Band C, the statement INSERT C
must be followed by INSERT PQR.

Values assigned to these STATIC data items
are not saved when the segment is overlaid;
when the segment is reloaded the original
values are restored.
STATIC data should
therefore be left in the root segment
unless it consists of:
1•

2.

Values set
and
then
read-only>

by the INITIAL attribute.
unchanged
(that
is~

Values that need not be
retained
between different loadings of the segment.

An alternative method of producing an
overlay structure is to obtain object decks
and intermingle these with OVERLAY cards.
This method requires much more careful
handling. STATIC INTERNAL control sections
must be moved up into the root segment,
unless they are read-only. Named common
control sections (which are produced only
for non-initialized~ non-string EXTERNAL
scalar variables> are automatically moved
up so that they are accessible to all
segments requ1r1ng them,
but all other
EXTERNAL items will need to be moved up by
the use of INSERT statements.
Further information on the use of overlay structures can be obtained from the
publication IBM_£ystem/360 Operating Sys!~~_binkag~Editof~

In addition to those already discussed,
other linkage editor control statements are
available:
1.

NAME statement: Specifies the name of
the load module created from
the
preceding input modules.

2.

ALIAS statement: Specifies alternative
names for the load module and can also
specify alternative entry points.

3.

CHAN3E statement: Changes a control
section name, an entry name. or an
external reference.

4.

44

tion to be replaced by another; or
changes an entry name or an external
reference.

by

REPLACE statement:
Deletes a control
section, an entry name. or an external
reference; or deletes a control sec-

For a detailed description of these
facilities,
see
the
publication
IEM
2Y§~60_QEerating System, Li~n~k~a~g~e~~E~d~i=.
to!:.
OPTIONS FOR LINKAGE EDITOR PROCESSING
The linkage editor options can be specified in the EXEC statement. The options
that are most applicable to the PL/I programmer are:
PARM='LIST,MAPIXREF,LETIXCAL,NCAL.OVLY'
LIST - the LIST option specifies that all
control statements processed by the
linkage editor are listed in cardimage format on the diagnostic output
data set.
MAP

or XREF - the MAP option tells the
linkage editor to produce a map of the
load module; this map indicates the
relative location
and
length
of
control sections.
If XREF is specified, a map of the load module is
produced and a cross reference list
indicating all external references in
each control section is generated.
If
neither MAP nor XREF is specified,
neither the map nor the cross reference listing is generated.

LET or XCAL - the LET option specifies that
the linkage editor should mark the
load module ready for execution even
though certain error or abnormal conditions
were found during linkage
editing.
(It should be noted that,
because of the selective loading techniques, certain external references to
library modules may not be resolved.)
The XCAL option marks the load module
executable
even
though
improper
branches were made between control
sections; this occurs only if the
OVERLAY feature of the linkage editor
is being used.
NCAL - the NCAL option informs the Linkage
Editor that no external references are
to
be
resolved by the automatic
library call mechanism.
The subprograms in the library are not inserted
in the load module.
However, the load
module is marked executable.
Other options can also be specified for
the linkage editor.
For a detailed description of all linkage editor options, see
the publication IBM System/360 operatin~
Syst~Link~ge Editor.

JOB CONTROL PROCEDURE FOR LINKAGE EDITOR
An example of a linkage editor procedure
that handles the object program deck from
the PL/I (F) compiler is given below.
IIJOB2
/

I]~INK

JOB 345,JOHNSMITH,
MSGLEVEL=i1
EXEC PGM=IEWL,
PARM='XREF,LIST'

If the module is in an overlay structure. the control sections are arranged by
segment in the order in which they were
specified.
Each control section that is included
from a library during automatic library
call is indicated by an asterisk.
After the control sections, the module
map shows the contents of the pseudoregister vector (PRV).

//SYSPRINT DD SYSOUT=A
//SYSLIB

At the end of the module map is:
1.

The
relative
address
of
the
instruction with which processing of
the module begins.

DD UNIT=SYSDA,
SPACE=(1024.(200,20»

2.

The total
bytes

DD DSNAME=PRIVATE(PROGRAM),
DISP=OLD

3.

The
total
length
register vector.

DD

DSNAME=SYS1.PL~LIB~

DISP=SHR
//SYSUT1
/ISYSLMOD
//SYSLIN

DD

*

(Object program deck)
/*

length

of

the
of

the

module in
pseudo-

In the case of an overlay load module#
the length ~s that of the longest path.
The addresses shown in the module map are
those assigned by the linkage editor prior
to loading for execution.

LINKAGE EDITOR OUTPUT
The linkage editor produces a map of the
load module if the MAP option is specified.
or a cross reference list and a map if the
XREF option is specified.
The linkage
editor also produces diagnostic messages,
which are fully described in the publication I~~_§y~tgm/36~~~tin~ System, Link~gg_§Qi:!:.Qr·

The size of the load module produced by
the linkage editor must not exceed 512K
bytes. Programs producing a load module
larger than this should be segmented.

The module map shows all control sections in the output module and all entry
names in each control section. The control
sections are arranged in ascending order
according to their assigned origins.
All
entry names are listed below the control
section in which they are defined.

The cross reference table consists of a
module map and a list of cross references
for each control section.
Each address
constant is listed with
its
assigned
location, the symbol referred to# and the
name of the control section in which the
symbol is defined. For overlay programs,
this information is provided for each segment.
In addition, the number of the
segment in which the symbol is defined is
provided.
If the program is in an overlay structure, a list of cross references is provided for each segment.
If a symbol is unresolved after processing by the linkage editor, it is identified
by $UNRESOLVED in the list. However. if an
unresolved symbol is marked by the nevercall (NCAL) function, it is identified by
$NEVER-CALL.

Disposition Data
Information indicating the options and
attributes specified is provided with each
load module produced.
Job Processing

45

There are, in addition, a number of
disposition messages
to
indicate
the
conditions of the load module in the output
module library.
For full details see the
publication IBM_§ystem/360 Operating Sys~emL_bin~~~ Editof.

DIAGNOSTIC MESSAGES
Certain conditions that are present when
a module is being processed can cause an
error or warning message to be printBd. An
error or warning message consists of a
message code and a message text.
The message text contains combinations
of the following:
The code lEW, which identifies
editor messages

linkage

The message
classification
error or warning)

(either

£)CB Paramet er
The data control block , or member in
error

//SYSPRINT DD

SYSOUT=A

//SYSLIN

DO

DSNAME=&&LOADSET.
UNIT=SYSDA,
DISP=(MOD,PASS),
SPACE=(80, (250,100»

//SYSUT1

DO

UNIT=SYSDA"
SPACE=(1024, (60,60»,
SEP=(SYSPRINT,
SYSLIN)

//SYSIN

DO

*

Instructions to the programmer
Actions taken by the linkage editor
If an error is encountered during processing, the message code for that error iEI
printed with the applicable symbol, sym-·
boIs, or record in error. After processing
has been completed, the diagnostic message
associated with that message code is printed.

(Source Program Deck)
/*

EXEC

PGM=IEWL

//SYSPRINT DD

SYSOUT=A

//SYSLMOD

DO

DSNAME=&&LOADSET,
SPACE=(1024, (50,20,1»,
DISP=(NEW,PASS),
UNIT=SYSDA

//SYSLIB

DD

DSNAME=SYS1.PL1LIB,
DISP=SHR

//SYSUT1

DO

UNIT=SYSDA,
SEP=(SYSLMOD,SYSLIB),
SPACE=(1024,(200,20»

//SYSLIN

DD

DSNAME=*.STEP1.SYSLIN,
DISP=(OLD,DELETE)

/ILKED

When the system is generated, device
names are assigned by the operating system
and the installation, and the programmer
chooses devices by specifying either the
installation or operating system names.
The programmer can choose which device
to use for his data sets and can specify
the name of the device or class of devices
in the UNIT parameter of the DO statement.
46

/ISTEP3

EXEC

PGM=*.LKED.SYSLMOD,
COND=(C5,LT,STEP1),
C5,LT,LKED»

//SYSPRINT DD

SYSOUT=A

//SYSIN

*

DO

(Data)
/*

tion 1.
The preset tab positions are: 25,
49, 73, 97, and 121.
(See the section "The
Tab Control Table" for details of how to
alter these values.)
A numeric data field
for list- or data- directed output will not
be split over two lines when this can be
avoided.
A field which exceeds the residual space on the current line will begin a
new line, and only if the new line cannot
accommodate the complete field will it be
carried over to subsequent lines.

OBJECT PR03RAM OUTPUT

Execution of the PL/I procedure shown in
Figure 8 will produce the object time
output in Figure 9.

Figure 9 illustrates various forms of
external data representation as produced by
PUT statements employing the EDIT, LIST,
and DATA keywords.
It should be noted that
the output of data fields to PRINT files by
list- or data- directed techniques will
automatically be aligned upon preset tab
positions, the initial data field of a line
being aligned upon the left margin,
posi-

This form of output is concerned with
writing complete records,
instead of one
item at a time.
One record is the contents
of one variable.
rhe external data representation is the same as the internal
form;
there is no data conversion. RECORDoriented output is described in 'Managing
Data' •

OUTPUT: PROCEDURE
DCL

OPTIONSCMAIN)~

A FIXED,
B FLOAT,
C FLOAT COMPLEX,
D BIT(10),
E CHAR (10),
ARRAY(2,2)~

A,B = 12345~
C
A+12345I~
D
'1100111'B;
E
'ABC"DEFG';
DO I = 1 TO 2; DO J
ARRAY(I,J) = I+J;
END; END~

1 TO 2;

PUT PAGE LIST('EXAMPLES OF LIST/DATA/EDIT OUTPUT');
LIST:

PUT SKIPC2} LIST('LIST DIRECTED EXAMPLES:');
PUT SKIP(1) LISTCA,B,C,D,E);

DATA:

PUT SKIP(2) LIST('DATA DIRECTED EXAMPLES:');
PUT SKIP(1) DATA(A,B,C,D,E);
PUT SKIP DATACARRAY);

EDIT:

PUT SKIP(2) LIST('EDIT DIRECTED EXAMPLES:-);
PUT SKIP(1) EDIT(A,B,C,D,E)
(F(10,2),E(~O,O,5),C(E(10,O,5»,X(5),2A);

END;
Figure 8.

Example of PL/I Procedure Using STREAM I/O

Job Processing

47

EXAMPLES OF LIST/DATA/EDIT OUTPUT
LIST DIRECTED EXAMPLES:
Q2345
1.23450E+04
ABC'DEFG

1.23450E+04+1.23450E+04I

'1100111000'B

DATA DIRECTED EXAMPLES:
E='ABC"DEFG 'i
ARRAY(l,l)= 2.00000E+00 ARRAY(1,2)= 3.000000E+00 ARRAY(2,1)= 3.000000E+00 ARRAY(2,2)= 4.00000E+00;
EDIT DIRECTED EXAMPLES:
12345.00 12345E+00 12345E+00 12345E+00

Figure 9.

1100111000ABC'DEFG

Example of LIST/DATA/EDIT Output to PHINT Files using the PUT Statement
2E~rator

when an exceptional or error condition
arises during the execution of a PL/I
program,
a
message
of
the
form
IHEnnnI - text is printed. The first three
characters IHE are standard and indicate a
PL/I library message. The message number
is specified by the digits nnn. The final
character, I, is a system standard action
code, indicating an informative message for
the programmer. These messages are printed
on an output data set which is specified by
the SYSPRINT DD statement provided by the
programmer.
If the SYSPRINT DD statement
is absent, the object time messages appear
on the operator's console, except for the
ON CHECK system action messages and the
COpy option output, which are not printed
at all in this case.
rhe text of the
message, which may consist of any number of
characters, is separated from the I by one
blank. PL/I input/output messages include
the word FILE and the file-name at the
start of the message, to assist in the
identification of the file causing the
error.
If the statement number compiler option
has been specified, each message will also
contain IN STATEMENT nnnnn prior to AT
location message.
nnnnn gives the number
of the statement in which the condition
occurred.
Messages are generated for two reasons:
1..

An error occurred
for
which
no
specific ON condition exists in PL/I.
A diagnostic message is printed out
and the ERROR condition is raised.

2.

A'n ON condition is raised, by compiled
code or by the library, and the action
required is system action, for which
the language specifies COMMENT as part
of the necessary action.

The complete list of object time diagnostic messages appears in Appendix G of
this publication.

48

Messages

A message is transmitted to the operator
when the DISPLAY statement is specifiea in
the PL/I program. The two forms in which
an operator message may appear are as
follows:
1.

Without the REPLY option - the message
is in the form of a character string
specified by the programmer.

2.

with REPLY option - the message is in
the form of a character string specified by the programmer, but it 1S
preceded by a two-digit code generated
by the operating system. rhe operator
must use this code as the prefix to
his reply message.

SYSTEM OUTPUT
Diagnostic messages and completion codes
are issued by the operating system, indicating coding errors found in job control
statements and system macro instructions,
and errors detected during processing by
the linkage editor. The completion codes
indicate conditions causing the control
program to abnormally terminate execution
of a job.
For details of the system
messages and completion codes, refer to the
publication IBM System/360 0Eerating System" Messages, Completion Codes and Stora~
r:umE§..

To ease the work of the PL/I programmer,
IBM has supplied cataloged procedures to
assist in the compilation, linkage editor
processing, and execution of PL/I source
programs. The job control statements needed to invoke the procedures, and the deck
structures used with the procedures, are
described in the following paragraphs.

In the examples given in this
the operand is specified as:

section,

The cataloged procedure, PL1LFC, consists of the control statements shown in
Figure 59 in Appendix E.

PROC = cataloged procedure name
but the 'PROC=' can be omitted if required.
It is recommended that each installation
review the procedures supplied by IBM, and
modify them to obtain more efficient use of
the devices available, to allow for installation conventions, to accommodate local
changes to the compiler options, to alter
the REGION fields to correspond to available storage, or to set block sizes for
output data sets.

Invoking the PL1LFC catalo~ed_E£2~~~~
Figure 11 shows control statements that
might be used to invoke the procedure.

r-----------------------------------------,
I
//COMPLM
JOB PL1PROG,MSGLEVEL=1
I
I

1

1
~

!
~

//STEP1

EXEC

//PL1L.SYSIN DO

PROC=PL1LFC

I

I

I
I
I
I

*

(Source Program Deck)

1
I
JI
IL _________________________________________
/*
Figure 11.

The cataloged procedure for compilation
with deck output is PL10FC. The programmer
invokes this procedure by using an EXEC
statement with the first parameter containing the name PL10FC. An example is shown
as follows:
//STEP1

EXEC

PROC=PL1DFC

the PL10FC Cataloged Procedure:
Figure 10 shows control statements that
might be used to invoke the procedure.

r-----------------------------------------,
I
/ICOMPIL
JOB PL1PROG,MSGLEVEL=1
I
I
I
I
//STEP1
EXEC PROC=PL1DFC
I
I
I
I
/IPL1D.SYSIN DO *
I
I
I
(Source Program)
I
I
I
I
LI _________________________________________
JI
/*
Figure 10.

Invoking the
dure PL1DFC

Cataloged Proce-

The cataloged procedure for compiling
and link-editing a PL/I source program is
PL1LFCL. The programmer invokes this procedure by using an EXEC statement with the
first
parameter
containing
the
name
PL1LFCL. For example:
//STEP1

//STEP1

EXEC

PROC=PL1LFC

EXEC

PROC=PL1LFCL

The cataloged procedure for compiling
and link-editing consists of the control
statements shown in Figure 60 in Appendix
E.
InY2~!gg __ ~h~ __fL1~E£~_£~~alQg~Q_f£2ce1Q£~~
Figure 12 shows the statements that might
be used to invoke the procedure PL1LFCL.

r-----------------------------------------,
//JOBCLE
JOB PL1PROG,MSGLEVEL=1
I

1
I
I
I
I
I

I
I
I
//PL1L.SYSIN DO *
I
I
]
(Source program)
I
I
I
JI
1L _________________________________________
/*
//STEP1

Figure 12.

The cataloged procedure for compilation
with object module output is PL1LFC. The
programmer invokes this procedure by using
an EXEC statement with the first parameter
containing the name PL1LFC. An example is
shown as follows:

Cataloged Proce-

Compilation and Link-Editigg

The cataloged procedure, PL1DFC, consists of the control statements shown in
Figure 43 in Appendix E.
lrrY2~~~

Invoking the
dure PL1LFC

EXEC

PROC=PL1LFCL

Invoking the
dure PL1LFCL

cataloged Proce-

Compilation, Link-Editing and Execution
Another cataloged procedure, PL1LFCLG,
passes a source program through three procedure steps - compilation. link-editing,
and execution. The cataloged procedure is
Job Processing

49

//STEP1

invoked by specifying the name PL1LFCLG as
the first parameter in an EXEC statement.
For example:
//STEP1

EXEC

specifinot
be

Figure 61 in Appendix E shows the statements that make up the cataloged procedure
PL1LFCLG.

1!!YQls!!!g:_~h~_!:!:!1.LF£!:!~_~~e.12g:ed Procedure.:..
Figure 13 shows statements that might be
used to invoke the procedure PL1LFCLG.

Figure 62 in Appendix E shows the statements that make up the cataloged procedure
PL1LFLG.
1nY2king _~h~_-f!:!1.1f1~-fe.~aIQged_Pr2~£~~
Figure 14 shows statements that might be
used to invoke the procedure PL1LFLG.
r------------------------~----------------,

J

~
r-----------------------------------------~

I
I
I
I
I
I
I
I

//COMPLEG

JOB

PL~PROG,MSGLEVEL=l

~

I
I
I
I
//PL1L.SYSIN DD *
I
I
(Source Program)
I
J
I
lI _________________________________________
/*
JI
//STEP1

Figure 13.

EXEC

PROC=PL1LFCLG,
REGION. GO=xxxxK

Invoking the Cataloged
dure PL1LFCLG

PROC=PL1LFLG,
REGION. GO=xxxxK

where xxxxK represents the REGION specification
(leading
zeros
need
not
be
specified).

PROC=PL1LFCLG,
REGION. GO=xxxxK

where xxxxK represents the REGION
cation
(leading
zeros
need
specified).

EXEC

J

//jobname
//STEPl

JOB

EXEC

J
J

1
I

PL1PROG,MSGLEVEL=1
PROC=PL1LFLG,
REGION. GO=xxxxK

I
I
I
I
J

parameters defining I
the input data set I
]
to the Linkage
I
lJ _________________________________________
JI
Editor
//LKEO.SYSIN DO

Figure 14.

Invoking the
dure PL1LFLG

Cataloged Proce-

ProceLink-Editigg and Execution of Several
separate Com.1&lations

The cataloged procedure for link-editing
and executing a previously compiled PL/I
program is PL1LFLG.
This procedure is
invoked. by an EXEC statement with the first
parameter containing the name PL1LFLG. For
example:

50

Several programs can be separately compiled, then link-edited together and executed as one program.
This is done by
using the cataloged procedure PL1LFC for
each
individual compilation except the
last, then using the procedure PL1LFCLG for
the last, all within the same job.

organizations used in the System/360
ating System are:
The term "file," as defined for PL/I,
may be equated for the most part with the
system'360
operating system term "data
set." However, there is not necessarily a
one-to-one correspondence between the number of files being used within a program
and the number of data sets being used.
That is, a program may declare two files,
ALPHA and BETA, both of which are concurrently open and both referring to the same
data set.
This may be effected in two
ways:
1.

When opened, both files ALPHA and BETA
use the same TITLE option value, i~e ••
they refer to the same DD statement.

2.

Two DO statements are used, one for
each file, and each nominates the same
data set.

From the above, it may be seen that the
PL'I program does not itself nominate data
sets directly.
The TITLE option of the
OPEN statement is employed to specify the
name (ddname) of the OD statement to be
associated with a given file; in turn, the
00
statement specifies its associated data
set (dsname). Should the TITLE option be
omitted from the OPEN statement. or should
the file be opened implicitly by another
I/O statement, a default TITLE is obtained
from th~ file identifier; the initial eight
characters, padded with blanks if necessary, are used.

Oper-

CONSECUTIVE
INDEXED
REGIONAL
CONSECUTIVE
organization
permits
only
sequential access, while
REGIONAL
and
INDEXED organization permit both direct and
sequential access.
The permitted combinations of data set
organization, PL/I statements, access methods. etc. are detailed in Figures 15. 16,
and 17.

CONSECUTIVE ORGANIZATION
In CONSECUTIVE organization, the data
set consists of records whose placement
within the data set is determined solely by
the order in which they were initially
added. Such a data set does not employ
keys; records may be retrieved only in
sequential order. Device support for CONSECUTIVE data sets includes magnetic tapes,
card readers/punches, direct access storage
devices, and paper tape readers. However,
for UPDATE files, only direct access devices may be used.
Both STREAM and RECORD I/O facilities
may employ data sets of this organization.
STREAM I/O is limited to this organization.

If two or more files are assigned to the
same data set or SYSOur class (via different DO statements) and are simultaneously
open for sequential output, then~ if the
PCP or MFT system is being used, the
records in the files will be intermixed or
the job will be abnormally terminated.
If
MVT is being used, the records will remain
separate. This practice is extremely dangerous and is not recommended.

The facility for reading BACKWARDS is
available only for files with records in
F,FB,FBS, or U format on 9-track magnetic
tapes, or 7-track magnetic tapes recorded
without the use of the data converter. If
the data converter is used, only string
records should be read BACKWARDS (Record
formats are described later in this chapter.)

There are three data set organizations
which are supported by PL/I object programs. Specification of data set organization is made by means of an option within
the ENVIRONMENT attribute, which is discussed further in Appendix B.

INDEXED ORGANIZATION

The organization of a data set determines the manner in which data is stored
within the data set and the permitted
techniques
of accessing it.
The PL/I

In INDEXED organization. the data set
consists of keyed records whose placement
within the data set is determined by the
value of the key. Since a key is associated with each record, direct retrieval,
replacement,
addition,
or deletion of
Managing Data

51

r-------T-------T-------------------------v-----·--r-------T--------------r-----T--------,
IOrgani-IAccess I
File Declaration
I
Istate- I
Options
IData IRecord I

ModE~
~zation I
I
I
Iment
I
I Mgmt. I Format
I
~-------+-------+------------~-----------+-------+-------+--------------+-----+--------~

I
I

J

I [BUFFERED]

I
I

I [BACKWARDS] 1 I

I INPU'l~

I READ

I
I
I
I
~------------+-------+-------+--------------i
IFIFBIFBSI
I
I
I
I
I
I WRITE I FROM
IQSAM I
I
I
t
I
IOUTPUT ~-------+--------------i
I
I
I
I
I
I
I LOCATE I [SET]
1
I
I
I
I
I
l·-------+-------+--------------i
I UI VI VB I
J
I [BUFFERED]
I
I READ
I [INTOIIGNOREI I
IVSIVBS I
I
I
I
I
I
SET]]
I
I
I
I
ICONSEC- SEQUEN-I[ENV
I
IUPDATE2~-------+--------------~
I
I
IUTIVE
TIAL
ICCONSECUI
I
I REWRITE I [FROM]
I
I
I
I
I TIVE)]
.------------+-------+-------+--------------+-----+--------i
I
I
I UNBUFFERED I INPUT I READ
I [INTOIIGNORE] I
I
I
I
I
I [BACKWARDS] ~ I
I
I [EVENT]
I
I
I
J
.------------+-------+-------+--------------~
I
I
I
I
I
I
IOUTPUT IWRITE IFROM [EVENT]
I
I
I
J
r-------+-------+--------------iBSAM IFIUIV
I
I
I
~
I
I UNBUFFERED I
I READ
I [INTOIIGNORE] I
I
I
I
I
I
I
I
I [EVENT]
I
I
I
IUPDATE .-------+--------------i
I
I
I
I
I
I
J
I
I
I
I REWRITE I FROM [EVENT] I
I
I
~-_-----~-------~------------L------------L-------~-------~--------------~-----~--------i
I~ BACKWARDS is available only for records of F, FB, FBS, and U format.
I

I

I [INTO I IGNORE I I
I
SET] I

I

12 UPDATE is not available for records of VS and VBS format.

)

I NO:!;!,:" The syntax notation used in this table is the same as that used in

IB~

I
I
I

I

._____________________________________________ JI
IL__________________________________________
§y2:!:.!!!!~1§.Q_QE!!:~:!:.in9._§.y2~!!!, PL/I Ref·erenc~~!!!!e.!.

.Figure 15.

CONSECUTIVE Data Set Organization and Applicable Language Features

records is possible, as well as se~uential
access of such records. The keyed records
of an INDEXED data set are located by means
of several levels of indexes which are
initially constructed when the data set is
created.
Keys for INDEXED data sets consist of
character strings, 1 through 255 characters
in length, defined by means of the DCB
subparameter KEYLEN(described later in this
chapter). Should the length of a character
string key specified in a KEY or KEYFROM
option differ from that specified by KEYLEN, it is truncated or padded with blanks
to KEYLEN.
Device support for INDEXED data sets is
restricted to direct access storage devices.
Basically, there are three areas
an INDEXED data set:

within

Prime data area
Overflow area
Index area
The prime data area is the area into
which records are inserted during creation.

52

Subsequent addition of records" when using
DIRECT access for UPDATE# may cause records
to be moved from the prime data area to an
overflow area, in order to keep the indexes
in order. Access to records in an overflow
area is slower than to those in the prime
data area; accordingly~ the data set should
be
"reorganized"
periodically
(see:
"Accessing of INDEXED Data Sets").
There are two types of overflow area:
1.

a cylinder overflow area (a certain
number of tracks per cylinder reserved
during creation)

2.

an independent overflow area, which
requires special DD statement usage
(see "Creation of INDEXED Data Sets").

The index area may be spread, physically, through the space allocated to the data
set. There are two basic index types, the
track index and the cylinder index; a third
type, the master index, is used if the
cylinder index becomes too large for efficient access.
The track index specifies the highest
key value for each track of a given cylin-

r--------T-------r------------------------~------~---------T-------------~------~-------,

10rgani- IAccess I
Ization I
I

File Declaration

I Mode I statement I

I

I

Options

IData

IRecord 1
IFormat 1

1Mgmt.

I

~--------+-------+---------~--------------+------+---------+-~-----------+------+-------~

I [BUFFERED I
I
I
I
UNBUFFEREDJIINPUT I READ

I
1
I
I
I
I
I
I
I

I [KEYED] 2

I

I

I [INTO I SET4

I [KEYTOIKEYJI
I
IGNORE)

I
I
IQISAM I
I (SCAN) I

~--------------+------+---------+-------------+------i

I [BUFFERED I
I
I WRITE
IFROM KEYFROM I
UNBUFFERED) I OUTPUT I
I
IQISAM
SEQUEN- ENV
I KEYED
I
~---------+-------------~ (LOAD)
TIAL
(INDEXED) I
I
I LOCATE4 I [SET] KEYFROMI

I

I
I
I
I

r--------------+------+---------+-------------+------~

t

I
I [BUFFERED ~
I
UNBUFFERED]
I [KEYED] 2

1

I

I [INTOISET4
I
I [KEYTO I KEY] I I
I UPDATE I
I
IGNORE]
IQISAM
I
.---------+-------------~ (SCAN)
I
I REWRITE I [FROM] 4
I

I

I

I

t---------+-------------~

I

I

I

I DELETE

1

I
I

I
I

I

I
I

I
I READ

I
I FIFB3

1

I

I
I

I

IINDEXED1~-------+---------+--------------+------+---------+-------------+------~

I
I

1

I
I

I

1

I

1

[KEYED]

I

IINPUT I READ
I
I

I

I

1

I

I

I
I

I
I

1
1

I
I

I

I

I

1

I
I
I
I

I

I

1
I
I
I
I

KEY
[EVENT]

I

I

I
I

I
I

I
I
I
I
I

I READ
I
1

I INTO KEY
[NOLOCK]
I
[EVENT]

I

1
1

1

I

I
1

I

t---------+-------------~

IFROM KEYFROM I
I
I [EVENT]
I BISAM 1
[EXCLUSIVE]IUPDATE~---------+-------------~
I
I
I REWRITE IFROM KEY
1
1
I
I
I [EVENT]
I
I

IENV
I
DIRECT I (INDEXED) I [KEYED]

I

I

I

t--------------+------+---------+-------------~

I
J

1 INTO

I

I WRITE5

I

I

I

t---------+-------------~
I DELETE 1KEY [EVENT] I
r---------+-------------~

I

I
I

I
I
I

1 UNLOCK

~--------~-------~---------L--------------L------~----

_____ LI KEY
_____________ LI ______ LI _______

~

11 INDEXED organization is supported only for direct access storage devices.
~

12 For INDEXED SEQUENTIAL INPUT and UPDATE, the file attribute KEYED must be declared

I if the KEYTO or KEY option on the READ statement is to be used. DIRECT access
I implies KEYED.
I3
1

Blocked records are not supported for UNBUFFERED files.

I

14 Locate mode I/O operations are applicable to BUFFERED files only.

I5
1

WRITE is ignored if NOWRITE is specified.

I

INot~ The synt:ax notation used in this table is the same as that used in IBM
LISys~~ill/36Q_QE~fatin9-§y~~~ill,
_______________________________________________________________________________________
J
PL/I Reference Manual.

Figure 16.

INDEXED Data Set Organization and Applicable Language Features

der;
the cylinder index specifies the
highest key value of each cylinder.
The
master index may be created (by specification of the NTM subparameter of the DCB
parameter in the DD statement) when the
cylinder index exceeds the specified number
of tracks. Each entry in the master index
points to a track within the cylinder
index. Up to three levels of master index
(addressing tracks within the next lowest
level master index) may be created automatically.

Records within an INDEXED data set are
either "actual" (representing still valid
data> or "dummy" (marked as deleted,
and
inaccessible to the user). Dummy records
are recognized only when both of the following are present:
1.

The DCB subparameter OPTCD
DD statement used to create
set.

=L

the

in the
data

Managing Data

53

r---------T-------T-------------------------T--·----T-------T-------------T------T-------,
IAccess I
File Declaration
I Mode ]State-,
Options
IData 'Record I

IOrganiIzation

I

I

,

,ment,

,Mgmt.

,Format I

r---------+-------+-------------T---------·--+------+-------+-------------+------+-------~

![BUFFERED] IINPUT /READ
/ [INTO'SET[KEYIBS~M2 I
, [KEYED] 2 ,
,
, TO] I IGNORE],
I
I
r-----------+------+-------+-------------+------i
I
I
I
I (BUFFERED] ]
I WRITE IFROM KEYFROM IBSAM I
I
JKEYED
'OUTPUT~-------+-------------i(LOAD) I
I
I
I
I '
I
"LOCATE '[SET] KEYFROM,
,
I
I
l
r-----------+------+-------+-------------+------1
I
I
I
I
I ' READ
I [INTO] SET[KEYI
I
,
I
I
I [BUFFERED] I
I
I TO] I IGNORE]
I
I
]
~
I
I [KEYED12
'UPDATE~-------+-------------iBSAM2 I
/
/
I
,
"REWRITE/ [FROM]
,
I
I
/SEQUEN-IENV
.-----------+------+-------+-------------+------i
I
ITIAL
/(REGIONAL(1) I 'UNBUFFERED I
I
I [INTO[KEYTO] I I
I
1
I
IREGIONAL(2) I J [KEYED] 2
I
IGNORE]
lBSAM I
IINPUT IREAD
I
I
IREGIONAL(3» ,
I
I
I [EVENT]
,
I
I
I
)
r-----------+------+-------+-------------+------i
I
I
I
IUNBUFFERED IOUTPUTIWRITE IFROM KEYFROM IBSAM I
I
/
I
I KEYED
I
I
I [EVENT]
, (LOAD) I
I
/
I
.-----------+------+-------+-------------+------1
/
I
I
I
I'
I [INTO[KEYTO] II
IREG(1) /
/
I
I
/ UNBUFFERED I
I READ
I
IGNORE]
I
I and (2) : I
I REGIONAL" I
I I [KEYED12
I UPDATE I
I [EVENT]
I BSAM I F only I
/

/

I

/
I

/
]

I
I
1

I

~-------+-------------+-----------+------+-------+-------------+------iFIUIV

/

I

/

/

/

I

J

I

I

I
/
I
I '
I
I
I
I
I
I

I

,
I
I
I

I
/
,

/

I

~-------+-------------i

/REWRITEIFROM [EVENT]

IINPUT /READ
I

,INTO KEY
, [EVENT]

l
/
,

,

/

'KEYED

~------+-------+-------------1

IFROM KEYFROM I
I
/
I [EVENT]
I
.-----------+------+-------+-------------1
/INTO KEY
IBDAM
,
/
I
JE N V ]
I READ
I [EVENT]
I (BSAM:
IDIRECT /(REGIONAL(1)/1
I
,[NOLOCK]
/LOAD)
~-------+-------------i
I
I REGIONAL (2) I I
]
I REGIONAL (3»
/
I WRITE I FROM KEYFROM i
I
I
I [EXCLUSIVE] UPDATE I
, [EVENT]
I
/
I
I [KEYED]
~------- +-------------i
1
I
1
IREWRITEIFROM KEY
I
I
I
I
I
I [EVENT]
I

/

I

I

I
I

1

I

1
1

I

I

I

I
I

I

I
I

I

I

/

,
I

IOUTPUT/WRITE

I

/

I
I
I
J

I
I
I
/

I
I

!
I

/
I

J

~-------+-------------i

I

I DELETE I KEY [EVENT]

I

/

I
1

~-------+-------------i

I

IUNLOCK IKEY

I

I

/

IREG(3): I

I

~---------L-------L-------------~-----------~------L-------L-------------L------L-------i

11
1
12
,
/

~

REGIONAL organization is supported only for direct access storage devices.

For REGIONAL SEQUENTIAL INPUT and UPDATE, the file attribute KEYED must be declared
if the KEYTO option on the READ statement is to be used (DIRECT access impli~s
KEYED). If the KEYED attribute is not declared, QSAM is used for REGIONAL(1) INPUT
and UPDATE.

I

/
1
I
,
/
/

/

The syntax notation used in this table is the same as that used in IBM
/
L _______________________________________________________________________________________
JI
'§y~~~m/l£Q_opeEatin~_§ystem
PL/I Reference Manual.

I~Q~~:

Figure 17.
2.

REGIONAL Data Set Organization and Applicable Language Features

A character whose value is (8)'1'B in
the initial position of the record.

Should either condition not apply, a given
record is not recognized as
a
dummy
(deleted)
record.
Should the OPTCD = L

54

subparameter be employed, the user is cautioned that unless care is taken to prevent
the unintentional presence of such an initial character (for example, cecause of
negative FIXED BINARY data), records may
vanish from the data set.

REGIONAL ORGANIZATION
There are three types of REGIONAL data
organization: REGIONAL(1), REGIONAL(2}, and
RE3IONAL(3}.
REGIONAL(1)
and (2) support
unblocked
F-format records; REGIONAL(3}
supports unblocked records of U, F, or
V-format.
In all tnree REGIONAL organizations, the
data set consists of regions numbered consecutively,
starting
at
zero.
In
REGIONAL(1)
and (2), each region contains
just one record.
In REGIONAL(3),
each
region is a whole track, containing as many
records as will fit onto the track.
The
actual number will depend upon the size of
the records and the device characteristics.
REGIONAL organizations support DIRECT
access of records by directly locating the
region in which the record is placed and
then, if necessary, performing a sequential
search for the specified record in the
vicinity of the located regiono REGIONAL
organizations
also
support
SEQUENTIAL
access of records.
A major advantage of REGIONAL organization is that it permits program control
over the relative physical placement of
records.
Accordingly,
optimization
of
record access in terms of particular application requirements and device capabilities
can be obtained by judicious programming.

it takes the form of a character string
which is actually written in the data set
attached to tne record, and is known as the
~rded_!s§.y.
The recorded key consists of
the initial n characters of th~ source key.
where n is the number specified in the DCB
subparameter KEYLEN.
If the source key
specified in the KEY or KEYFROM option is
not equal in length to the number specified
by KEYLEN. the source key is either padded
with blanks or truncated (on the right)
before being written with the record as the
recorded key or compared with existing
recorded keys in the search for a particular record.
The relationship between the portion of
the source key which represents th~ region
number of the record (i.e., the last eight
characters of the source key)
and the
portion which constitutes the recordej key
(i.e.,
the
first n characters, where
KEYLEN = n) should be carefully considered.
Some possibilities are illustrated below.
Note that all the examples
refer
to
REGIONAL (2)
or (3).
In REGIONAL ( 1 ), there
is no recorded key, and any characters in
the source key other than the final eight
are ignored.

Source key of 16 characters; KEYLEN
8 9

8

16

r--------T--------,
I

I

J ________ L ________ J
L

Characters 9 through 16 represent the
region number; characters 1 through 8
are used as the recorded key.
Two types of key are used with REGIONAL
organizations: source keys and recorded
keys.
Source key of 12 characters; KEYLEN
The §'Q.~f£~ __!s§'Y is a character string
specified in the KEY FROM option of a WRITE
or LOCATE statement or in the KEY option of
a READ,
REWRITE, or DELETE statement. In
the WRITE statement, its purpose is to
determine whereabouts in the data set a new
record will be written; in the READ, REWRITE, or DELETE statement, its purpose is
to identify the record which is to be read,
rewritten,
or deleted.
The last eight
characters of the source key (or all of it.
if there are less than eight) represent the
region
number
of
the
record.
In
REGIONAL(1), any additional characters in
the source key are ignored.
In REGIONAL(1}, the region number alone
is sufficient to determine the location in
which a record will be placed and to
identify it for retrieval. In REGIONAL(2)
and (3) (as will be explained below), a
further means of identification is needed;

5

8

8

12

r----'T----T----l

IL ____ LI ____ LI ____ JI
Characters 5 through 12 represent the
region number; characters 1 through 8
are used as the recorded key.
Example 3:
Source key of 8 characters; KEYLEN

8

8

r--------,
I

I

l ________ J

Characters 1 through 8 represent the
region number; characters 1 through 8
are also used as the recorded key.
Managing Data

55

Source key of 6 characters; KEYLEN
6

r------,

12

12
REGION L(1) Data Sets

IL ______ JI
Characters 1 through 6 represent the
region number;
characters 1 through 6
are padded on the right with blanks to
make 12 characters, which are then used
as the recorded key.

Source
KEYLEN

key
16
10

3

r--T--------l

IL __ LI ________ JI

of

10

characters;

16

--,

I

__ J

Characters 3 through 10 represent the
region number; characters 1 through 10
are padded on the right with blanks to
make 16 characters, which are then used
as the recorded key.

Source key of 16 characters; KEYLEN
1

6

the KEYTO option can only be guaranteed if
the length of the KEYFROM value is equal to
that specified by KEYLEN.

9

=6

A
REGIONAL(l)
data set consists of
unblocked F-format records without associated recorded keys.
The data set is
divided into regions each of which is large
enough to con~ain just one record,
hence
each region number corresponds to a relative record position within the data set.
The location of a particular record can be
determined by the source key alone.
The
final eight characters of the source key
are the character-string representation of
an unsigned decimal integer not exceeding
16777215, and may contain only the characters 0 through 9 and blank. If more than
eight characters are given in the KEY or
KEYFROM option, only the last eight are
used; otherwise all characters are used.
If
the
KEYTO
option
specifies a
character-string
variable of more than
eight characters, the source key value
returned is padded at the left with blanks;
if it has fewer than eight characters, the
value is truncated on the left without
raising any condition.

16

r------T--r--------,

IL______ LI __ LI __ ------1J
Characters 9 through 16 represent the
region number; characters 1 through 6
are used as the recorded key. Characters 7 and 8 are not used.
From the above illustrations, it can be
seen that it is optional whether the region
number portion of the source key is included in the recorded key. Similarly, the KEY
option may sp'ecify a source key longer than
the recorded key, thereby causing a search
for a key matching only the initial n
characters of the source key, where n is
defined by KEYLEN; this facilitates reading
data
sets created by other processors
(e.g., COBOL, which has a different source
language keying mechanism).
SEQUENTIAL access of REGIONAL data sets
will retrieve records in the order in which
they are physically located in the data
set.
The recorded key will not affect the
sequence, but can be obtained by use of the
KEYTO option.
Equality between the value specified by
the KEYFROM option and that subsequently
assigned to a character string by means of
56

A
REGIONAL(2)
data
set
contains
unblocked F-format records with associated
recorded keys. As in REGIONAL(1), the data
set is divided into regions each of which
will
hold
just
one
record.
Unlike
REGIONAL(1) however, in REGIONAL(2) organization a particular record will not necessarily occupy the relative position specified by the region number in the source
key.
When writing a new record in a data
set opened for DIREcr access. the location
in which the record will be written is
determined as follows. A search is commenced at the beginning of the track containing the region number specified by the
source key.
The record is written in the
first available position on that track or,
if that track is full,
on a subsequent
track. The record maYI therefore, be written either before or after the specified
region number, depending on the availability of space.
The search for a vacant
position can, however, be limited by the
DCB subparameter LIMCT.
(The use of LIMCT
in REGIONAL(2) is described below.) Similarly, when accessing a record
in
a
REGIONAL(2) data set opened for DIRECT
access, the record is located as follows.

REGIONAL(3) Data Sets

Commencing at the beginning of the track
containing the specified region number, a
sequential search is made for a record
whose recorded key matches the source key
(truncated or padded as required). Again,
tne extent of the search can be restricted
by the use of the DCB subparameter LIMCT.

A REGIONAL(3)
data set may
contain
unblocked records of U,F, or V-format, with
associated recorded keys.
The data set is
divided
into
regions,
but
unlike
REGIONAL(1) and (2), in REGIONAL(3)
a
region is a whole track on the directaccess device. The region number in the
source key thus corresponds not to
a
relative record position, but to a relative
track on the device. The number of records
within any region will depend on the record
sizes and the device characteristics.

The DCB subparameter LIMCT limits the
number of regions which are to be sequentially searched.
In
REGIONAL(2),
the
search commences at the beginning of the
track containing the region number specified by the source key, and continues to
the end of the track containing the region
whose number is given by:
region number specified in source key
LIMcr value - 1

When writing a new record in a data set
opened for DIRECT access, the location in
which the record will be written is d~ter­
mined as follows.
A search is made for an
available position, commencing at the start
of the track whose relative position is
represented by the region number in the
source key.
The record will be written in
the first available position on that track,
or, if that track is full, on a subsequent
track. The search can, however, be limited
by use of the DCB subparameter LIMCT.
(The
use of LIMCT in REGIONAL(3) is described
below.> Similarly, when accessing a record
in a REGIONAL(3) data set opened for DIRECT
access, the record is located as follows.
Commencing at the beginning of the track
whose relative position is representEj by
the region number in the source key, a
sequential search is made for a r~cord
whose recorded key matches the source key
(truncated or padded as required).
Again,
the extent of the search can be restricted
by use of the DCB sUbparameter LIMCT.

+

Each track of a device holds
ten
records. The final eight characters of
thE~ source key represent the number 17.
LIMCT has the value 15.
The sequential search will commence at
the start of track 2 (since region
number 17 is on this track) and continue through to the end of track 4 (since
region number 31u given by source key
region number + LIMCT value - 1, is on
track 4).
It can be seen from the foregoing that,
in REGIONAL(2) " the nearer a record is to
the beginning of a track, the more quickly
can the record be accessed.
REGIONAL(2) organization does provide a
degree of device independence. Provided
that access to the data set is DIRECT and
that all keys are unique, the programmer
does not need to modify his algorithms in
consideration of the device type.
If,
however, a data set created or updated by
DIRECT access is subsequently read
by
SEQUENTIAL access, then the order in which
the records are read will vary slightly
according to the type of device.

The DCB subparameter LIMCT limits the
number of regions which are to be sequentially
searched.
In REGIONAL(3)~ ~ach
region is a track, hence the value s~eci­
fied in LIMCT qUite simply specifies the
number of tracks which are to be searched.
The final eight characters of the source
key are the character-string representation
of an unsigned decimal integer not exceeding 32767, and may contain only the characters 0 through 9 and blank.
If more than
eight characters are given in the KEY or
KEYFROM option, only the last eight are
used as the region number; otherwise all
characters are used.

The final eight characters of the source
key are the character-string representation
of an unsigned decimal integer not exceeding 16777215, and may contain only the
characters 0 through 9 and blank. If more
than eight characters are given in the KEY
or KEYFROM option, only the last eight are
used as the region number; otherwise all
characters are used.
If the
KEYTO
option
specifies
a
character-string variable
of
different
length from that of the recorded key, the
recorded key returned is padded with blanks
at the right or truncated at the right; no
condition is raised.

If

the

KEYTO
option
specifies a
variable of length different from that of the recorded key,
the
recorded key returned is padded with blanks
at the right or truncated at the right: no
condition is raised.
char~cter-string

I

Note~

The EVENT option should be used with
caution when v- or U-format records are
being added to a REGIONAL(3) data set.
Managing Data

57

Dummy Records within RE3IONAL Data Sets
Records within a REGIONAL data set are
either "actual"
(representing valid data>
or "dummy"
(inserted during creation or
when actual records are deleted>.
Dummy
records vary in format according to the
REGIONAL type and, in the case of REGIONAL
(3), according to the record format as
well.
See also the section "Accessing of
REGIONAL Data Sets."
REGIONAL(1) - initial character of record
has the value (8) '1'B; the remainder
of the record is undefined.
REGIONAL(2) - initial character of recorded
key has the value (8)'1'B, the remainder of the key being undefined;
the
initial character of the record is an
internal
representation
of
the
sequence number of the record within a
track,
the remainder of the record
being undefined.
REGIONAL(3) - if F-format records, as for
REGIONAL (2).
If U- or
V-format
records,
the initial character of the
key has the value (S)'1'B, the remainder of the key being undefined.
If
V-format,
the control bytes of the
record are valid, but the remainder is
undefined.

personnel familiar with requirements at a
given installation (see Appendix E).
Also,
use of cataloged data sets will reduce the
amount of configuration knowledge required.

S~ECIFYING

DATA SETS

Data sets in the operating system can be
specified by parameters in the DO statement.
This section describes the use of
such DD statements.
The DO statement provides the
functions:

following

1.

Naming of the data set (DSNAME)

2.

Extent allocation,
i.e.,
device and
space (UNIT, VOLUME. SPACE, LABEL)

3.

Disposition (DISP, SYSOUT)

4.

Data set attributes (DCB)

The functions are summarized in the
following paragraphs.
For full details
refer to the publication IBM __ £Y~~~Ll~Q
Qfera~in~~yste~L_~QQ_fQgifQ!_1~gg~~~·

DATA SET DEFINITION
------------------Whereas the attributes of a file
(which
may be considered to be a "data set usage")
are declared within a PL/I program, the
attributes of ~ts associated data set are
specified by means of the DD statement or
the ENVIRONMENT attribute.
(For the format
of the options available in the ENVIRONMENT
attribute, refer to Appendix Be)
In this
manner a large degree of device independence is achieved.
rhe DO statement permits the specification of object
time
device type,
unit assignment, record format" etc.
Since PL/I itself does not define data
set attributes, there are no default attributes,
witn the exception of PRINT files
which have a default of the V-format,
with
unblocked records of 129 bytes. Information regarding specific data sets is communicated to the Operating System via DD
statements. It is not, however,
necessary
for each programmer to understand
the
details of DD statements: in some instances
the use of cataloged procedures will allow
the programmer to be oblivious of the
particular I/O device configuration. These
cataloged procedures will be prepared by
58

The DSNAME ~arameter allows the programmer to specify the name of a newly defined
data set or to refer to a previously
defined data setu
rhis parameter should De
supplied for all but temporary data sets.
Note: Data set names that begin with the
letters SYS and have a P as the nineteenth
character of the name should not be used.
Data sets with such names are created for
temporary data sets on PCP systems, but not
for temporary data sets on MVT or MFT
systems, and are deleted when the IEHPROGM
utility is used and the SCRATCH utility
control statement is specified with the
VTOC, PURGE, and SYS keywords.

The UNIT parameter allows the programmer
to state the
type
and
quantity
of
input/output devices to be allocated for
the data set. The type of unit is specified by a symbol that refers to a collection of one or more devices.

The VOLUME parameter is used to specify
the identification of the volume on which
the data set resides.
Other information
includes instructions to the system for
volume mounting actions.
The SPACE parameter permits the specification of the type and amount of space
required to accommodate the data set on a
direct-access
device.
This
space is
obtained either from the volume designated
in the VOLUME parameter or from the volume
mounted on one of the devices specified in
the UNIT parameter.
The LABEL parameter specifies the type
and contents of the label or labels associated with the data set.

The disposition (DISP) parameter indicates the current status of the data set
and what is to be done with it when the
step is completed. Parameters are provided
to delete the data set, to pass the data
set to another step within the same job, to
enter the data set name into the catalog,
or to remove the data set name from the
catalog.
DISP must be carefully specified when
the EXCLUSIVE attribute is used.
This
attribute protects records against access
by different tasks in the same program.
provided the references to a data set are
made by means of the same file.
DISP=OLD
ensures that a data set is used by one job
onlYi DISP=SHR allows a data set to be used
by different jobs. If a data set is to be
updated by more than one job, DISP=SHR must
got be specified.
The system output (SYSOUT) parameter is
used to schedule a printing or punching
operation for the data set described by
this DD statement.

The DCB parameter allows the programmer,
at execution time, to complete information
declared for his file at the time of
compilation via a FILE declaration or OPEN
statement.

File Att,ributes._and the DD Statement
The DCB parameter of the DD statement
permits object-time definition of various

data set characteristics.
Whereas
the
other DD statement parameters deal chiefly
with the physical residence of a data set,
or aid in data set identification. the DCB
parameter may specify information required
to process the data records themselves.
Information supplied to the object program
by means of the DCB parameter can only De
"additive" information, i.e., it may not
override information already established
for a data set during compilation.
DCB
subparameters which specify DCB
fields
already completed during compilation (by
means of the file declaration or OPEN
attributes) will be ignored.
DCB sUbparameters which may be specified
for STREAM-oriented I/O are listed in Figure ~8. The DCB subparameters which may be
specified in the PL/I language for this
mode of I/O are:
RECFM
BLKSIZE
LRECL
BUFNO
The first three are specifiable by means
of the record option of the ENVIRONME~T
file declaration attribute (see Appendix
B)i the fourth is specified by means of tne
BUFFERS option. In addition, the LINESI~E
attribute of the OPEN statement for PRINT
files may specify the initial three subparameters to be established by default; see
the section called "PRINT Files."
DCB sUbparameters which may be specified
for RECORD 1/0 include those available for
STREAM I/O.
Additional subparameters are
listed in Figure 19.
Data set information supplied within the
PL/I program may not be overridden by DD
statement parameters, or data set label
information (in the instance of directaccess devices, the DSCB). Accordingly,
files which are to remain open to objecttime definition of data set characteristics
must not specify these
characteristics
within a program.
(It should be noted that
data sets which are defined by a "DD *"
statement are supplied with full DCB subparameters by the Operating System.) Data
control blocks generated by the PL/I "open"
process at object time are of a format
which allows complete device-type independence when applicable. During various executions of a program, a file may be associated with a card reader,
paper tape,
magnetic tape, or a direct-access device.
Managing Data

59

r---------T------------------------------------------T----------------,
Specifies
I PLiI Option
I

I Keyword I

~---------+------------------------------------------+----------------~
I BLKSIZE I Maximum, or fixed, number of bytes per
I ENV (Record)
I
I
I physical record (block)
I LINESIZE
I
,---------+------------------------------------------+----------------~
I LRECL
I Maximum, or fixed, number of bytes per
I ENV (Record)
I
I
I logical record
I LINESIZE
I
r---------+------------------------------------------+----------------~
I RECFM
I Record format and characteristics (usage I ENV (Record)
I
I
I of printer/punch control character)
I LINESIZE I
I
I
I
I
I PRINT

r---------+------------------------------------------+----------------i
I BUFNO
I Number of buffers for physical record
I ENV (BUFFERS) I

I
I transmission
I
I
r---------+-------------------------·-----------------+----------------~
I CODE
I Paper tape: code in which the data was
I
J
I
I punched
I
J
r---------+------------------------------------------+----------------~
I DEN
I Magnetic tape: tape recording density
I
I

.---------+------------------------------------------+----------------1
I TRTCH
I Magnetic tape: tape recording technique I
I
I

I for 7-track tapes

I

I

t---------+------------------------------------------+----------------~

I MODE
I

I Card reader or punch: mode of operation, I
I column binary or EBCDIC
I

I

I

I ( 0, 1, 2, or 3)

I

r---------+------------------------------------------+----------------1
I STACK
I Card reader or punch: stacker selection I
I
t---------t-------------------------------·-----------+----------------i
I PRTSP
I Spacing of printer between each line
I
I
I

t---------t------------------------------------------+----------------i
I OPTCD
I Optional data management services and
I
I

IL_________ I __________________________________________
data set attributes
I ________________ j I
~

Fig~re

18.

~

DCB Subparameters for STREAM 1/0

r---------T-------------------------------·-----------T----------------,
I Applicable
J

I
I
I Keyword I

Specifies

I Organization

I

I REGIONAL
I ( 2) and (3)

I

r---------+------------------------------------------+----------------1
1 KEYLEN
I Number of characters in recorded key
I INDEXED
I
I
I

I
I

J

r---------+------------------------------------------+----------------~
I LIMcr
I Maximum number of records or tracks
I REGIONAL
)
I
I to be searched
I (2) and (3)
I
t---------+------------------------------------------+----------------~
I RKP
I Relative key position within record
I INDEXED
I
r---------+------------------------------------------+ ----------------~
I NTM
I Number of tracks in cylinder index
I INDEXED
I
I
I per master index entry
I
J

r---------+-------------------------------·-----------+----------------i
I CYLOFL I Number of overflow tracks in each
I INDEXED

J

I

I cylinder

I

I

r---------+------------------------------------------+----------------i
I DSOR3
I Creation of INDEXED or
I INDEXED
I

I
I REGIONAL data set
I I

I REGIONAL
I
I ( 1) , (2), and (3) I

t---------+-------------------------------·-----------+----------------~
I NCP
I Number of channel programs allocated
I All
I
LI ________________ JI
IL_________ LI __________________________________________
to a file

Figure 19.

60

Additional DeB Subparameters for RECORD I/O

The format of the DCB subparameters is
given in the following paragraphs. Refer
to Appendix B for the format of the ENVIRONMENT option.

RECORD FORMAT INFORMATION
The notation used in the format descriptions of record format is interpreted as
follows:
Upper case letters and numbers must
coded by the programmer exactly
shown.

be
as

Lower case letters represent variables
for which the programmer must substitute specific information or specific
values.
Items or groups of items within brackets [] are optional.
They may be
omitted at the programmer's discretion.
A logical OR sign
of option.

~

indicates a choice

The
PL/I programmer may
access data sets which consist
the following types of record:

create and
of one of

Fixed-length (F-format) records
Undefined-length (U-format) records
Variable-length (V-format) records
whichever record type is used, data is
transmitted to and from main storage, and
written on external storage in blocks. A
block is considered to be either the data
between two interrecord gaps in the case of
magnetic storage devices such as disks and
magnetic tape, or the number of bytes which
can be transmitted to or from a unit record
device, such as a line printer or card
reader, in one input/output operation.

separate block.
The
interrecord
gap
between blocks delimits undefined-leng~h
records when held on an external s~orage
medium, such as magnetic tape or disk.
Variable-Length Records: A variable-length
(V-format) record consists of a four-byte
control field containing the number of
bytes in the record# including the control
field, followed by bytes containing data.
A variable-length record is transmitted in
a block formed by one or more such records.
The length of the block depends on th~
number and length of consecutive variablelength records which can be accommodated
within the maximum block size specifieo.
The
block itself contains a four-byte
length
field
to determine its actual
length, including the control field.

Variable-length
records can also be
specified
as
~~nned
eVS-format
or
VBS-format) records.
Spanned records are
written over block boundaries in order ~o
enable maximum-length blocks to ce used in
conjun~tion with
variable-length records,
thereby permitting efficient use of external storage. A spanned record is a logical
record which can be divided into segmen~s
which are written on separate consecutive
blocks. Each segment contains a four-byte
control field to indicate the length of the
segment, including the control field, and a
flag byte to designate a segment as th~
first, intermediate, or last segment of a
logical record which spans blocks. If a
complete
logical record does not span
blocks, i.e., it is contained entirely
within one block, it is designated as the
last or only segment of the logical record.
Spanned records are created and retrieved
automatically, and their use in no way
affects the programmer. Data sets containing spanned records must be CONSEcurIVE.
They can be opened as INPUT or OUTPUT
files, but not as UPDATE files.

Fix~d-~eB~_E~2££~~

A
fixed-length
(F-format)
record consists of a predetermined number of bytes, and is transmitted
in a block containing one or more of these
records. The length of a block containing
fixed-length records is an exact multiple
of the record length used.
If unblocked
records are specified,
each record
is
transmitted and stored as a separate block.
Undefined-Lenqth __ Recor~s~
An
undefinedlength (U-format) record simply consists of
a string of bytes containing data.
Each
record is transmitted or stored as
a

Block Size
BLKSIZE=nnnnn: the decimal integer specified must not exceed 32,760, and may
be limited by the device used, such as
a unit record device. Blocks to contain V-format records must exceed the
maximum record length by four bytes,
for control purposes. Blocks to contain VS- or VBS-format records may be
shorter than
the
maximum
record
length.
Managing Data

61

LRECL=nnnnn: the decimal integer specified
must not exceed 32,760 bytes for Fformat records, and 32,756 for Vformat
records.
The
LRECL
subparameter specifies the length of
fixed-length records, and the maximum
length of V-format, VS- and VBS-format
records.
It is not specified for
U-format records for which the maximum
length is 32,760 bytes. If not specified for the v-, VS-, or VBS-format,
or F-format records, the BLKSIZE specified is assumed. For VS-, VBS- or
V-format records, a four-byte control
field must be included in the LRECL
quantity. An extra byte must be added
for all record formats which include a
printer/punch control character. This
includes all PRINT files, which use
ASA printer control characters.
Note that for INDEXED data sets which
contain blocked records, if RKP=O the
value of LRECL must include the number
of bytes required for the recorded
key.

RECFM=

U [T][AIM]
[S]

[B]

F

[B] [S] [T] [A I M]

The record
follows:

[T]

[AI

V

M]

format

is

specified

as

U: Undefined-length records
V: Variable-length records
F: Fixed-length records
The additional subfields are indicated
by the following:
B: Blocked records
S:

S:

62

(F-format records only) Standard: no blocks of a length less
than the specified blocksize,
except possibly the last, are
present in the data set
(V-format records only> Spanned
records: variable-length records
can span maximum-length blocks.
A spanned record is
written on
one or more consecutive blocks.
The length of the spanned record
can exceed the length of the
maximum-length block.

For variable-length
VS-format
records the maximum block size
must
always
be stated. VSformat records that exceed the
maximum
block
size
are
segmented, and the segments are
placed in consecutive blocks.
Each block can contain only one
record or segment of a record.
For example, if a record format
is specified as VS(SO,200),
an
ENV or DeB record that includes
180 bytes of data will appear in
the data set as two blocks of 80
bytes (S control bytes and 72
data bytes) and one block of 44
bytes (8 control bytes and 36
data bytes).
Varying-length
VBS-format
records are similar to VS-format
records except that they are
blocked, that is, each block
contains
as
many
complete
records or segments of recoris
as it can accommodate;
each
block is substantially the same
size, although there can be a
variation of up to four bytes,
since each segment must contain
at least one byte of data. For
example, a block might contain
the last segment of one record,
one or more complete records,
and the first segment of another
record.
T: Track OverflowD Track overflow
is a feature of System/360 operating system which can be incorporated
at system generation
time; it requires the record
overflow feature on the direct
access
storage control unit.
Track Overflow allows a record
to overflow from one track to
another.
It
is
useful in
achieving a greater data packing
efficiency, and allows the size
of a record to exceed the capaci ty of a track.
Note: Track overflow
is
not
available for REGIONAL(3) data
sets with U- or V-format records
or for INDEXED data sets.
A: ASA printer/punch control characters are present within the
records
M: Machine code printer/punch control characters
are
present
within the records
The following figures
various record formats:

illustrate

the

r--------,

If the file is a PRINT file, the initial
byte of the data portion of each logical
record is reserved for an ASA printer
control byte.

1________
Data J1
L
U-Format Record

r--------,

1________
Data J1
L
F-Format Record

r--------T--------,

r--------,

Blocked records are not accepted from
paper tape. Fixed-length records on paper
tape have a fixed number of characters
after translation; the number of characters
before translation is not fixed.

1________
Data 1________
Data J1••• 1
Data J1
L
L________
~

F-Format (Blocked) Record

r--T--T--------,

IC"IC
Data JI
2 1________
L__ J. __
~

Use of the Various Record Formats in

STREA~
I/Q---------------------------------

V-Format Record

r--T--T--------T--T--------,

r--T-------,

IC,,/C
Data LIC
Data J/ ••• IC
Data JI
2 L1________
2 L1_______
2 Ll ________
L
__ __
__
L__
~

V-Format (Blocked) Record
r--T--T----------~

r--T--T------,

I
IL __________ J1
L __I__

1L __ J.I __ L1______
1
.JI

IC~IC2J

Record 1 I

~

r--T--T--------,

1L __
C" 1__
C2 1________
Record 2/J
~

~

Ic~lc2IRecord/

r--T--T--------,

1L __
Cl'I 1__
C2 1________
Record 31J
~

~

VS-Format (Spanned) Records

r--T--T------T--T------,

IC1lC2]RecordlC2lRecordl
1__ 1__ LI ______
1
I __ J.1.2
L
______ .JI
~

~

r--T--T----------------l

Record 2
lIC~IC21
__ __ ________________
J]
~

~

r--T--T------T--T------,

I C!lIC 2 IRecordIC 2 )Record]

2
I __ LI ______
3
lI __ 1__ LI ______
J1
~

~

VBS-Format (Blocked Spanned) Records
The control field C. (four bytes) specifies the total byte count of the block
(including C~);
the field C2 (four bytes)
specifies, for each logical record, the
byte count of the logical record (including
C2 ).
In the figure depicting
spanned
(VS-format)
records, the field C2 contains
the number of bytes including C2 , in the
segment of a spanned record that is written
on a particular block.
Field C2 also
contains a flag to indicate the relative
position of any segment of a spanned record
within a logical record which is written on
one or more blocks. It designates a segment as the first, intermediate, last, or
only segment of a record. The flag is set
and used automatically when this type of
record format is specified.

The
three available record formats,
undefined,
variable-length,
and iixe3length, must each be considered for its
application to the features of STREAM I/O.
The following points should be consijercd
when making a choice for OUTPUT files.
Variable-L~~~~ Rec££~~~
The
variab12length record format is the most versatile
of the three available formats.
In order
to prevent the output of possible 'noise'
records, i.e., records of less than the
System/360 operating system standardizei
minimum length, the records for output
files are padded to contain at least ten
data characters. With the addition of tne
eight bytes required for
the
control
fields, this gives a total of 18 data
characters. Accordingly,
LINESIZE should
not specify a value less than 10 (9 for
PRINT files, because a control character is
required) •

Fixed-Le~RecorQ~~
For output files-as the printing options/format items have
the ability to truncate a record (line),
each record is padded with blanks when the
following record is prepared for output.

Blocked output is not supported on unit
record devices, where each logical record
begins on a new card or line. For example,
specification
of
recordsize=20,
blocksize=80 for a card punch will result
in only the first 20 columns of each card
being punched.
If these cards are then
read in, the stream will contain 60 blank
characters between each of the original
records.
Also,
the length of logical records
should not exceed the physical size of each
unit record, as the excess characters will
be truncated without notification.
Managing Data

63

Use of the Various Record Formats in RECORD
I/O
Data transmitted by a single RECORD I/O
statement is always contained within a
single record, the size of which should be
large enough to hold the data aggregate
being transmitted, yet small enough to
conform
to device restrictions on the
length of records which may be transmitted.
Determination of the record length required
for the various formats of data aggregates
may require the information available in
the section "Structure Mapping" in Appendix
C of this publication; similar calculations
are required for determination of space
required for array data aggregates.
It should be noted that when a data
aggregate is moved into a record buffer, or
transmitted immediately from the area in
which the data aggregate is stored, no
"padding bytes" are added before or after
those bytes defined by the aggregate (or
string). The current length of a variablebit string will be such as to terminate the
s~ring on a byte boundary.
Another
consideration
affecting the
transmission of data aggregates is the fact
that the implementation includes locate
mode I/O. This allows data to be processed
in the input/output buffers. Therefore a
programmer who is creating files to be read
using READ statements with the SET option
should bear in mind that:
1.

2.

The first byte in a block read from a
file will be aligned in the buffer on
a doubleword boundary.
If any data within any record in the
block has an alignment requirement,
this requirement must be preserved in
the buffer when the record is read in.

For all record formats, this first byte
is,
with one exception, the first byte of
data in the first record of the block. The
exception is for FB-format records in an
INDEXED file where RKP=O; here the first
byte of the key of the first record is
aligned on the doubleword boundary. The
following information, if present, precedes
this double word boundary:
1.

Keys for F-format INDEXED files or for
REGIONAL files.

2.

Control fields for
records.

V-

and

VB-format

The user must be aware that, for the
subsequent records in the buffer. the presence of keys and control fields will
affect the alignment of the data elements
in these records.
64

There are several constraints regard~ng
record format in RECORD I/O which depend
upon the data set organization and the
manner in which it is accessed.
CONSECUTIVE Records:
V-, VB-, VS,- and
VBS-format data sets may not be read BACKWARDS.
INDEXED Records:
Only
records are available.

F-

REGIONAL(1) and (2) Records:
records are available.

and

FB-format

Only F-format

REGION L(3) Records:
Record formats U,F,
and V-are available;-i.e., records cannot
be blocked.
Additionally~
there
are
various
overheads which apply to the use of different
formats within different data s~t
organizations. The choice between BUFFERED
and UNBUFFERED for SEQUENTIAL files may
depend upon the time and space overheads
outlined, as may the choice between tne
record formats U and V for REGIONAL(3) data
sets.
In the following details, the term
"hidden buffers" refers to work buffers
allocated by the object program library to
provide special areas for the actual transmission of records to and from the data
set,
even though the file is declarea
UNBUFFERED or DIRECT.

UNBUFFERED access of CONSECUTIVE data
sets employs hidden buffers if V-format
records are used, in order to handle tne
V-format control bytes.
An INDEXED data set always requires hiaden buffers in order to handle a special
10 byte control field.
A REGIONAL data set accessed sequentially, and declared KEYED, requires hidden
buffers (except for REGIONAL(1» to handle both the key and the record,
which
must be transmitted to and from contiguous storage areas.

Use of Spanned Records
The blocksize (BLKSIZE) used for spanned
records can be selected independently of
the record lengths likely to be encountered.
It should be chosen with regard to
attaining efficient use of external storage
combined
with
efficient
use
of
processor-I/O overlap.
For instance, the
block size seleGted for use on a 2311 disk
store should be the correct part of one
track, to ensure that the entire track is
used and that efficient processing
is
achieved.

Chained Scheduling
When READ SET is used with spanned
records, each record is built up from its
segments in an additional area (buffer)
supplied by the PLiI library, and the
pointer is set to address this area; the
record is not processed in the data management buffer.
Similarly, with LOCATE, a
record for output is built up in a library
area before being passed to data management
for segmentation and transmission. Consequently, the advantage gained by using
locate mode is lessened if the records are
spanned ..

OPTCD=C
Specifies chained scheduling, which
improves input/output performance by
reducing the time required to transmit
records to and from external devices.
If this option is specified with QSAM,
it is recommended that at least three
buffers are specified for the file:
with BSAM, the number of channel programs should be at least three.
If BSAM or QSAM are used, then chained
scheduling will not be used for INPUT or
UPDATE with U-format records.

BUFNO=n; the decimal constant must be less
than 256.
If a file is declared BUFFERED,
but
the number of buffers is not specified
or is specified as zero, the number is
assumed to be 2.
Performance
is
not
necessarily
improved by specifying a large number
of buffers.
Generally, the use of
more than two gives little improvement.
In some circumstances, however,
more may be required;
for example,
chained scheduling requires at least
three.

CODE=IIFIBICIAITIN. where the codes
fy:

speci-

I: IBM BCD perforated tape
and
transmission code (8 tracks)
F: Friden (8 tracks)
B: Burroughs (7 tracks)
C: NCR (8 tracks)
A: ASCII (8 tracks)
T: Teletype (5 tracks)
N: No conversion (F-format recoras
only>
If no code is specified, I is assumed.

NCP=n: the decimal constant must not exceed
99.
Specifies the number of channel programs allocated to the file when it is
opened.
The number of incomplete
input/output operations may not exceed
the number of channel programs.
This
option is available only for DIRECT
access to INDEXED data sets or for
UNBUFFERED SEQUENTIAL access to CONSECUTIVE or REGIONAL data sets. The
default value assumed if the option is
not specified is 1.
An attempt to exceed the appropriate
number of
incomplete
input/output
operations will have one
of
two
results.
For UNBUFFERED SEQUENTIAL
access to CONSECUTIVE or REGIONAL data
sets, the ERROR condition will be
raised.
For DIRECT access to
an
INDEXED data set, the operations, will
be queued until a channel program
becomes available.

DEN=011121 3

r-------T-------------------,
I
I Bytes per Inch
I
I DEN ~---------T---------~
1 Value I 7-track I 9-track I
~-------+---------+---------~
I
0
I
200
I
I
I
1
I
556
I
I
I
2
I
800
I
800
I
IL _______
3
1600
LI _________ LI _________
JI

The density assumed, if none is specified, is:
7-track
9-track (one density>
9-track (dual density>

200
800
1600

Managing Data

65

Conversion

(Magnet!£-1~e

after printing each line; a value of 3
will cause 2 blank lines to appear
between each printed line.

- 7-track)

TRTCH=CIEITIET
C: Data conversion feature is used
E: Even parity
T: Translation from BCD
required
ET:

(Both E and

r,

to

This
parameter is ignored if the
record format uses ASA control characters.

EBCDIC

above)

This subparameter is required only for
7-track magnetic tape data sets.
Use of a tape recording technique
other than TRTCH=C restricts the character set in which data can be written
if it is subsequently to be reread and
result in the same bit-configuration
in storage.
In PL/I terms, for STREAM and RECORD
iqput/output of character strings or
pictured data,
acceptable modes are
TRTCH=CIT (with TRTCH=ET acceptable if
characters
are
restricted to the
48-character
set).
For
RECORD
input/output
of
arithmetic
data,
TRTCH=C must be used.

OPTCD=U
If a printer has the universal character set feature~ the TRANSMIT condition is normally raised when an invalid character is passed to the printer.
Specifying OPTCD=U suppresses the condition.
Either way, a blank character
is printed.

op~rCD=W

W: Perform write validity
check
when writing on a direct-access
device.
MODE=CIE
C: Column binary card images
E: EBCDIC card code
op~rCD=L

STACK=112

Specifies
that
records within an
INDEXED data set are to be recogniz~d
as deleted if the initial charact~r
(byte) of the record has the valu~
(8)'1'B.

1: All cards read or punched are to
be fed into stacker po~ket 1
2: All cards read or punched are to
be fed into stacker pocket 2.
Stacker pocket 1 is assumed if neither
is specified.

PRTSP=OI11213
Specifies spacing of 0 through 3 lines
66

KEYLEN=n
Specifies the number of characters to
be
written, or retrieved,
a~
the
recorded key of records in data sets
of the INDEXED or REGIONAL(2) and (3)
organizations. Note that this value
is fixed during data set creation, and
that all records within a data set
will have keys of the same length~ the
maximum length being 255 characters.

LIMCT=n
Limits
the
extent of the search
through a REGIONAL(2) or (3) data set
beyond the region number specified in
the source key.
If LIMCT is not
specified, the search for a particular
record, or for space to add a new
record, will continue from the specified region to the end of the data
set.
In
RE3IONAL(2)
LIMCT
specifies
records,
but the search will continue
to the end of the track containing the
record whose region number is given
by:
source key region no.

+ LIMCT -

Specifies the number of tracks within
a cylinder index which are to be
filled before a master index entry is
to be created.
It also specifies the
number of tracks within a master index
(of which there may be three levels),
which.
when exceeded,
will cause an
entry in the next higher master index
level.
Such a facility is advantageous for large data sets, in order to
avoid
extensive
serial
searches
through large low-level indexes.
The
maximum value for n is 99.
Note that
the OPTCD subparameter
list
must
include the "M" option in order to
create master indexes.

1
Independent Overflow Area

In
REGIONAL(3).
LIMCT
specifies
tracks: the number of tracks searched
will be the number specified by LIMCT.

OPTCD=I
Specifies that an independent overflow
area is to be used and must be defined
in a separate DD statement.

RKP=n
Keys for INDEXED records may be separate from or embedded in the records.
RKP=n specifies the position (n) of
the first byte of the key relative to
the beginning of the record (byte O).
RKP=O implies that the key is not
embedded.
Note that n is always 1
less than the byte number of the first
character of the key; that is, if
RKP=1 then the first character of the
key is in byte 2.
Embedded keys obviate the need for the
KEYTO option for sequential input, but
not the KEYFROM option for output (the
data specified by the KEYFROM option
may
be
the embedded key itself,
however).
Unblocked records always
have a separate key (recorded key)
attached to the record.
even when
there is already an embedded key; such
records will therefore require double
the space for key information.
The
maximum value for n is {recordsize keylength}.

Cylinder Overflow Area
OPTCD=Y
CYLOFL=n
Specifies number of tracks within each
cylinder to be reserved. during creation,
for overflow records.
If an
independent overflow area is requested
(via another DD statement), a cylinder
overflow area need not be specified.
The maximum number of such tracks is
99, but the limit varies with the
particular device:
there must be at
least one track on a given cylinder to
hold the track index, and one to hold
prime data.

DSORG=IS\DA
IS:

specifies that an INDEXED data
set is being created

OPTCD=M
NTM=n

DA: specifies that a REGIONAL
set is being created
Managing Data

data

67

be accommodated within the existing record
and block size. For example, a PRINT file
declared with V-format records with
a
maximum length of 60 bytes, a block size of
69 bytes, and opened with a LINESIZE of 60
bytes may not be reopened with a LINESIZE
of 100 bytes, as this will raise the
UNDEFINEDFILE condition.
To avoid this,
declare the file explicitly with a maximum
record length and block size large enough
to accommodate the increased LINESIZE. The
block size should exceed the LINESIZE by at
least 9 bytes. If the record length is not
declared explicitly, it is set to the
length specified in LINESIZE when the file
is first opened.

Declaration of the PRINT attribute for a
file causes the initial data byte within
each record to be reserved for an ASA
printer control character. These control
characters are set by the PAGE, SKIP, or
LINE options and format items.
Unless
overridden
by these options or format
items, the printer control character is set
for single spacing. rhe following control
characters are used:
Page eject
Single space
Double space
Triple space
Suppress space

1
b

0'
+

All these characters cause the spacing
action to occur before printing the g~ven
record (it should be noted that a record
is,
in System/360 operating system, a
line).
The ASA control characters for
'skip to channel n' are not employed. It
is possible to use them, however, by specifying in the DD statement that the ASA
character is present, but nQ~ declaring the
file to be a PRINr file and not specifying
record format information in the ENVIRONMENT attribute: in this case, the initial
byte of each record is available to the
program.
Also,
by the above means, it is
possible to use the initial byte for printer control if the RECFM subparameter specifies the use of machine carriage control
characters oy the letter M.
While a PRINT file is always an output
file, it is possible to read such a file,
but not as a PRINT file. This is effected
simply by-not declaring the file as PRINT,
and opening it for INPUT: the initial data
byte of each record in the data set will
then be available for inspection.
PRINT files,
since they have a default
LINESIZE of 120 characters, need not have
any record information specified for them.
The complete default record information
will become:

I

When the SYSPRINT file is opened, the
PL/I program automatically positions the
file output at the start of a new physical
paqe.. A blank page will appear if the
first PUT statement using the file:
1.

Has the PAGE option, or

2.

Is a PUT EDIT with PAGE as the first
format item

If a SIGNAL ENDPAGE (filename) statement
is present for which there is no corresponding ON ENDPAGE (filename) on-unit, the
statement is ignored, and the standard
system action to start a new page is
suppressed.
This prevents the standard
system action from attempting to start a
new page on a file which may not have been
opE~ned.

RECORD I/O is not applicable to PRINT
files,
but the use of printer spacing
characters (ASA or machine code, the latter
being device
dependent)
is
available
through the DD statement by means of the
DCB subparameter of RECFM, or by using one
of the options CTLASA/CTL360 in the ENVIRONt'.lENT
attribute.
The
user is then
responsible for ensuring that the initial
character of the record is a valid printer
control character, which may be a 'skip to
channel n'.
The ASA channel skip codes are:

BLKSIZE
LRECL
RECFM

=

129
125
VA

Note: rhe LINESIZE for a PRINT file can be
varied during execution by closing the file
and reopening it with a different LINESIZE
option.
If this action is taken on a file
which is being output to any medium other
than a printer, (the use of MVT and MFT-II
may cause a file intended for direct printing to be held temporarily on a directaccess device) the record and block size
established for the file originally cannot
be changed, and any change to LINESIZE must
68

Channel

Code

1 through 9
10 through 12

1 through 9
A through C

Also, punch stacker
following characters:
punch pocket 1
punch pocket 2

select

uses

the

V
W

Should any other code be employed, it will
be interpreted as either single-space or
pocket 1, depending upon the device in use.

Byte 0

3

2

r---------------------~---------------------,

Word 1 I
PAGESIZE
I
LINESIZE
I
~----------T----------t----------T----------~
2 I (Reserved) I (Reserved)ITab count I Tab.
I

r----------t----------t----------t----------i

3 I Tab 2
I Tab 3
I Tab. • • I Tab. •• I
r----------t----------t----------t----------~

I

I

I

I

I

I

I

I

I

I

r----------t----------~----------~----------J
m IL __________
Tab n
I
J

Figure 20.

Format of the Tab Control Table

DATA and LIST directed output to PRINT
files will automatically align data on
preset tab positions.
The positions are
determined from the tab control table.
which is the PL/I Library module IHETAB.
This table can be altered, as described
below,
and either replaced within the
library permanently or inserted in the
linkage editor input stream for use in a
single program only. the format of the tab
control table is shown in Figure 20.
PAGESIZE:

LINESIZE:

Half-word binary
the
defining
PAGESIZE

integer
default

Half-word binary
defining
the
LINESIZE

integer
default

are
begun at the tab
position specified, or,
in the case of the first
data field of a line, at
the left margin default
(position 1).
In its unaltered
up as follows:

form~

the table is

set

r---------T---------,
I
60
I
120
1
r----T----t---~----~
I
0 I
0 I
5 I 25 1

.----t----t----t----i
IL____
49 I ____
73 I ____
97 1121
____ 1
~

~

~

J

Reserved Bytes: Reserved
for left and
right margin fac~lities
Tab count:

specifies number of tab
position entries within
table (maximum of 255).
If the tab
count = 0,
then the tab positions
are not used; each data
item is put out according
to the STREAM file output
mode used.

Tab 1l ··Tab n :

Tab positions within the
print line: initial position is numbered 1, greatest position is numbered
255. The value of each
tab should be
greater
than that of the
tab
preceding
it
in
the
table; if not, it
is
ignored
during
table
scanning, which proceeds
through the table from
rab~
to Tab n for each
data field. Data fields

To change the tab settings# a user must
change the values in the assembler language
control section listed below. To become an
installation standard, this must be linkedited into the PL/I library (data set
SYS1.PL1LIB) to replace module IHErABS.
For use in one program only, the object
deck is link-edited with that program.
TAB
IHETAB
IHETABS
PAGESIZE
LINESIZE
NOTABS
TAB1
TAB2
'rAB3
TAB4
'rAB5
ENDTABS

TITLE
CSECT
ENTRY
DS
DC
DC
DC
DC
DC
DC
DC
DC
DC
EQU
END

'IHETAB'
IHETABS
OD
AL2(60)
AL2(120)
H'O'
AL1(ENDTABS-*-1)
AL1(25)
AL1(49)
AL1(73)
AL 1( 97)
AL1(121)
*

Managing Data

69

CREATING AND

ACCESSING~~TA_SETS

The facilities available for initially
creating data sets are outlined in the
following paragraphs, together with details
for the subsequent usage of created data
sets.
It should be noted that creation of
a data set is indicated by opening a file
for OUTPUT, while subsequent access is
indicated by either INPUT or UPDATE.

There are no special considerations with
regard to the data set specification beyond
those
already
indicated
under
nFile
Attributes and the DD statement."

Accessing of STREAM Data Sets
After a STREAM data set is created, it
may, with one exception, be opened only for
INPUT.
The ~xception is that it may be
opened
for OUTPUT using the parameter
DISP=MOD, in which case the new records are
added at the end of the existing records in
the data set. In any other circumstances,
opening a STREAM data set for OUTPUT will
result in the data set being overwritten.

When an I/O statement is executed with
the
EVENT option, input/output of the
record is initiated but is not completed
before control is returned to the user's
problem program. The user can take advantage of the time taken for the I/O operation by incorporating statements whose execution is independent of the I/O operation.
When, at some later stage, it is necessary
to ensure tnat the I/O operation is complete, the WAIT statement is used.
Event Variable: The Event Variable, when
used--In--con]unction with a RECORD I/O
statement, can be in either an active or an
inactive state. It becomes active when an
I/O statement with which it is associated
is executed. It remains active until any
I/O conditions associated with the I/O
operation have been raised or until the I/O
operation has been completed (either normally or abnormally). The Event Variable
also becomes inactive after a GO TO out of
an ON-unit entered as a result of a condition being raised. An Event Variatle which
is active must not be used again in any I/O
statement, a CALL or assignment statement,
or in the COMPLETION pseudovariable, until
it has become inactive.
Ra!~igg_£2g~!~!2n~~
All I/O conditions are
raised at the time of execution of the WAIT
statement. The UNDEFINEDFILE condition is
raised in the normal way when an implicit
OPEN error occurs.
Any statement errors
that occur cause the I/O operation to be
terminated and an ERROR condition raised;
in this case, the ERROR condition is raised
when the I/O statement is executed, and the
Event Variable is unchanged.

CONSECUTIVE
creation
and
acceSSing
of RECORDoriented data sets varies according to the
three data set organizations available.
Details are given below for each of the
three types: CONSECUTIVE,
INDEXED,
and
REGIONAL.

There are no special considerations with
regard to the data set specification beyond
those already indicated under "File Attributes and the DD Statement."
Note that
LOCATE is only valid for BUFFERED files.

Accessin9-of CONSECUTIVE Data Sets
The EVENT option gives the user the
ability to overlap input/output operations
with internal processing. This option may
be used with statements for all RECORD
files except:
1.

SEQUENTIAL BUFFERED
restriction)

2.

SEQUENTIAL
INDEXED
«F)
implementation restriction).

70

(PLII

language
compiler

After a CONSECUTIVE data set is created,
it may, with one exception, be opened only
for INPUT or UPDATE. The exception is that
it may be opened for OUTPUT using the
parameter DISP=MOD, in which case the new
records are added at the end of the existing records in the data set. In any other
circumstances, opening a CONSECUTIVE data
set for OUTPUT will result in the data set

being overwritten. Reading of such a data
set may be either forwards or backwards if
it resides on tape; to read backwards,
the
file must be opened with the BACKWARDS
attribute. If a file is first read (or
written) forwards, and then read backwards,
the LEAVE option in the ENVIRONMENT attribute should be specified, to prevent the
normal rewind at close time, or when volume
switching occurs on a multivolume data set.
~~1~£em~~~_2f-gec2EQ~l

When a CONSECUTIVE
data set is opened for SEQUENTIAL UPDATE,
the only I/O' statements which may be used,
apart from OPEN and CLOSE, are READ and
REWRITE.
READ· SET and REWRITE without
options can only be used for BUFFERED
files.
h
REWRITE statement may not be
issued until' 'a READ statement has been
issued; and a REWRITE statement will always
update the last record read.
It is not
permissible'~o have intervening READ statements between a READ and a REWRITE referring to the same record in the ~ata set.
For example:
READ FILE(F) INTO(A);

5

9

READ FILE(f) INTO(B);

REWRITE FILE(F) FROM(C);

In the above example, statement number (9)
updates the record which was read at statement number (5). The record which was read
at statement number (1) can never be updated after statement number (5) has been
executed.
consider also the following:
READ FILE(F) INTO(A) EVENT(E1);

updating
records
READ •••• SET.

obtained

by

of

INDEXED
£f~~~!on

of INDEXED Data Sets

Special DD statement requirements are as
follows:
One, two~ or three DD statements are
required.
The number depends on the
sizes and relative positions of the
three parts of the INDEXED data set,
namely the prime data area, the overflow area, and the index area. The
SPACE and DSNAME fields of the CD caru
have special formats for INDEXED data
sets.
The following DCB subpararneters
specified:

mu~~

be

KEYLEN=n
DSORG=IS
The following DCB subparameters may
specified:

be

RKP=n
OPTCD=LIMIYII (or any combination)
NTM=n
CYLOFL=n
Space for the data set must ce allocated in cylinders, unless the absolute
track (ABSTR) technique is used.
If
ABSTR is used, the number of tracks
must be equivalent to an integral number of cylinders, and the first track
used must be the first track on a
cylinder which is not the first cylinder on a volume.
Programming considerations are
lows:

5

means

as

fol-

READ FILE(F) INTO(B) EVENT(E2);
For blocked INDEXED data sets, the DCB
subparameters LRECL and BLKSIZE must be
sp~cified as follows:

9

10

WAIT (E1);
REWRITE FILE(F) FROM(A);

Statement number (10) would cause the ERROR
condition to be raised, since between the
REWRITE statement and its corresponding
READ statement (1), there is an intervening
READ statement (5).
When blocked records are used with UPDATE
files, it must be remembered that if one
record in a block is rewritten, then all
the records in that block are rewritten.
The user must take this into account when

Without embedded key (i.e., RKP=O),
LRECL
size of data area + size of
key
With embedded key (i.e.,
LRECL = size of data area

RKP*O),

In both cases,
blOCking factor.

LRECL x

BLKSIZE

Creation of an INDEXED data set is only
available
in the SEQUENTIAL OUTPUT
mode. The EVENT option is not supportManaging Data

71

ed for SEQUENTIAL access to INDEXED
.data sets.
The LOCATE statement is
only valid for BUFFERED files.
When creating INDEXED data sets, the
values of the keys presented must be in
ascending collating sequence
order;
i.e., the binary value of each successive key must be greater by at least 1
than that of the previously presented
key.
Therefore, duplicate keys cannot
be added to the data set.
Data set specifications made during
creation may not be altered during
subsequent processing of the data set;
e.g. KEYLEN is fixed during creation.
Also prov1s1on for overflow
areas,
whether cylinder or independent, must
be made when the data set is created.
If the prime data area is not filled
during creation, then, with one exception, the unused area is not usable for
overflow records,
nor for any records
subsequently
added
during
direct
access.
The exception is that the
unfilled portion of the last track used
may be filled if required.
It is
possible to reserve space for later use
within the prime 1ata area by writing
"dummy" records during creation: provided that the initial byte of the
record has the value (8) 11'B, and that
the option OPTCD=L has been specified,
these dummy records can subsequently be
replaced by actual records with the
same key.
Refer to the publication 11M

System/360

OpeEating_§y~te~L-~QQ_£QQ~E2l Language, and
lBM __ §y~te~Ll£Q __ QE~E~~Q~§ystem, Job Con~EQ!_~an~~~g~_fh~rt~,
for more detailed

discussion of the above considerations.

After an INDEXED data set is created, it
may be reopened for INPUT or UPDATE, for
either SEQUENTIAL or DIRECT access.
If
opened for DIRECT access, records may then
be added and deleted. It should be noted
that once created~ an INDEXED data set may
not be opened for OUTPUT to add further
records; it must be opened for UPDATE.
The user is cautioned that only one
DIRECT UPDATE file that adds records to an
INDEXED data set should be open at anyone
time.
If two files are simultaneously open
for SEQUENTIAL and DIRECT processing of the
same INDEXED data set, then the following
records might not be accessed by
the
SEQUENTIAL file:
1.

72

Records
set.

added

to the end of the data

2.

Records written directly in the
flow area of the data set.

3.

Records written on the overflow area
when forced out of the prime data area
by a record being added to this data
area.

over-

INDEXED data sets accessed
in
the
SEQUENTIAL fashion may be opened for either
INPUT or UPDATE, once created. sequential
access is in the order defined by the
values of the recorded key, i.e., ascending
collating sequence order.
Records
are
retrieved in this order irrespective of the
sequence in which they were added to the
data set. Those records which have been
deleted are not retrieved, and may be
overwritten or lost when other records are
added to the data set.
It is possible to use the KEY option on
READ statements to cause repositioning, in
either a forward or backward direction,
among
the
records
being sequentially
accessed either for INPUT or UPDATE.
This
facility is available only if the KEYED
attribute is specified. Repositioning may
be either to a specified record or, if
GENKEY has been specified in the ENVIRONMENT option list, to the first non-dummy
record of a particular key class.
In
either case a record is retrieved followed
by the next higher keyed record if the
subsequent READ does not have a KEY option.
If the specified KEY is not found in the
data set. the KEY condition is raised.
A
subsequent READ without the KEY option will
retrieve the first record in the data set.
The EVENT option is not supported for
SEQUENTIAL access to INDEXED data sets.
READ SET and REWRITE without the FROM
option are only valid for BUFFERED files.
When opened for SEQUENTIAL UPDATE, only
the statements READ and REWRITE (other than
OPEN and CLOSE) may apply to the file.
The
order of operation must be READ then REWRITE~
but not every record read need be
rewritten.
When blocked records are used
with UPDATE files,
it must be remembered
that if one record in a block is rewritten,
then all the records in that block are
rewritten.
The user must take this into
account when updating records obtained by
means of READ •••• SET. Records may not be
added to the data set when in this mode,
but they may be deleted simply by setting
the initial character of the record to the
delete-code (i.e. a character of the value
(8)ll I B)
and then rewriting it. This can
also be done by using the DELETE statement

which marks as deleted the last record
read. Records which are marked "deleted"
are not made available during sequential
input.
If blocked records are to be deleted,
RKP must be greater than O.
This is
necessary because a deleted record is indicated by (S)'1'B in the first byte and, for
blocked records, this byte is part of the
recorded key; hence if RKP=O, the access of
subsequent records in the block may be
impossible.
After several usages of an INDEXED data
set in which records have been added or
deleted, it may become desirable to copy
the data set from one volume to another in
order to purge the data set of records
marked deleted, but still physically present, and to collect records from overflow
areas into the prime data areas. Such
reorganization will allow more efficient
future access to the data set.

If blocked records are to be deleted,
RKP must be specified as greater than zero.
Otherwise, owing to the technique by which
records are marked as deleted -- ty setting
the initial byte of the record, which for
blocked records includes the recorded key.
to the value (S}"'B -- the locating of
subsequent records in the data set may be
impossible.

__2K--E~£ords~ The specified
record is overwritten ty the replacement
record. Records may be replaced without
having been read, unless the data set
contains blocked records, in which case the
sequence must be READ then REWRITE. In the
case of blocked records, a WRITE, DELETE,
or READ statement may not be issued while a
previous READ statement is still outstanding; that is, before its corresponding
REWRITE statement has been issued. The
EXCLUSIVE attribute should be specified to
synchronize the READ-REWRITE cycle
and
WRITE statements.
~E1~~~~n~

REGIONAL

INDEXED data sets accessed in the DIRECT
fashion may be opened for INPUT or UPDATE,
once created. A DIRECT UPDATE file may
have records added, deleted, or replaced,
as well as retrieved.

The three types of
organization are treated
following paragraphsa

REGIONAL data set
together in the

Creation of REGIONAL Data Sets
Retrieval

of

Records:

Records

"deleted"-are-no~made-available.

marked

:ddition of Records:
If the key is unique,
the-record-isadded-to the data set, either
in the prime area  1 or absent).

REGIONAL(3):

If P-format records, as for

Consider also the following:
READ PILE(P) INTO(A) EVENT(E1);

5

9
10

READ FILE(P) INTO(B) EVENT(E2);

WAIT. (E1);
REWRITE FILE(F) FROM(A)i

Statement number (10) would cause the ERROR
condition to be raised, since between the
REWRITE statement and its corresponding
READ statement (1), there is an intervening
READ statement (5).

Managing Data

75

REGIONAL(1):

REGIONAL(2). If U- or Vformat records, records are
added to available space on
specified
track
(or
subsequent
tracks,
if
extended-search
has been
requested, i.e., LIMCT> 1
or absent).

MOVE MODE

The specified record
is
overwritten with a dummy
record; the space may be
reused.

OU,tput: Data is moved from the work area to
a file, possibly via a buffer.

REGIONAL (2) :

The specified record
is
overwritten with a dummy
record, the key being rewritten as a dummy key: the
space may be reused.

REGIONAL(3):

If F-format records, as for
REGIONAL(2).
If U- or Vformat records, the record
is overwritten with a dummy
record" the key being rewritten as a dummy key: the
space may rr2t be reused.

REGIONAL(1):

The
specified
whether a dummy
actual
record,
written.

REGIONAL(2):

The specified record is rewritten; a record with the
specified key must exist.

RE3IONAL( 3) :

As for REGIONAL(2), for all
record formats ..

record,
or
an
is
re-

If a REGIONAL file has the EXCLUSIVE attribute, then, in order to lock a particular
record, different tasks must use the same
region number to refer to the record.

Characteristics

Data is moved (possibly via
a
buffer) from a file to a work area,
where it is processed. (The work area is
the £~coE3-yariable.)

In~~:

Move mode may be simpler to use than
locate mode, as there are no buffer alignment problems.
In cases where there are
numerous references to the contents of a
record, it can also be faster, as it does
not have the indirect addressing overhead
of locate mode.

The basic statements used in move mode are:
READ
FILE
variable) ;
WRITE
FILE
variable) ;
REWRITE FILE
variable) ;

(filename)

INTO

(record

(filename)

FROM

(record

(filename)

FROM

(record

The full set of RECORD-oriented I/O file
attributes is permitted.

LOCATE MODE

InEut: Data is moved from a file to an
input buffer, where it is processed.
In RECORD I/O, the user has the choice
of processing a record in a work area or in
a buffer.
This choice is exercised by
selecting one of two processing modes: moyg
mode or locate mode. There are advantages
in processing-an-entire file with one mode,
but it is permitted to use a combination of
both modes in the same file.
76

Ou!put: The data record is constructed by
the user in an output buffer.
The
buffer is then transmitted to a file.
The locate mode input statement sets the
address of the record (in the buffer) in a
Eointer variable. The record can then be
identified for processing by using this
pointer in conjunction with a Q~~g_-y~~~

ble that defines the structure of the
record. As many based variables as are
required can be declared for a file; the
record can be associated with any of them.

READ
FILE
(filename)
SET (pointer
variable) ;
LOCATE based variable FILE (filename)
[SET (pointer variable)i]
REWRITE FILE (filename);

can be used to read self~
These are records where
information in one part of the record is
used to indicate the structure of the rest
of the record. This information could be,
for example, a count of the number of
repetitions of a subfield, or a
code
identifying which one of a class of structures should be used to interpret the
record.
Locate

mode

~efini!,.9:~~2rds.

Locate mode should also provide faster
execution, as there is no need to move data
from a buffer to a work area, and may have
a smaller storage requir~ment, because no
storage is needed for separate work areas.
Whenever a statement that causes data
transmission to or from a file is executed.
any logical record accessed previously by a
locate mode statement is no longer available for processing.

Locate mode can only be used with SEQUENTIAL BUFFERED files. The KEYED and ENVIRONMENT attributes may be specified; the
other file attributes permitted depend on
the statement used:
Statement
READ-'(with SET)
LOCATE
REWRITE (without FROM)

File Attribute
OOUT/UPCATEOUTPUT
UPDATE

If any of these attributes is not explicitly or implicitly declared, or if any other
attribute is present, the ERROR condition
is raised.
The basic
are:

statements

used in locate mode

Managing Data

77

To operate successfully, the PLiI (F)
Compiler and its associated load modules
must have the required amount of main
storage and input/output devices, as specified in the following paragraphso

System/360 operating system operates in
a device-independent environment.
In particular, the (P) Compiler may operate with
different combinations of devices. However, certain restrictions should be noted.
The PL/I (F) Compiler requires at least
a System/360 Model 30 with a minimum of
64K bytes of storage. At least 45,056
(44K) bytes should be allocated in the
SIZE option.
If additional storage is
available and allocated, the compiler
will in general run more efficiently
and provide a faster compilation.
At least one direct access device must
be used for residence of the operating
system, and for the use of the SYSUT1
data set. The same volume may be used
for both purposes. The use of certain
source program and operating system
features requires a storage minimum
greater than that given above.
For
example, PL/I tasking uses the MVT
system, which requires at least 256K
bytes of storage.

Instruction Sets
---------------The standard, decimal, and floatingpoint instruction sets are required by the
compiler and object programs, irrespective
of declared data attributes.

For flexibility in character sets and
graphic representation, the following types
of chains, trains, or type bars are available for use with output printers.

48-character set
BCD
60-character set

HN
HN
PN or QN

48-character set
BCD
60-character set

52H
52H
63-character bar

The operator's console should have the
IBM 1052 printer keyboard Model 7 with dual
case printing element, feature code 9572.

SYSTEM/360 OPERATING SYSTEM REQUIREMENTS

The primary control program of the operating system provides all sequential scheduling features of the job control languag~
as specified in the
publications
IBM
§ystemL360 _QE~atig~~te~~2f-f2g~!21
LanC[uage, and IBM System/360 0Eer~!ing_§.Y§.:.
~illl_Q~rator's
Guide.
It affords data
management capability and contains a supervisor which provides for:
Efficient overlapping of central processing unit operations and input/output
channel activity

The timer feature is required in order
to provide elapsed time of compilation, or
to support the timer built-in function.
In
the
absence
of
the
clock, no time
information will be printed out.
78

Error checking and standard input/
output error recovery procedures
Supervision and processing of interruptions

Supervision of requests for various
services provided by the system
This control program provides for a
single input job stream and the sequential
processing of job steps through single task
operations.

!'1ul:!:.!.Erog£~!!!!!!!.!!g
Tas~:§._lMF~l.

lation, a message will be generated giving
the actual time taken. Under MVT, the time
given is CPU time only, as I/O time cannot
be measured.

with a. Fixed Number of

This is an extension of the primary
control program. It provides for concurrent control of up to four independent
tasks representing separate jobs. Each job
occupies its own fixed partition of main
storage.

Figure 21 shows the control program
options which may be added to the primary
control program in order to provide greater
performance and/or programming flexibili~y
for the various features of PL/I. These
exclude input/output features.

r------------T----------------------------,

!PL/I Featurel
Control Program Option*
I
.------------+----------------------------~
)WAIT
I Multiple WAIT
I
This provides, in addition to the facilities provided by the primary control program:
Priority scheduling of jobs submitted
from single or multiple job streams
Concurrent scheduling and execution of
up to 15 separately protected jobs
The MVT system is used in PL/I tasking •

I
I Tasking
]

ITIME, DATE

I

I
I MVT
I

I Timing: A. Time
I

I
I
I

I
I

ITIME, DATE I Timing: B. Interval timing)
] DELAY
I
I
.------------~----------------------------i
1* See the publication !BM~Y:§.:!:.~!!!~l£Q
I
] QE~E~:!:.!.!!g_§Y:§.1~!!!L-§~QE~g~-~:§.:!:.!.!!!~:!:.~:§.
I
I for further details of these options. I
L _________________________________________ J
Figure 21.

Control Program Options

cm1PILER SUPPORT
-----------_._After the compiler initially receives
control from the calling program of the
operating system by means of a supervisorassisted
linkage,
communication
is
maintained
with
the
operating system
through the compiler control routinesQ
The functions provided by the primary
control program of the opera~lng system,
together with the data management routines
BSAM and QSAM, are required by the compiler.
In addition, BPAM data management
routines are required by the compile-time
processor if the INCLUDE statement is used~

STREAM I/O ~ithin PL/I is supported by
the queued sequential access method (QSAM).
In order to conserve space and time# the
GET and PUT macros are used in the locate
mode whenever possible.
Automatic datatransmission
computing-time
overlap is
provided~ as are blocking-deblocking
functions.
In order to achieve an efficient
degree of I/O overlap, two buffers are
normally allocated to each data set when it
is opened. The number of buffers allocated
is, however,
under the control of the DD
statement, or the BUFFERS option of the
ENVIRONMENT attribute.

Object-time interfaces with the operating system control program are made through
the PL/I Library routines.
The facility for providinJ details of
the time taken for each compilation must be
specified at system generation time through
the control program options (see "Object
Program Support"). On completing a compi-

The access method employed depends upon
the following factors:
System Requirements

79

r------------T-----------T-------~-----------T-------------T-----~---------------------,

I Organization I

Record
IAccessl
Notes on Use of
I
Format
I Method 1
Access Method
I
~------------+-----------+-------+-----------+-------------+------+---------------------i
I
I
lINPUT I BUFFERED
IAII
IQSAM jLocate mode
I
I
I
I UPDATE I
I
I
I (except paper tape)
I
ICONSECUTIVE ISEQUENTIAL jOUTPUT ~-----------+--.-----------+------+---------------------i
I
J
1
IUNBUFFERED IFIU]V
IBSAM I
I

I

Access

I

J
J

Mode

1Buffering

I

I

I

f------------+-----------+-------+---------·--+--·-----------+------+---------------------~

I

I

I
I
ISEQUENTIAL ~-------iUNBUFFERED I
I
J OUTPUT I
IFIFB
~-----------+-------+-----------i
1DIRECT
I INPUT f
I
I
I UPDATE I
I

I
I

I

lINDEXED

I
I
I

IINPUT I BUFFERED
lUPDATE lor

I
IScan mode
I
I
~ESETL/SETL
I
IQISAM ~---------------------~
I
ILoad mode
I
~------+---------------------i
IBISAM I
I
I
I
I

.------------+-----------+-------+-----------+-------------+------+---------------------i
I
I
1INPUT I BUFFERED
I
I
IQSAM (under certain I

I
I UPDATE lor
I
I ] circumstances)
I
ISEQUENTIAL ~-------iUNBUFFERED I
I BSAM ~---------------------i
I
I
JOUTPUT I
IF (REGIONAL I
IBDAM load mode
I
I
and (2»
~------t---------------------~
I
I
!
I
I
I
I REGIONAL ( 1) *
1
) REGIONAL( 1), I
]
I
I F I UI V
I
I Relative record
I
I (2), and (3) I
I
I
I ,( REGIONAL (3) ) I
1wi thout keys
I
I
I
I INPUT t
I
I BDAM I REGIONAL( 2) *
I
I
I DIRECT
IOUTPUT ]
I
I
IRelative record
I
]
I
IUPDATE I
I
I
Iwith keys
I
I
I
I
I
I
I
I REGIONAL (3) *
I
I
I
I
I
I
I
1 Relative track
J
I
I
I
I
1
I
I wi th keys
1
~------------~---------~-L-------~---------~-i---.----------~------i---------------------i
1*
L ___________________________________________
OUTPUT causes data set to be formatted using
•____________________________________________
BSAM (BDAM load mode) at open time
JI
I
I

.-----------t-------t-----------i(1)

eFigure 22.

Usage of Data Management Access Methods for RECORD-Oriented I/O

Organization
Record format
File attributes
The various combinations of the above.,
and the resultant usage of data management"
are illustrated in Figure 22.

80

Although external procedures must be
compiled separately,
several compilations
may be processed by the linkage editor to
form a single load module.
In order to
execute such a load module, the external
procedure of one of the compilations must
possess the option MAIN.

vided by the compiler and the linkage
editor 1S a guide only to the
space
required by the executable control section
and the STATIC INTERNAL control section in
the load module. Several other items must
be added to this to obtain a realistic
estimate
of
the
maximum
object-time
requirements.
These include the following:
1•

!:~QgQ:.Bg9i: s t ~!: __ Y:~£!Q!: __ iEBY:l. •

2.

~~!~!:EQE! __ ~~Q __ ~EfQE __ ~~~Qli~g.

3.

2Yn~~i£_~§~2E~g~_~f~~~iQ§~~1..

4.

CONTROLLEG Variables.
Each allocated
generation of -each CONTROLLED variable
will require 12 bytes in addition to
the space required for the contents of
the variable and its dope vector.

5.

!il~_~~~iEQ!~!i2~.

If more than one compilation has this
option, then the linkage editor will cause
control to be passed to the first of these
compilations to appear in its input streamo
Note that tnis is a function of the linkage
editor itself and is not a formal PL/I
facility.
An attempt to execute a PL/I program in
which no procedure has been given the MAIN
option will result in termination of execution,
accompanied by a message on the
console or system output listing.

Communication between separate compilations can be achieved by means of EXTERNAL
jeclarations or by passing arguments in
CALL statemsnts or function references.
It
should be noted that the PL/I language
makes the following restrictions:
AUTOMATIC variables cannot be EXTERNAL
(but may be passed as arguments)
Descriptions of an external variable in
separate compilations must not be contradictory.
If they are, the compiler
will not be able to detect this.
rhe linkage editor will load the INITIAL
value of a STATIC EXTERNAL variable from
the first object module encountered in its
input stream which declared the variable.

Th e
overall length of the PRV is contained
in the linkage editor module map,
which is produced when the MAP option
is specified.
The maximum size of a
PRV is 4096 bytes.
(Refer to Appendix
C of this publication for a more
detailed
description
of
pseudoregister
vectors.)
The
primary
workspace requirement for the library
is approximately 1100 bytes,
which
should De added to the PRV requir~­
ment, plus 512 bytes if optimization
level OPT=1 has been chosen.
For
each PL/I interrupt,
1100 bytes ar~
required for library workspace.
In
addition, library modules which a~e
dynamically invoked as a result of
interrupts may require up to 2600
bytes
(irrespective of the number 0:
interrupts).
All storage requir2j for
interrupt
and
error
handling is
released when the interrupt has been
cleared.

A general guide to the length of each DSA
is to add 200 bytes per active Dlock
to the space required for the AUTOMATIC variables declared within the clock
and their dope vectors.
This is only
a guideline; there may be consiieratls
variations between different programs.

The main factors
to be considered in estimating the
storage required when opening
and
closing files are as follows:

a.
In order to estimate with any accuracy
the maximum overall storage requirements
for a PL/I program, several factors must be
taken into account. The information pro-

File Control Block (FCB). Approximately 150 bytes for CONSECUTIVE
and REGIONAL data set organizations; approximately 300 bytes for
INDEXED organization.
Managing Programs

81

r------------T--------------------------T---------------~---------------T---------------,

"
,Organization/
I
I
I '

I OPEN* (bytes)

PL/I Attributes

ICLOSE* (bytes)

INORMAL* (bytes) I

~-------T-------+-------T-------+-------T-------i

/ Non- I
I Non- I
I Non- I
,
ITasking,TaskingITasking,Tasking,TaskingITaskingl

.------------+---------?----------------+-------+-------+-------+-------+-------+-------i
}CO.\lSECUTIVE /STREAM
/ 1900 ,1900 / 1300 / 1700,
I
I
I
1
I

ISEQUENTIAL BUFFERED
ISEQ.BUFF.(spanned input)
ISEQ.BUFF.(spanned output}
I SEQ. UNBUFFERED

l

I 2400

I 1900
, 1800
I 5100

I 2400
,1900
,1800
I 5100

I 2400
, 1900
I 1800
I 5100

I 2800
, 2300
,2200
,5500

,1100
, 600
I 500
,3800

I 1100

600
500
I 3800
I
,

,
,
,
I

r------------+--------------------------+-------+-------+-------+-------+-------+---~---~

I INDEXED

I SEQUENTIAL
IDIRECr

!

,3600
,3100

,3600
/ 3900

,3600

I 3100

I 4000
1 4300

,2300

,2300

I 1800

I 2600

,
I

.------------+-------~------------------+-------+-------+-------+-------+-------+-------~

I REGIONAL
I
I

/SEQUENTIAL INPUT/UPDATE
jSEQUENrIAL OUTPUT
1DIRECT

I 5100
,3900
1 3100

I 5100
,3900
I 3900

,5100

I 3900
I 3100

I 5500
I 4300
1 4300

I 3800

I 2600
I 1800

,3800

I 2600
I 2600

I
I

I

r------------L--------------------------~-------~----- --~-------~-------~-------~-------i

1* These figures show the extra storage required by linked PL/I library I/O modules inl
I both non-tasking and tasking environments. The first two columns show the maximum I
I space occupied by the library modules during the opening of a file with the givenl
I attributes.
The second two columns show the maximum space occupied during thel
I closing of the same file. The third two columns show the space occupied by thel
1 library modules while the file is open. If several files with the same attributes I
I are processed, then the storage requirements are unaffected.
If, however~ anotherl
I file with different attributes is open when a file is opened or closed~ then thel
I figure for that file must be added to the figure in the OPEN and CLOSE column.
I
I For instance, if a SEQUENTIAL INDEXED file is open in a non-tasking environment atl
I the time that a CONSECUTIVE SEQUENTIAL BUFFERED file is being closed, then the totall
I storage required by the linked modules w:lll be 2300+2400=4700 bytes. The figures dol
IL______
not -include
the storage
required by data management.
I
________________
- - ________________________________________________

--------------J

.Figure 23.

Storage Required by PL/I Library Modules when opening and

b.

~i~!~!Y __ ~2g~le~.
The
greatest
storage
requirement
generally
occurs when a file is opened or
closed. Figure 23 shows the storage required at these times. In
all cases, the space required by
data management must be added to
the figures givend

Co

~~ifer~.
In addition to the factors given above, space must be
allowed for buffers or I/O control
blocks.
This
requirement can
become very large if large blocksizes are used.

Closing Files

structured to support the advanced features
of PL/I. In order to achieve more than a
limited use,
the user would require an
intimate
knowledge of the object code
structure and requirements of a PL/I program.
Appendix C is provided as an introduction to the sUbject. Appendix D of the
present manual contains an example illustrating one way in which an assembler
language program can be written in order to
combine it with a PL/I procedure.

All space required
by
files
is
released and becomes reusable after
the file has been closed.
When an assembler subroutine is called
by a PL/I program,
by means of a CALL
statement or a function reference, a variable number of arguments can be passed. The
compiler indicates the last argument by
setting X'80' in its high-order byte.
The combination of modules written in
other languages with modules written in
PL/I is possible only in a rather limited
way, since most other languages are not

82

This feature provides compatibility with
COBOL and FORTRAN calling sequences.
It
cannot be used in an exclusively PL/I
environment because PL/I does not allow a
variable number of arguments.

PLiI object programs make use of a large
number of subroutines. These subroutines
are held in the PL/I library and are
incorporated into the PL/I program by the
linkage
editor.
Library
modules not
directly referenced by the compiled module,
but which are selectively referenced by
other required modules (e.g., modules within in the data conversion package) are
specified by the compiler in ESD entries.
These ESD entries, in conjunction with the
linkage editor control statement, LIBRARY*
are used to keep the program's storage
requirements to a minimum. The form of the
LIBRARY statement used specifies that the
linkage editor is not obliged to resolve
certain external references within a given
module, unless the referends are already
included within the module being edited.
Those modules which require this feature
use the LIBRARY control statement when they
are edited into the PYI library.
Thus,
when these modules are subsequently processed by the linkage editor when building a
PL/I program, there will be no second-level
search of the library. Library subroutines
are automatically selected, and no user
intervention is needed.
Other library modules are used on a
transient basis, and are dynamically loaded
during program execution.
These modules
reside within the data set SYS1.LINKLIB.
Modules of this type include those required
for opening and closing files, RECORD I/O
data management interface modules,
and
object-program error-handling routines and
message tables.

then, if 22 were greater than the return
code passed from STEPA, or if 59 were not
equal to the return code passed from STEPB,
the job step STEPC would not be executed.
For further information on the use of the
COND parameter, see the publication IEM
§ystem/360_QEerating System« Job Control
Language.

To use this facility in a PL/I program,
it
is first necessary to declare the
library module antry point IHESARC:
DCL IHESARC ENTRY(BINARY FIXED);
Once IHESARC has been declared, the
return code can be set at any point in the
program by the following CALL statement:
CALL IHESARC(expression);
The routine may be called as often as
requiredft
Each time, the expression will
be evaluated and its value will be saved.
On normal termination, the return code will
be set to the latest value~ modulo 4096.
(On abnormal termination, the complete job
would be terminated.>
If the facility is not used, a return
code of zero will be passed.

It is possible for the programmer to
specify that a particular job step shall
not be executed if any of certain conditions are satisfied by return codes passed
from previously executed job steps.
A
return code can be set during execution of
a PL/I program ..

The major differences between Release 17
and the earlier Release 11 version of
Checkpoint/Restart are the increased number
of Checkpoint/Restart features and
the
changed method the programmer must use to
initiate a programmer-deferred checkpOint
restart, or step restart.

The conditions under which a job step is
to be bypassed are set out in the COND
parameter of the EXEC statement for the
step. For example, if the EXEC statement
for a job step, STEPC, contained the parameter

When a job step terminates because of,
for example, an I/O error or a machine
check~
the programmer may require that
processing begins again from a point ~ithig
the job step or, alternatively, from the
beginning of the job step. This can be
done by means of the IBM System/360 Operating System checkpoint/Restart facility.

COND=(22,GT,STEPA),(59~NE,STEPB»

Managing Programs

83

Checkpoint/Restart is supported by the
MVT and PCP supervisors, and provides the
following features:
Automatic step restart
Automatic checkpoint restart
Programmer-deferred step restart
Programmer-deferred checkpoint
restart
If automatic checkpoint restart or automatic step restart is specified when using
MVT, MSGLEVEL=1 must be specified in the
JOB statement ..

Programmer-deferred step restart enables
the programmer to resubmit a multistep job
and cause any number of steps to
be
bypassed, until the required
step
is
reached, at which point execution commences. Automatic step restart causes the
excution of a job step which terminates
abnormally to be recommenced from the orginal starting point.

programmer-deferred checkpoint restart
is the technique used if the job is to be
discontinued, and resubmitted for checKpoint restart by the user at a later time;
automatic checkpoint restart is the technique used if a restart at the
last
checkpoint taken is to ce performed during
the job immediately that the system recognizes that the job step has been terminated
abnormally.
Both checkpoint restart techniques require £h~£~E2in~_g2~2' in order to
carry out the restart operation. Checkpoint data consists of all the information
about a program at a point in its execution
which can be used to recommence execution
from that point. Multiple checkpoints can
be preserved, or, alternatively, only a
single checkpoint may be required, in which
case each checkpoint is overwritten by a
subsequent checkpoint. Deferred checkpoint
restart can be performed at any of these
checkpoints, if multiple checkpoints are
preserved, or from the latest checkpoint,
if it is the only checkpoint that is
preserved.
Automatic checkpoint restart
will use only the last checkpoint taken.
To create a checkpoint from within a PL/I
program, code the statement
CALL IHECKPT;
at a strategic point in the program such
that any data sets used by the program can
84

be repositioned by the restart program to
the positions held at the time the checkpoint was taken.
Note: The CALL IHECKPT statement must not
Ee--executed in a multitasking environment.
When the CALL IHECKPT statement is executed, a checkpoint data set is created,
for which a unique name or checkid is
generated by the system. rhe-checkId is
displayed on the operator's console for
each checkpoint taken. The checkid for a
particular checkpoint data set which is to
be used to restart execution of the program
should be noted, and later used to identify
the data set. The checkpoint data set is
sequential only, and may not be a member of
a partioned data set.
A DD statement with the ddname SYSCHK
must be provided in the job stream for each
step which produces checkpoints. This DD
statement contains the specifications for
the checkpoint data set. rhe parameters
for this statement are given in Figure 24.
The SYSCHK DD DISP parameter depends on
whether there is a ~ing!~__ £he£~E2!~~ or
whether m~!~iE!e chec~oint~ are required.
For
a
single
checkpoint
code
DISP=(NEW,KEEP), for multiple checkpoints
code DISP=(MOD,KEEP).

With a single checkpoint, the information stored at a checkpoint overwrites the
information stored by any previous check poinl:; thus only the latest checkpoint information is available.

The information for a checkpoint is
stored after the information for a previous
checkpoint; thus all the checkpoints taken
are available for a restart.
The other checkpoint/restart techniques
mentioned,
automatic
step restart and
programmer-deferred step restart, do not
require either the CALL IHECKPT or SYSCHK
DD statements.
(Automatic step restart
causes a step to be reexecuted immediately
if it is terminated abnormally; programmerdeferred step restart permits the job to be
resubmitted, but any job steps preceding
the step to be reexecuted are bypassed,
permitting the immediate restart of the
step.)

r------------T-----------------------------------------------,
I
Tape, Drum, Disk
I

I
I Parameter
I

~----------------------T------------------------~

I Single checkpoint

1 Multiple checkpoints

I

r-----·-------t----------------------~------------------------~

I OSNAME=

Any name
I
~-----·-------t-----------------------------------------------~
I VOLUME=
I Volume number or other reference
,
J

t------------t-----------------------------------------------~
~

UNIT=

I 2400, 2400-2, 2301, 2311, 2314, 2321 etc.

I

r------------t----------------------T------------------------~

I DISp:=

, (NEW,KEEP)

, (MOO.KEEP)

,

r------------t----------------------~------------------------~

I SPACE=

I Provided by formulas for direct-access devices I

t------------t-----------------------------------------------i
I DCB=
I (TRTCH=C> if UNIT=2400-2
I
t------------~-----------------------------------------------1

, *
I

,

I
I
I
,
,

I

The space allocated on a direct-access device must bel
sufficient for the job-step requirements together withl
the system blocks.
In effect, this means that it mightl
have to be as much as one and a quarter times mainl
storage or region size. For example, a 256K machine orl
region might require 10 cylinders on a 2311 disk pack.,
The amount required is derived from the formulas provided]
in !g~_~y~~~~~l~Q_QEerating System: storag~_~st!~~~~~.
I

,

,
,

A secondary quantity can appear in the SPACE parameter ofl
the SYSCHK DD statement. However, if it is specified, itl
IL ____________________________________________________________
is not used.
J,
• Figure 24.

Basic Parameters for the SYSCHK DD Statements

RNC (restart, but
no checkpoints)

Automatic
checkpoint
restart
is
specified implicitly by the execution of a
CALL IHECKPT statement.
The remaining checkpoint restart features are controlled from the RD (Restart
Definition) parameter, which can be specified in either a JOB statement or an EXEC
statement.
The settings of the RD parameter are listed below:
RD [.procstep]

=

1.

An RO parameter coded in a JOB statement overrides one coded in an EXEC
statement.

2.

If the RD=value is coded in an EXEC
statement for a cataloged procedure,
it applies to all the steps within the
procedure. RD.procstep=value can be
coded instead of RO=value; it then
applies only to the specified procedure step.
RO.procstep=value can be
coded for each step in the cataloged
procedure, in procedure step order.

3.

The CALL IHECKPT statement causes a
request
for
automatic
checkpoint
restart and overrides the request for
automatic step restart, if the parameter RO=R has been specified.

4.

RD=NC and RD=RNC are provided to suppress the execution of a CALL IHECKPT
statement which is contained in a

{R]NCINRIRNC}

where:
R (restart)

requests automatic
step restart.

NC (no checkpoint) totally suppresses
both the execution
of the CALL IHECKPT
statement, and the
implicit automatic
checkpoint restart.
NR (no restart)

requests automatic
step restart and
totally suppresses
the execution of the
CALL IHECKPT
statement.

Checkpoints may be
written. but automatic checkpoint restart is inhibited.
2.Eecify this
12arameter for

Managing Programs

85

program to be executed, but is
required for a particular job.
5.

not

RD=NC and RD=NR have no effect on a
step in which there is no CALL IHECKPT
statement to be executed.
In this
case RD=RNC has the same effect as
RD=R,
specifying
automatic
step
restart.

6.

If no RD parameter is specified, automatic step restart is suppresed but an
automatic checkpoint restart can occur
if a checkpoint is taken.

1.

The RD parameter is ignored when the
MFT II supervisor is used.

Automatic restarts are specified in
RD parameter described previously.

the

Prugrammer-deferred restarts are performed by resubmitting the deck containing
the job control statements for the original
job, with the JOB statement containing a
RESTART parameter to specify that a restart
is required, and how it is to be performed.
The RESTART parameter specifies the step to
be restarted, and, if a checkpoint restart
is required, the checkpoint identity, i.e.,
checkid, of the checkpoint data set to be
used.
It is specified as follows:
RESTART= ( {

stepname

~tepname.procstep

}

[,checkid)

If the restart is a programmer-deferred
step restart, the checkid information must
not be specified, and the enclosing parentheses may be omitted. The stepname parameter identifies the step in the job to be
restarted. The form stepname.procstep is
used if the step is in a cataloged procedure. The form '*' can be used to indicate
that the first step in the job is to be
restarted.
 (greater than) ;

L (letter), < (less than) •
0

(letter), 0 (zero) ;

S (letter), 5 (five) ;
Z (letter), 2 (two) ;

This is a list of the errors and pitfalls most likely to be encountered when
writing a PL/I source program. Some of the
items concern misunderstood or overlooked
language rules, while others result from
fail~re
to observe the implementation conventions and restrictions of the PL/I (F)
compiler, and are indicated by (I) appearing after the item.

(1)

The option list in the PARM parameter
of an EXEC
statement
should
be
enclosed in quotation marks, and is
limited to a maximum length of 40
characters
(including
commas
but
excluding quotation marks).
(I)

(2)

When the source deck is in the input
stream to the sequential scheduler,
check that the last card in the source
deck is a delimiter (/* in columns 1
and 2).
(I)

(3)

A STATIC variable in an overlay segment could be overwritten during an
overlay operation unless it has the
EXTERNAL attribute.
(I)

(4)

Special care should be taken when
using
ENVIRONMENT
(INDEXED).
For
example, no secondary quantity can be
(I)
allocated by the SPACE parameter.

(1)

104

Keypunch transcription
errors
may
occur unless particular care is taken
when writing the folLowing characters:

(break character),
(minus sign);

(2) Ensure that the source program is
completely contained within the margins
specified
by
the
SORMGIN
option.
(I)
(3)

Inadvert~nt
omission of certain symbols may give rise to errors that are
difficult to trace.
Common errors
are:
unbalanced
quotation
marks;
unmatched parentheses; unmatched comment delimiters (e.g., /*
punched
instead of */ when closing a comment);
and missing semicolons.

(4)

Reserved keyword operators in
the
48-character set (e.g., GT, CAT) must
in all cases be preceded and followed
by a blank or comment.

( 5)

Care should be taken to ensure that
END statements correctly match the
appropriate DO, BEGIN, and PROCEDURE
statements.

(6)

In some situations. parentheses are
required when their necessity is not
immediately obvious.
In particular,
the expression following WHILE and
RETURN
must
be
enclosed
in
parentheses.

(1)

The procedure to be given initial
control at execution time must have
the OPTIONS(MAIN) attribute.
If more
than
one
procedure has the MAIN
option,
the
first
one
gets
control.
(I)

(2) When a procedure of a program is
invoked while it is still active,
it
is said to be
used
recursively.
Attempting the recursive use of a
procedure that has not been given the
RECURSIVE attribute may result in a
program interrupt after exit from the
procedure.
This will occur if reference is made to AUTOMATIC data of an
earlier invocation of the procedure.

(1)

DECL~RE statements for AUTOMATIC variables are in effect executed at entry
to a block: sequences of the following
type are therefore likely to lead to
unpreiictable storage requests:

004

00.4

(3)

Missing commas in DECLARE statements
are a common source of error.
For
example, a comma must follow the entry
for each element in a structure declaration.
External identifiers should neither
contain more than seven characters n
nor start with the letters IHE.
(I)

(4) In a PICTURE declaration, the V character indicates the scale factor,
but
does not in itself produce a decimal
point on output.
The point picture
character produces a point on output~
but is purely an editing character and
does not indicate the scale factor.
In a decimal constant, however, the
point does indicate the scale factor.
For example:
DCL A PIC'99.9',
B PIC'99V9',
C PIC'99.V9~;
Ai B ,C=45.6;

PUT LIST (A,B,C);
This will cause the following values
to be put out for A,
B,
and C,
respectively:
04.5

456

45.6

If these values were now read back
into the variables by a GET LIST
statement, A, B, and C would be set to
the following respective values:

560

45.6

(5) Separate

external declarations of the
same identifier must not specify conflicting attributes, either explicitly
or by default.
If this occurs the
compiler will not be able to detect
the conflict.
PL/I also requires that
if an INITIAL value is sp~cified in
one declaration of a STATIC EXTERNAL
variable,
the same
INITIAL
value
should appear in every declaration of
that variable.

(6)

An identifier cannot be used for more
than one purpose within its scope.
Thus, the use of X in the following
sequence of statements would be in
error:
PUT FILE (X) LIST (A,B,C); X=Y+Zi
X: M=N;

(7)

(2)

45.6

If the PUT statement were then repeated, the result would be:

A: PROC;
N=4;
DCL B(N) FIXED;

END;

56.0

It is advisable to declare all entry
points, associated parameter lists,
and any return values, to avoid inadvertent clashes of attributes.
If the attributes of the data items in
an argument list do not match those
declared for the ENTRY# a dummy argument is created with the
correct
attributes, and the data item is converted into the dummy_
For example:
DCL X ENTRY (FIXED. CHAR(4}),
Y FIXED, Z FIXED(1,0);
Y=45;
Z=O;
CALL X(Y,Z);
X:PROC(A,B);
DCL A FIXED,
B CHAR(4);
END;
In the above example,
a dummy is
created for the second argument, Z,
and is passed to X as 'bbbO'.
If the attributes declared for X in
the entry name declaration W8re incompatible with the attritu~ps of tne
arguments in the CALL statem~nt,
the
compiler would issue a diagnostic message, and at execution time no conversion would take place.
However, if
the attributes declared for X in the
entry name declaration conflicted with
the attributes of the corresponding
parameters in the PROCEDURE statement,
the compiler would not detect the
disagreement, and at execution time
Programming Techniques

105

the consequences of such an error
would, in general, be unpredictable.
For example, if X were declared
DCL X ENTRY (FLOAT, CHAR(4»;
then 45 would be passed as FLOAT, but
would be interpreted by X as FIXED#
possibly with disastrous results.
Similarly, attributes declared
for
RETURN values must agree in the invoking and invoked procedures; however,
the actual expression returned may be
of any data type and will be converted
to that declared.
For example:

FLOAT DECIMAL REAL is assumed for
implicitly declared arithmetic variables, unless the initial letter is in
the range I
through N,
when FIXED
BINARY REAL is assumed.
If a variable is explicitly declared
and any of the base, scale, or mode
attributes is specified. the others
are assumed to be from
the
set
FLOAT/DECIMAL/REAL.
For example:
DCL I;

/*1 IS FIXED BINARY
(15,0) REAL
AUTOMATIC*/

DCL J REAL;

/*J IS FLOAT DECIMAL
(6) REAL
AUTOMATIC*/

DCL X RETURNS (CHAR(4»i
DCL A CHAR(4);
X: PROC CHAR(4);
RETURN (I*J*K);
END X;

DeL K STATIC; /*K IS FIXED BINARY
(15,"0) REAL
STATIC*/
DCL L FIXED;

A=X;
The precision of decimal integer constants should be taken into account
when such constants are passed.
For
example:
CALL ALPHA(6);
ALPHA: PROCEDURE(X)i
DCL X FIXED DECIMAL;
END;
The above example is incorrect because
X will be given a default precision.
while the constant, 6, will be passed
with precision (1,0).
(8) When a data item requires conversion
to a dummy, and the called procedure
alters the value of the parameter 6
note that the dummy is altered, not
the original argument.
For example:

(10) The precision of complex expressions
is not obvious.
For example,
the
precision of 1 + 11 is (2#0), that is,
the precision follows the rules for
expression evaluation.
(11) When a procedure contains more than
one entry point, with different parameter lists on each entry, make sure
that no references are made to parameters other than those associated with
the point at which control entered the
procedure.
For example:
A: PROCEDURE(P,Q)i
P=Q+8i RETURN;
B: ENTRY(R,S)i
R=P+Si /*THE REFERENCE TO P
IS AN ERROR*/
END;

DCL X ENTRY (FIXED, FIXED)#
A FIXED,
B FLOAT;
CALL X(A,B);

(12) BASED storage is allocated in terms of
doublewords;
therefore,
even for the
smallest item, at least eight bytes
are required.
(I)

X:PROC(Y,Z);
DCL (Y,Z) FIXEDi
Y=Z**100i /*A IS ALTERED IN
CALLING PROC*/
Z=Y**3;
/*B IS UNALTERED IN
CALLING PROC*/
END Xi

(13) The variable used in the REFE~ option
must be referred to unambiguously.
For example:

(9) When the attributes for a given identifier are incompletely declared, the
rest of the required attributes are
supplied by default.
The following
default assumptions should be carefully noted.
106

/*L IS FIXED DECIMAL
(5,0) REAL
AUTOMATIC*/

DCL 1 A,
2 Y FIXED BIN,
2 Z FLOAT,
B,
2 Y FIXED BIN
2 T(1:N REFER(BoY»;
In any references to this declaration,
Y must be fully qualified to prevent a
possible ambiguity.

(14) A pointer qualifier (explicit or
implicit) may not be based or subscripted.
(I)
(15) Conflicting contextual
declarations
must be avoided. P is often used as
the name of a pointer: it must not,
therefore, assume by default the characteristics of another data type. For
example:

(2) Any attempt to write out a variable or
array that has not been initialized
may well cause a data interrupt to
occur. For example:
DCL A(10) FIXED:
A(1)=10i
PUT LIST (A):

B BASED (P),

To avoid the data interrupt, the array
should
be
initialized before the
assignment statement, thus:

P AUTO,

.,

A=O:

P is first contextually declared to be
a pointer and then, by default, to be
FLOAT DECIMAL.
(16) BASED variables cannot
arguments or parameters.

be used
(I)

as

(17) Offsets must be declared with a level
1 unsubscripted BASED area.
~~_Assignments

Failure to initialize a subscript can
be detected by checking for subscripts
out of range, when debugging the program.

and Initialization

(1) When a variable is accessed, it is
assumed to have a value which has been
previously assigned to it and which is
consistent with the attributes of the
variable.
If
this assumption" is
incorrect~
either the program will
proceed with incorrect data or a program interrupt will occur.
such a
situation can result from failure to
initialize the variable, or it can
occur as a result of the variable
having been set in one of the following ways:
(a) by the use of the UNSPEC pseudovariable
(b) by RECORD-oriented input
(c) by overlay defining a picture on a
character string, with subsequent
assignment to the character string
and then access to the picture
(d) by

passing as an
argument
a
var~able
assigned in a different
procedure, without matching the
attributes of the parameter.

Failure to initialize a variable will
result
in the variable having an
unpredictable value at execution time.
Do not assume this value to be zero.

Note that this problem can also occur
as a result of CHECK system action for
an uninitialized array. If the CHECK
condition were enabled for the array
in the above example, and
system
action were taken, the results, and
the way in which the program terminates, would be unpredictable. The
same problem arises when PUT DATA is
used.
(3) Note
the
distinction
between
= (assignment)
and
= (comparison).
The statement
A=B=C:
means "compare B with C and assign the
result (either '1'B or 'O'B) to A,
performing type conversion if necessary."
(4) Assignments that involve conversion
should be avoided if possible (see
section 1.f.2., below).
(5) In the case of initialization of or
assignment to a fixed length string:
if the assigned value is shorter than
the string, it is extended on th~
right with blanks (for a character
string) or zeros (for bit strings).
For example:
DCL A CHAR(6),
B CHAR(3) INIT('CR'):
A=B:
After the execution of the
above
statements, B would contain CRb, and A
would contain CRbbbb.
(6) It is not possible to assign a cross
section of an array of structures in a
single statement; the whole of an
array of structures, or a single element may be referenced, but not a
cross section.
(I)
Programming Techniques

107

The value of I
is now 1.062S.
This is because .1 is converted to
FIXED BINARY(S~4),
so that the
nearest binary approximation is
0.0001B (no rounding occurs).
The
decimal equivalent of this
is
.062S.
A better result would have
been achieved by specifying .1000
in place of .1.
(See also item
(f) below.)

(7) When SIZE is disabled, the result of
an assignment which would have raised
SIZE is unpredictable:
FIXED BINARY: The result of an assignment here
which includes,
for
instance,
source language assignments
and the conversions implied by parameter matching
may be to raise FIXEDOVERFLOW.
FIXED DECIMAL: Truncation to the nearest byte may occur, without raising an
interrupt.
If the target precision is
even,
an extra digit may be inserted
in the high-order byte.

(b)

If arithmetic is performed
on
character string data, the intermediate results are held in the
maximum precision:
DCL A CHAR(6) INIT('12304S');
DCL B FIXED(S,2);
B=A;
/*B HAS VALUE 123.4S*/
3=A+A; /*B HAS VALUE 246.00*/

(1)

The rules for expression evaluation
should be carefully noted, with particular reference to priority of operations.
The following examples show
the kind of mistake that can occur:
X>YIZ is not equivalent to X>YIX>Z
Dut is equivalent to (X>Y) IZ
x>y>Z is not equivalent to X>Y&X>Z
but is equivalent to (X>Y»Z
The clause IF A=BI IC is equivalent
to IF A=(BI IC),not to IF (A=B)] IC
All
operation
sequences of equal
priority are evaluated left to right~
except for **, prefix +, prefix -, and
"
which are evaluated right to lefto
Thus, the statement

is equivalent to
A=B**(-(C**D»;
The normal use of parentheses is to
modify the rules of priority; however,
it may be convenient to use redundant
parentheses as a safeguard or to clarify the operation.
(2) Conversion is governed by comprehensive rules which must be thoroughly
understood if unnecessary trouble is
to be avoided.
Some examples of the
effect of conversion follow.

~08

(c) The rules for arithmetic to bit
string conversion affect assignment to a bit string from a decimal constant:
DCL A BIT(1),
D BIT(S);
A=1i /*A HAS VALUE 'O'B*/
0=1; /*D HAS VALUE '00010'B*/
D='1'Bi /*D HAS VALUE
'10000'B*/
IF A=1 THEN GO TO Y;
ELSE GO TO Xi
The branch will be to X,
because
the assignment to A resulted in
the following sequence of actions:
(1) The decimal constant,
1,
is
assumed to be FIXED DECIMAL
(1,0) and is assigned to temporary storage with the attributes FIXED BINARY(4,0), taking the value '0001'B;
(2) This value is now treated as a
bit string of length
(4),
so
that it becomes '0001'B;
(3) The resultant bit string is
assigned to A.
Since A has a
declared length of 1, and the
value
to
be assigned has
acquired a length of 4,
truncation occurs at the right,
and A has a
final value of
'O'B.

(a) DECIMAL FIXED to BINARY FIXED can
cause unexpected results if fractions are involved:

To perform the comparison op~ra­
tion in the IF statement, 'O'B and
1 are converted to FIXED BINARY
and compared arithmetically.
They
are unequal,
giving a result of
"false" for the relationship A=1.

DCL I FIXED BIN(31,S) INIT(1);
1=1+.1;

In the first assignment to 0, a
sequence of actions similar to

that described for A takes place.
except that the value is extended
at the right with a zero, because
D has a declared length that is 1
greater than that of the value to
be assigned.
Cd) Assignment of arithmetic values to
character strings involves conversion according to the rules for
LIST-directed output.
Example
DCL A CHAR(4),
B CHAR(7) :
A='O'; /*A HAS VALUE 'Obbb'*/
A=O:
/*A HAS VALUE 'bbbO'*/
B=1234567; /*B HAS VALUE
'bbb1234'*/
Note: The three blanks are necessary to allow for the possibility
of a minus sign and/or a decimal
or binary point,
with provision
for a single leading zero before
the point.
Example 2
DCL CTLNO CHAR(S) INIT('O');
DO I=1 TO 100;
CTLNO=CTLNO+1;

fully converted to arithmetic
type for the second iteration
of the loop ..
Ce) FIXED division can result in unexpected overflows or truncation.
For example. the expression
25+1/3
would yield a value of 5.33 ••• 3.
To obtain a result of 25~33 •• _3,
it would be necessary to write
25+01/3
The explanation is that constants
have the precision and scale factor with which they are written,
while FIXED division results in a
value at maximum implementationdefined precisiono The results of
the two evaluations are reached as
follows:

r-------T-------T-----------------,
1
1 Preen/I
I

I
I Item

I Scale I
I Factorl

I
I

Result

t-------+-------+-----------------~

In
this example, a conversion
error occurs because of the following sequence of actions:

1 (1,0) I
1
I (1,0) 1
3
1(15,14)10_33333333333333
1 (2.0) I
25
125+1/3 I (15,14) 15 .. 33333333333333
I
I
1 (truncation on
1
1
I left:
1
1
I FIXEDOVERFLOW
1
I
1 would be raised
I
I
I unless disabled)

(1) The initial value of CTLNO,
that is, 'Obbbbbbb', is converted to FIXED DECIMAL(5,0)
for the addition,
giving a
temporary value of 00000.

1 (2,0) I
01
I
I (1.0) ]
3
I
101/3
1 (15,13) 100 .. 3333333333333 1
125
I (2,0) 1
25
i
125+01/31(15,13)]25.3333333333333
L _______ L _______ L _________________ J1

END;

(2) The
decimal
constant,
1.
assumed
to
be
FIXED
DECIMAL(1,0),
is added;
in
accordance with the rules for
addition, the precision of the
result
is (6,0), giving a
value of 000001 ..
(3) This value is now converted to
a character string of length
9, value 'bbbbbbbb1', in preparation for the assignment
back to CTLNO.
(4) Because CrLNO has a length of
8, the assignment causes truncation at the right; thus.
CTLNO has a final value that
consists entirely of blanks.
This value cannot be success-

I 1
I 3
I 1/3
I 25

I
I
1

I
I
I
I
I
I
I

~-------+-------+-----------------~

101

I 3

(f> Checking of a picture is performed
only on assignment into the picture variable:
DCL A PIC'999999',
B CHAR(6) DEF A,
C CHAR(6);
3=' ABCDEF' ;
C=A; /*WILL NOT RAISE CONV
CONDITION*/
A=C; /*WILL RAISE CONV*/
Note also
above) :

(A,

B,

C as declared

A=123456; /*A HAS VALUE
123456*/
/*B HAS VALUE
'123456'*/
Programming Techniques

109

C=123456; /*C HAS VALUE
'bbb123'*/
C=A; /*C HAS VALUE '123456'*/
DECIMAL scalar with a
even precision (P,Q) may
effective precision of
(P+1,Q),
as the high-order byte
may not be non-zero.
The SIZE
condition can be used to eliminate
this effect:

Five iterations would result if the DO
statement were replaced by

(g) A FIXED
declared
have an

DCL (A,B,C) FIXED DECIMAL (6,0);
ON SIZE;

ITEMP=A/2;
DO I=1 TO ITEMP;
(4) DO

groups cannot be used as ON-units.

(5) Upper and lower bounds of iterative DO
groups are computed once only, even if
the variables involved are reassigned
within the group. This applies also
to the BY expression.

(SIZE): A = B + C;
Any new values assigned to the variables involved would take effect only
if the DO group was started again.

This ensures that the high-order
byte
of A is zero after the
assignment.

(1) The
scope
of a condition prefix
applied to a DO statement is limited
to execution of the statement itself;
it does not apply to execution of the
entire group.

(6) In a DO group with both a control
variable and a WHILE clause,
the
evaluation and testing of the WHILE
expression is carried out only after
determination (from the value of the
control variable) that iteration may
be performed.
For example, the following group would be executed at most
once:
DO I=1 WHILE(X>Y);

(2) An iterative DO group is not executed
if the terminating condition is satisfied at initialization:
END;
I=6;
DO J=I TO 4;
X=X+J;
END;

(7)

I is frequently used as the control
variable in a DO group, for example:
DO 1=1 TO 10;

x

is not altered by this group,
since
BY 1 is implied.
Iterations can step
backwards, and if BY -1 had been
specified, three iterations would have
taken place.

Within the scope of this implicit
declaration, I might be contextually
declared as a pointer, for example:
DCL X BASED(I);

(3)

Expressions in a DO statement are
assigned to temporaries with the same
characteristics as the expression, not
the variable. For example:
DCL A DECIMAL FIXED(5,O);
A=10;
DO 1= 1 ro A/ 2;

The two statements are in conflict and
will produce a diagnostic message.
When I is a pointer variable~ it can
only be used in a DO group in one of
the following ways:
1.

END;
This loop will not
be
executed~
because A/2 has decimal
precision
(~~,10),
which, on
conversion
to
binary (for
comparison
with
I),
becomes binary (31,34).
110

DCL (P, lA, IB, IC) POINTER;

DO P=IA,IB,IC;
2.

DCL (P, IA) POINTER;

DO WHILE(P=IA);

:i.e

(1) Array arithmetic should be thought of
as a convenient way of specifying an
iterative computation4 For example:
DCL A(10,20);

A=A/AC 1,1);

strings

(1) Assignments made to a varying string
by means of the SUBSTR pseudo-variable
do not set the length of the string4
A varying string initially has an
undefined
length,
so that if all
assignments to the string are made
using the SUBSTR pseudo-variable, the
string still has an undefined length
and cannot be successfully assigned to
another variable or written out4
(2) The user must ensure that the lengths
of
intermediate results of string
expressions do not exceed 32767 bytes.
This applies particularly to variable
string lengths, as there is no objecttime length checking.
(I)

has the same effect as
DCL A(10,20);

DO 1=1 TO 10;
DO J=1 TO 20;
A(I,J)=A(I,J)/A(1,1);
END; END;
Note that the effect is to change the
value of A(1,1) only, since the first
iteration would produce a value of 1
for A(1,1).
If the programmer wished
to divide each element of A by the
original value of A(1,1), he could
write

(1)

When UNSPEC is used as a pseudovariable, the expression on the right
is converted
to
a
bit
string.
Consequently, the expression must not
be invalid for such conversion; for
example, if the expression is a character
string containing characters
other than 0 or 1, a conversion error
will result.

(~)

Note the correct positioning of the ON
statement. If the specified action is
to apply when the named condition is
raised by a given statement, the ON
statement must be executed before that
statement. The statements:

B=A(1,1) ;
A=A/B;
or alternatively,
DCL A ( 10, 20) ,
B(10,20) ;

B=A/A (1, 1) ;
(2) Note
the
plication:

effect

of

array

multi-

DCL (A,B,C) (10,10);

A=B*C;
This does not effect matrix multiplication; it is equivalent to:
DCL (A,B.C) (10,10);

DO 1=1 TO 10;
DO J=1 TO 10;
A(I,J)=B(I,J)*C(I,J);
END; END;

GET FILE CACCTS) LIST (A,B~C);
ON TRANSMIT (ACCTS) GO TO TRERR;
would result in the ERROR condition
being raised in the event of a transmission error during the first GET
operation, and the required branch
would not be taken (assuming that no
previous
ON
statement
applies).
Furthermore, the ON statement would be
executed after each execution of the
GE'l' statement.
(2) An ON-unit cannot be entered by means
of a GOTO statement4 To execute an
ON-unit
deliberately,
the
SIGNAL
statement can be used.
Programming Techniques

111

(3) CONVERSION
ON-units
entered as a
result of an invalid conversion (as
opposed to SIGNAL)
should
either
change the invalid character (by means
of
the
ON SOURCE
or
ONCHAR
pseudo-variable), or else terminate
with a GOTO statement. Otherwise, the
system will print a message and raise
the ERROR condition.
(4)

At normal exit from an AREA ON-unit,
the standard system actio~ is to try
again to make the alloc?tion. As a
result the ON unit will be entered
again, and an indefinite loop will be
created. To avoid this, the amount
allocated should be modified in the ON
unit, for example, by using the EMPTY
built-in function or by changing a
pointer variable.

(1) The UNDEFINEDFILE condition may be
raised if a STREAM file is reopened
with attributes or options that conflict with attributes, options, or
parameters previously specified for
it. For example, if a file originally
opened with a LINESIZE of 100 is
subsequently reopened with a LINESIZE
of 131, the UNDEFINEDFILE condition
will be raised if the DCB sUbparameter
BLKSIZE is not specified on the DD
card, or if it is specified as less
than 132. Difficulties of this nature
can be avoided by the use of different
file names, or by using the same file
name
with
different TITLE option
specifications.
(I)
(2) The UNDEFINEDFILE condition is raised
not only by
conflicting
language
attributes (such
as
DIRECT
with
PRINT), but also by the following:
Ca) Block size smaller than record
size.
This
condition is not
raised
if
spanned
(VSor
VBS-format) records are used.
(b) LINESIZE
maximum.

exceeding

the permitted

(f) Attempting to open an INDEXED data
set for DIRECT OUTPUT.
(g) Attempting to open a CONSECUTIVE
data set with DIRECT or KEYED
attributes.
(h) Specifying an RKP option, for an
INDEXED data set, with a value
resulting in KEYLEN+RKP exceeding
LRECL.
(i) Specifying
a
V-format logical
record length of less than 18
bytes for STREAM data sets.
(j)

Specifyingl for F-format blocked
records, a block size which is not
an
integral
multiple
of the
recordsize.

(k)

Specifying~ for V-format
records,
a logical record length that is
not at least four bytes smaller
than the specified block size.

(1)

Attempting to open a paper-tape
reader for OUTPUT or UPDATE.

(m) Attempting to open a file with the
UNBUFFERED attribute for blocked
records.
(n) Attempting to use blocked records
in the system input stream (SYSIN
DD DATA or SYSIN DD *) with an
UNBUFFERED
file.
The default
record format for the system input
stream is FB-format.
Since this
stream is not checked on input,
the presence of FB-format records
will not be detected until an
attempt is made to open the file,
when UNDEFINEDFILE will be raised.
~Q£~~

If the UNDEFINEDFILE condition
raised because either the key
length or the block size is not specified, a subsequent attempt to open the
file will not raise this condition
again.

1S

(I)

(c) Blocked records specified for REGIONAL organization.
(d) U- or V-format records specified
fOI
INDEXED,
REGIONAL(1),
or
REGIONAL(2) organizations.
(e) KEYLEN not specified for creation
of
INDEXED,
REGIONAL(2),
or
REGIONAL(3) data sets.
112

(3) If a file is to be used for both input
and output, it must not be declared
with either the INPUT or the OUTPUT
attribute. The required option can be
specified on the
OPEN
statement.
Th~re must be no conflict between file
attributes specified in the declaration and those specified by the OPEN
statement.

(4) Input/output lists must be surrounded
by a pair of parentheses: so must
iteration lists. Therefore, two pairs
of outer parentheses are required in
GET LIST «A(I) DO I=1 TO N»:
(5) The last eight bytes of a source key
to access a regional data set must be
the character string representation of
a fixed decimal integer. When gener~
ating the key, the rules for arithmetic
to character string conversion
should be considered.
For example,
the following group would be in error:

PUT EDIT (A) (A(5)"F(5,2»;

(11)1 Arrays are transmitted in row rna jor
order (e.g., A(1,1), A(1,2), A(1,3),
A(2,1),
etc.)

The
default
for
I
is
FIXED
BINARY(15,0), which requires not Sbut
9 characters to contain the character
string representation of the arithmetic values.
Note that the file must have the KEYED
attribute if the KEY, KEYFROM, or
KEYTO options are to be used in any
input/output statement referring to
that file.

(7) The standard file names SYSIN and
SYSPRINT are implicit only in GET and
PUT statements. Any other reference,
such as those in ON statements or
RECORD-oriented
input/output statements, must be explicit.
(S) PAGESIZE and LINESIZE are not file
attributes, that is, they cannot be
included in a DECLARE statement for
the file: they are options on the OPEN
statement.
(9) When an EDIT-directed data list is
exhausted, no fu~ther format items
will be processed, even if the next
format item does not require a matching data item. For example:
DCL A FIXED(5),
B FIXED(5,2);
GET EDIT (A,B) (F(5).F(5,2),X(70»;
The X(70) format item will not be
processed. To read a following card
with data in the first ten columns
only, the SKIP option can be used:
GET EDIT (A,B) (F(5). F(5,2»

DCL 1 A,
2 B CHAR(5),
2 C FIXED(5,2);

B will be matched with the A(5) item,
and C will be matched with the F(5,2)
item.

DCL KEYS CHAR(S);
DO I=1 TO ~O:
KEYS=I:
WRITE FILE(F) FROM (R)
KEYFROM (KEYS);
END;

(6 )

number of scalar elements in the array
or structure; thus if more than one
format item appears in the format
list, successive elements will
be
matched with successive format items.
For example:

SKIP;

(10) The number of data items represented
by an array or structure name appearing in a data list is equal to the

(12) Strings used as input data for GET
DATA and GET LIST must be enclosed in
quotation marks.
(13) The 4S-character representation of a
semicolon ( •• ) is not recognized as a
semicolon if it appears in a DATAdirected
input stream; the 11-S-6
punch must be used.
(I)
(14) If a new record is added by DIRECT
access to an INDEXED data set whose
overflow areas are already full, a
record will be irretrievacly lost.
The position of the new record, in
relation to the existing records on
the track, will determine whether it
is the new record or an existing one
which is lost.
If the new record
would follow the last existing record
on tbe track, the new record will be
lost.
otherwise, the last existing
record on the track will be lost.
In
either case, the KEY condition will be
raised.
(15) The user must be
aware
of
two
limitations of PUT DATA;
(i.e., no
data list). Firstly, its use with an
ON statement is restricted because the
data known to PUT DATA would be the
data known at the point of the ON
unit. Secondly, and more serious. the
data will be put out as normal datadirected output, which means that any
unallocated or unassigned data may
raise a CONVERSION or other cond-i tiona
If the ON-unit
ON ERROR PUT DATA;
is used in an outer block, it must be
remembered that variables in inner
blocks are not known and therefore
programming Techniques

113

will not be dumped.
It would be a
good practice, therefore, to repeat
the ON-unit in all inner blocks during
debuggL1g.
If an
error
does
occur
during
execution of the PUT DATA statement,
and this statem9nt is within an ON
ERROR unit,
the program will recursively enter the ERROR unit until no
more storage remains for the DSA.
Since
this
could be wasteful of
machine time and printout, the ERROR
unit should be turned off once it is
activated.
Instead of:
ON ERROR PUT DATA;

ON ERROR BEGIN;
ON ERROR SYSTEM;
PUT DATA;
END;
When PUT DATA is used without a datalist every variable known at that
point in the program is transmitted in
data-directed output format to the
specified
file.
Users
of
this
facility, however, should note that:

(16) Qse_2f_!2£~~~_~2Q~I~Q.

A pointer set
in READ SET or LOCATE SET may not be
valid beyond the next operation on the
file, or beyond a CLOSE statement.
In
OUTPUT files, wRIrE and LOCATE statements can be freely mixed.
For UPDATE files, the REWRITE statement with no options must be used if
it is required to rewrite an updated
record. The result of this REWRITE is
always to rewrite the contents of the
last buffer onto the data set.
For example:

114

3

READ FILE (F) SET (P);

5

P->R

7

REWRITE FILE (F);

S;

15

REWRITE FILE (F);

~9

REWRITE FILE (F) FROM (X);

There are two cases where it is not
possible to check for the KEY condition
on a LOCATE statement until
transmission of a record is attempted.
(This will generally occur on execution of the next PL/I output statement
for this file.)

a) Uninitialized FIXED DECIMAL data
may raise the CONVERSION condition or a data interrupt.
Unallocated CONTROLLED data will
cause arbitrary values to be
printed and,
in the case of
FIXED DECIMAL,
may raise the
CONVERSION condition or a data
interrupt.

READ FILE (P) INTO (X);

Statement 7 will rewrite a record
updated in the buffer.
Statement 15 will only
rewrite
exactly what was read, i.e.# it
will not change the data set at
all.
ERROR,
Statement 19 will raise
since there is no preceding
READ statement.

better code would be:

b)

~1

These are:
1.

When there is insufficient room
specified region to output the
on a REGIONAL(3) V- or U-format
Neither the record raising the
tion nor the current record are
mitted.

2.

When the embedded key differs from the
KEYFROM in an ISAM file.

in the
record
file.
conditrans-

If this LOCATE statement is to transmit the last record before the file is
closed,
in case 1, the record is not
transmitted, and in the second case,
the embedded key is overwritten with
the KEYFROM string, and the record is
transmitted.
Thus the condition may be raised by a
CLOSE statement or by an END statement
that causes implicit closing.
Until
the error is corrected,
the record
cannot be transmitted nor can any
further operation be carried out on
the file.
If a LOCATE statement was used in the
addition of KEYED records to any type
of REGIONAL data set then. if RECORD
condition is raised,
the key value
presented
at subsequent operations
must not be less than the current one.

(18) Allocation and ffe~ing of BASED Variables: If a reference is made, at
object time, to a BASED variable that
has not been allocated storage, an
unpredictable interrupt (protection,
addressing
or
specification)
may
occur.

use of input/output facilities; and additional hints.

(19) Areas, pointers, offsets and structures containing any of these cannot
be used with STREAM I/O.
PUT DATA
cannot be used with BASED variables.

The following measures are suggested for
use where compilation time is an important
factor.

When a BASED variable is freed, the
associated pointer no longer contains
useful information. This pointer can
only be used again if:
1.
2.

It is re-allocated with the
another BASED variable, or,
A value is assigned to
offset or another pointer

same

or
(2) Keep

it from an

A BASED variable allocated in an
must be freed in that area.
example:

area
For

DCL A AREA, B BASED (X);
ALLOCATE B IN (A);

FREE B;
FREE B IN (A);

LEGAL

the number of BEGIN blocks and
procedures to a minimum. Do not use
BEGIN-END to effect statement grouping; this is more simply obtained by
use of DO-groups.

(3) Try

to avoid
LIST,
DECK,
options.

using the ATR, XREF,
and
CHAR48 compiler

(4) Avoid features which give rise to
large dictionary entries and large
amounts of text. For example,

1* ILLEGAL */
/*

(1) Allocate as much storage to the compiler
as
possible,
using
the
SIZE=999999 option on the EXEC statement. This reduces the chances of
bringing the spill mechanism
into
operation.

DCL A PIC '(4000)X';

*/

occupies
block.

In PL/I there are often several different ways of producing a given effect. One
of these ways will usually be more efficient from a particular point of view than
another, depending largely on the method of
implementation of the language features
concerned.
However, it should be realized
at the outset that a primary cause of
program inefficiency occurs at the problem
definition stage, before any actual programming is done: PLII cannot be used to
full
advantage
unless the problem is
defined in terms of PL/I.
The purpose of this section is to help
the programmer make the best use of the
PL/I (F) Compiler. The first two parts are
presented from two different viewpoints:
a.

Improving the speed of compilation

b.

Improving the speed of execution.

The remainder of the section is of common
interest, and deals
with
methods
of
decreasing the dictionary size: use of
storage; use of compile-time facilities;

one

complete

dictionary

(5) Use of the following features causes
optional compiler phases to be loaded:
ALLOCATE, LIKE, USES/SETS. CHECK, iSUB
defining,
built-in
functions
with
aggregate arguments, GENERIC
entry
names, DELAY/DISPLAY. If any of these
features can be completely avoided
without
extensively increasing the
source code, there will be a corresponding increase in compilation speed.
(6) On re-runs, further slight increases
in efficiency can be obtained by
(a) removing all
and data;

unreferenced

labels

(b) correcting §!ll source errors, and,
where possible, m1n1m1zing
the
number of diagnostic messages produced, including such messages as
"FILE/STRING
option missing in
GET/PUT statement";
(c) subdividing the program if the
auxiliary storage has been used:
(d) specifying the NOSOURCE option:
(e) specifying the FLAGS option.
Programming Techniques

115

See also
tionary.

2.c.

Decreasing Size of Dic-

(6) Avoid
extensive use of adjustable
arrays and/or CONTROLLED storage.
(7) Use

constants
wherever
instead of expressions.

The following measures are suggested for
use where execution time is an important
factor.
Note that while some of these
measures may slow down the compilation,
this is offset by the fact that others will
accelerate it.
In the main, there should
be no serious increase in compilation time.
(1) Make use of the OPT=01 option.
the STMT option.

possible

(8) Exercise care in specifying precision.

For example,
DCL A FIXED DEC(8,4),
B FIXED DEC(10,2),
C FIXED DEC(10,1);

Avoid
C=A+Bi

(2) Avoid unnecessary program segmentation
and block structure; all procedures,
ON-units and BEGIN blocks need prologues and epilogues, the initialization
and housekeeping for which carry a
considerable overheado
(Prologues and
epilogues are described in Appendix C
of this publication.) Whenever possible, use GOTO or IF statements to
control program logic, rather than the
CALL statement.
(3)

Branching in IF statements can be
improved by using DO and END statements to bracket a THEN clause, rather
than using a GOTO statement in the
THEN clause. For example:
IF A=B THEN DO;
C=D;
E=F;
END;
L: etc.
is more efficient than
IF A,=B THEN GO TO L;
C=D;
E=F;
L: etc.

(4) When GO TO is used in an IF st~tement,
more efficient object code is produced
by tha GO TO if it refers to a label
within the same block rather than to a
label outside the block.
(5) Keep IF clauses simple; separate any
multiple conditions into a series of
simple IF statements. For example:
IF A=B
THEN IF C=D
THEN IF E=F
THEN GO TO Mi

This requires almost twice as much
code
as it would if B had been
declared (10,4), because tho: evaluation of A+B requires a scale factor of
4.
(9) Use the PICTURE attribute only when
necessary.
For example, use FIXED
DECIMAL(5,2) instead of PIC'999V99'.
If a picture field is used in more
than one arithmetic operation, convert
it once and then use the new form in
each operation. This holds for any
conversion required more than once.
If it is necessary to use data with
the PICTURE attribute in arithmetic
expressions, use pictures that will be
handled in-line, as this considerably
reduces execution time. Pictures with
all 9s, a V and a non-drifting sign
are particularly useful. For example:
'999'
'$99v99'
, s99'
'V999'

(10) Internal switches and counters, and
data involved in substantial computation or used for subscripts, should be
declared BINARY; data required for
output should be kept in DECIMAL form.
(11) Keep data conversions to a minimum.
Some possible methods follow:
(a) Use additional variables.
For
example, if a problem specifies
that a character variable has to
be regularly incremented by 1,
DCL CTLNO CHAR(18);

is more efficient than
CTLNO = CTLNO+1;
IF (A=B)&(C=D)&(E=F)
THEN GO TO Mi
116

requires two conversions, while

DCL CTLNO CHAR(S),
DCTLNO DEC FIXED:

(c)

DCTLNO=DCTLNO+1:
CTLNO=DCTLNO:

DCL SW BIT(S) INIT('1·B):

IF SW

'10000000'B THEN DO;

requires only one conversion.
(b) Take special care to make structures match when it is intended to
move data from one structure to
another.
(c) Avoid mixed mode arithmetic, especially the
use
of
character
strings in arithmetic
calculations.

2.

M~l~~E1e s~~~ches

(a)

DCL B BIT(8);

B
(12) Declare arrays in the procedure in
which they are used, instead of passing them as arguments. Declare subscript variables in the block in which
they are used, as FIXED BINARY.
(13) In multiple assignments to subscripted
variables, restrict the assignment to
three variables.

'11100000'B:

IF B

(b)

(14) If a subscripted item is referred tc
more than once with the same subscript, assign the element to a scalar
variable:

THEN DO;

DCL B BIT(3);

B

R={A(I)+1/A(I»+A(I)**A(I) ;

'11~OOOOO'B

'111'B;

IF B =

'11~'B

THEN DO;

should be replaced by
ASUB=A(I)i
R=(ASUB+1/ASUB)+ASUB**ASUB;
(15) Bit strings should, if possible, be
specified as multiples of eight bits.
Bit strings used as logical switches
should be specified according to the
number of switches required.
In the
examples below, (a) is preferable to
(b), and (b) to (c):

(a)

DCL SW BIT(1) INIT ('1'B);

IF SW THEN DO:

(c)

DCL 

Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37
Create Date                     : 2012:06:12 20:40:39-08:00
Modify Date                     : 2012:06:12 20:54:40-07:00
Metadata Date                   : 2012:06:12 20:54:40-07:00
Producer                        : Adobe Acrobat 9.51 Paper Capture Plug-in
Format                          : application/pdf
Document ID                     : uuid:2064297c-b64e-4829-9874-be455e803476
Instance ID                     : uuid:7507cfd1-9669-4635-8ecb-4dd16b74df25
Page Layout                     : SinglePage
Page Mode                       : UseOutlines
Page Count                      : 288
EXIF Metadata provided by EXIF.tools

Navigation menu