Skip to main content

Full text of "ibm :: 360 :: dos :: cobol :: GC28-6398-1 DOS American National Standard COBOL Programmers Guide Feb70"

See other formats


File No. S360-24 
Form GC28-6398-1 



DOS 




Systems Reference Library 



IBM System/360 Disk Operating System 
American National Standard COBOL 
Programmer's Guide 



Program Number 36QN-CB-482 



This p\iblication describes how to compile an T^erican 
National Standard COBOL X3. 23-1968 program using the 
IBM System/360 Disk Operating System American National 
Standard Full COBOL Compiler Version 2, It -also 
describes how to linkage edit the resulting object 
module, and execute the program. Included is a 
description of the output from each of these three 
steps: compile, linkage edit, and execute. In 
addition, this publication explains features of the 
compiler and available options of the operating system. 
American National Standard COBOL was formerly known as 
USA Standard COBOL. 





PREFACE 



This publication is logically and 
functionally divided into two parts. Part 
I contains information useful to 
programmers who are running IBM American 
National Standard COBOL programs, i.e., 
programs compiled on the Version 2 
Compiler, \inder the control of the IBM 
System/360 Disk Operating System. Part I 
covers such topics as job control language, 
library usage, interpreting output, and 
program debugging. Part I is intended 
solely as object-time reference material. 



Part II contains supplemental 
information on the use of the language as 
specified in the publication IBM Svstem/360 
Disk . Operating System: American National 
Standard COBOL , Form GC28-639U, and should 
be used in conjunction with this 
publication for coding IBM American 
National Standard COBOL programs. Part II 
covers in detail such topics as file 
organization, file label handling, and 
record foonnats. Part II is intended as 
sotirce-time reference material for language 
features that are primarily 
system-dependent . 



Wider and more detailed discussions of 
the Disk Operating System are given in the 
following publications : 

IBM Svstem/360 Disk Operating System; 
System Control and System Service 
Programs , Form GC24-5036 

IBM System/360 Disk Operating System; 
Supervisor and Input/Output Macros « Form 
GC24-5037 

IBM System/360 Disk Operating System; 
Data Management Concepts > Form GC2U-3427 

IBM System/360 Disk Operating System; 
System Generation and Maintenance , Form 
GC24-5033 

IBM System/360 Principles of Operation , 
Form GA24-6821 

The titles and abstracts of related 
publications are listed in the publication 
IBM System/360 Bibliography , Form 
GA22-6822. 



Second Edition (February 1970) 



This edition is a major revision of Form GC28-6398-0 and makes that 
edition and its associated Technical Newsletter, Form N28-0263, 
obsolete. The specifications in this publication correspond to Release 
22/23 of the IBM System/360 Disk Operating System. This edition 
contains changes and additions that reflect the Version 2 Compiler's 
support of the following features: relative track addressing for direct 
files, spanned records on sequential tape files and on direct files, and 
forced end-of-volume for a sequentially organized file on a direct 
access device. In addition, changes have been made throughout the 
publication to correct and clarify specific items. All technical 
changes are indicated by a vertical line to the left of the change; 
revised or new illustrations are denoted by the symbol • to the left of 
the caption. 

Changes are continually made to the specifications herein; any such 
changes will be reported in subsequent revisions or Technical 
Newsletters. Before using this publication in connection with the 
operation of IBM systems, refer to the latest SRL Newsletter, Form 
GN20-0360, for editions that are applicable and current. 

Requests for copies of IBM publications should be made to your IBM 
representative or the IBM branch office serving your locality. 

A form for readers' comments is provided at the back of this 
publication. If the form has been removed, comments may be addressed to 
IBM Corporation, Programming Publications, 1271 Avenue of the Americas, 
New York, New York 10020. 



Copyright International Business Machines Corporation 1969, 1970 



CONTENTS 



PART I 

INTRODUCTION 11 

Control Program 11 

Supervisor 11 

Job Control Processor 11 

Initial Program Loader 11 

Processing Programs 11 

System Service Programs 11 

Application Programs 12 

IBM-Supplied Processing Programs • . . 12 

Multiprogramming 12 

Background vs. Foreground Programs . • 12 

JOB DEFINITION 13 

Job Steps .13 

Compilation Job Steps 13 

Multiphase Program Execution .... 13 

Types of Jobs .14 

Job Definition Statements 15 

Other Job Control Statements 16 

JOB PROCESSING 17 

Compilation 17 

Editing 17 

Phase Execution 18 

Multiphase Programs 18 

PREPARING COBOL PROGRAMS FOR PROCESSING 19 

Assignment of Input/Output Devices ... 19 

Job Control 21 

Job Control Statements 21 

Comments in Job Control Statements . 21 

Statement Formats ...21 

Sequence of Job Control Statements . 22 

Description and Formats of Job 

Control Statements 22 

ASSGN Statement 22 

CLOSE Statement 24 

DATE Statement 24 

TLBL Statement 25 

DLBL Statement 26 

EXTENT Statement 26 

VOL Statement 28 

DLAB Statement 29 

TPLAB Statement 30 

XTENT Statement 30 

JOB Statement 31 

LBLTYP Statement 31 

LISTIO Statement 32 

MTC Statement 32 

OPTION Statement 32 

PAUSE Statement 34 

RESET Statement 34 

RSTRT Statement 35 

UPSI Statement 35- 

CBL Statement — COBOL Option 

Control Card 35 

Job Control Commands 37 

Linkage Editor Control Statements ... 37 

Control Statement Placement .... 38 

PHASE Statement 38 



INCLUDE Statement 39 

ENTRY Statement 39 

ACTION Statement . . , 39 

Autolink Feature 40 

LIBRARIAN FUNCTIONS 41 

Librarian 41 

Core Image Library 41 

Cataloging and Retieving Program 

Phases — Core Image Library .... 41 

Relocatable Library ..... 42 

Maintenance Functions 42 

Cataloging a Module — Relocatable 

Library 42 

Source Statement Library ........43 

Maintenance Functions 43 

Cataloging a Book — Source 

Statement Library 43 

Updating Books — Source Statement 

Library 45 

Logical Unit Assignment and Control 

Statement Placement: 47 

UPDATE Function — Invalid Operand 

Defaults 47 

Private Libraries .....48 

Source Language Considerations .... 48 

Extended Source Program Library 

Facility 48 

PROGRAM CHECKOUT 51 

Debug Language 51 

Flow of Control 51 

Displaying Data Values During 

Execution .....52 

Testing a Program Selectively .... 54 
Testing Changes and Additions to 

Programs 54 

Dumps 54 

How to Use a D\amp 55 

Errors That Can Cause a Dvimp 55 

Locating a DTF 56 

Locating Data 57 

Diagnostic Messages 64 

Working with Diagnostic Messages ... 64 

Generation of Diagnostic Messages . . 64 

Linkage Editor Output 64 

Execution Time Messages 64 

Recording Program Status 64 

RERUN Clause 65 

Taking a Checkpoint 65 

Restarting a Program 66 

INTERPRETING OUTPUT 67 

Compiler Output 67 

Object Module 75 

Linkage Editor Output 75 

Comments on the Phase Map 77 

Linkage Editor Messages 77 

COBOL Phase Execution Output 77 

Operator Messages 78 

STOP Statement 78 

ACCEPT Statement 78 



System Output 79 

CALLING AND CALLED PROGRAMS 81 

Linkage 81 

Linkage In A Calling Program 81 

Linkage In A Called Program ..... 82 

Entry Points ...82 

Correspondence of Arguments and 

Parameters 82 

Linkage Editing Without Overlay . . . . '83 
Assembler Language Subprograms ..... 84 

Register Use ..". 84 

Save Area 84 

Argument List 84 

In-Lihe Parameter List 85 

Lowest Level Program 87 

Overlays 87 

Special Considerations When Using 

Overlay Structures 87 

Assembler Language Subroutine for 

Accomplishing Overlay 88 

Linkage Editing with Overlay 89 

Job Control for Accomplishing Overlay 90 

USING THE SORT FEATURE 95 

Sort Job Control Requirements 95 

Sort Input and Output Control 

Statements 95 

Sort Work File Control Statements . . 96 
Amount of Intermediate Storage 

Required 96 

Improving Performance 96 

Sort Diagnostic Messages 96 

Linkage with the Sort Feature 9 6 

Completion Codes 97 

Checkpoint/Restart During a Sort .... 97 

USING THE SEGMENTATION FEATURE 99 

Operation 99 

Output From a Segmented Program • . . .100 

Compiler Output . .• 100 

Linkage Editor Output . . . .. • . .101 

Cataloging a Segmented Program . . .101 

Determining the Priority of the 

Last Segment Loaded into the 

Transient Area 101 

Sort in a Segmented Program 101 

PART II 

PROCESSING COBOL FILES ON MASS STORAGE 

DEVICES 107 

File Organization 107 

Sequential Organization 107 

Direct Organization 107 

Indexed Organization 107 

Data Management Concepts 108 

Sequential Organization (DTFSD) ... .109 
Processing a Sequentially Organized 

File 109 

Direct Organization (DTFDA) 109 

Accessing a Directly Organized File .110 

ACTUAL KEY Clause Ill 

Randomizing Techniques 112 

Actual Track Addressing 

Considerations for Specific Devices .125 
Randomizing for the 2311- Disk Drive 125 
Randomizing for the 2321 Data cell .126 



Indexed Organization (DTFIS) 127 

Prime Area 127 

Indexes 128 

Track Index 128 

Cylinder Index 128 

Master Index 128 

Overflow Area 128 

Cylinder Overflow Area 128 

Independent Overflow Area .... ,128 

Adding Records to an Indexed File .128 

Accessing an Indexed File (DTFIS) . .130 

Key Clauses 130 

Improving Efficiency 131 

ADVANCED PROCESSING CAPABILITIES . . . .133 

DTF Tables 133 

Pre-DTF Switch 138 

Error Recovery 138 

Volume and File Label Handling 144 

Tape Labels 144 

Volume Labels 144 

Standard File Labels 144 

User Labels 144 

Nonstandard Labels 144 

Label Processing Considerations . . .148 

Mass Storage File Labels 149 

Volume Labels 149 

Standard File Labels 149 

User Labels 150 

Label Processing Considerations . . .150 
Files on Mass Storage Device 

Opened as Input . 150 

Files on Mass Storage Devices 

Opened as Output 150 

Unlabeled Files 151 

RECORD FORMATS 153 

Fixed-length (Format F) Records .... .153 

Undefined (Format U) Records 153 

Variable-length (Format V) Records . . .154 

APPLY WRITE-ONLY Clause 157 

Spanned (Format S) Records 157 

S-Mode capabilities 158 

Sequentially Organized S-Mode Files 
on Tape or Mass Storage Devices . . .159 
Source Language Considerations . . .159 
Processing Sequentially Organized 

S-Mode Files 159 

Directly Organized S-Mode Files . . . 161 
Source Language considerations . . . 161 
Processing Directly Organized 

S-Mode Files 162 

OCCURS Clause with the DEPENDING ON 

Option 162 

PROGRAMMING TECHNIQUES 165 

General considerations 165 

Spacing the Source Program Listing . 165 

Environment Division 165 

SELECT Sentence 165 

APPLY WRITE-ONLY Clause 165 

Data Division 165 

Overall Considerations 165 

Prefixes 165 

Level Numbers 166 

File Section 166 

RECORD CONTAINS Clause 166 

Working- Storage Section ...... il66 



V. 



Separate Modules .166 

Locating the Working-Storage 

Section in Dumps .166 

Data Description 167 

REDEFINES Clause 167 

PICTURE Clause 167 

USAGE Clause 169 

SYNCHRONIZED Clause 172 

Special Considerations for DISPLAY 

and COMPUTATIONAL Fields 172 

Data Formats in the Computer . . • .172 

Procedure Division 171 

Modularizing the Procedure Division . 174 

Main-Line Routine 174 

Processing Subroutines 174 

Input/Output Subroutines 175 

Intermediate Results ..." 175 

Intermediate Results and Binary 

Data Items 175 

Intermediate Results and COBOL 

Library Subroutines 175 

Intermediate Results Greater Than 

30 Digits 175 

Intermediate Results and 

Floating-point Data Items 175 

Intermediate Results and the ON 

SIZE ERROR Option 176 

Procedure Division Statements . • . .176 

COMPUTE Statement ' 176 

IF Statement 176 

MOVE Statement 176 

NOTE Statement 176 

PERFORM Statement 176 

READ INTO and WRITE FROM Options . . . .176 

TRACE Statement ^ .177 

TRANSFORM Statement 177 

Using the Report Writer Feature .... 177 
REPORT Clause in a File j 

Description (FD) Entry 177 

Summing Techniques 177 

Use of SUM 177 

SUM Routines 178 

Output Line Overlay 179 

Page Breaks 179 

WITH CODE Clause 179 

Control Footings and Page Format . .180 

NEXT GROUP Clause 181 

Floating First Detail 181 

Report Writer Routines 181 

Table Handling Considerations 181 

Subscripts 181 

Index-names 182 

Index Data Items 182 

OCCURS Clause 182 

DEPENDING ON Option 182 

SEARCH ALL Statement 183 

SET Statement 183 

SEARCH Statement ,. .185 

Building Tables 186 

APPENDIX A: SAMPLE PROGRAM OUTPUT . . .187 

APPENDIX B: STANDARD TAPE FILE LABELS .201 



APPENDIX D: TRACK FORMATS FOR THE 

2311, 2314, AND 2321 DIRECT-ACCESS 

STORAGE DEVICES 209 

APPENDIX E: COBOL LIBRARY SUBROUTINES .211 

Input/Output Subroutines 211 

Printer Spacing 211 

Tape and Sequential Disk Labels . . 211 

CLOSE WITH LOCK Subroutine 211 

WRITE Statement Subroutines .... 211 

READ Statement Subroutines 211 

REWRITE Statement Subroutines . . . 211 
DISPLAY (EXHIBIT and TRACE) 

Subroutines 211 

ACCEPT and STOP (literal) Statement 

Subroutines .212 

CLOSE Subroutine 212 

Multiple File Tape Subroutine . . . 212 
Input/Output Error Subroutines . . . 212 

Disk Extent Subroutines 212 

Auxiliary Subroutines 212 

Conversion Subroutines 212 

Arithmetic Verb Subroutines 214 

Sort Feature Interface Routine . , . .214 
Checkpoint (RERUN) Subroutine . . . .214 
Segmentation Feature Subroutine . . .214 

Other Verb Routines 214 

Compare Sxibroutines 214 

MOVE Subroutines 215 

TRANSFORM Subroutine 215 

Class Test Subroutine 215 

SEARCH Subroutine 215 

Main Program or Subprogram 

Subroutine 215 

APPENDIX F: DIAGNOSTIC MESSAGES . . . .217 

Compiler Diagnostic Messages 217 

Object Time Messages 234 

COBOL Object Program Unnumbered 
Messages 235 

APPENDIX G: MACHINE CONSIDERATIONS . . .237 
Minimum Machine Requirements for the 

Compiler 237 

Execution Time Considerations .... 237 
Sort Feature Considerations 237 

APPENDIX H: COMMUNICATION REGION . . . .239 
Communication Region 239 

APPENDIX I: SAMPLE JOB DECKS 241 

Direct Files . 242 

Creating a Direct File 242 

Retrieving and Updating a Direct 

File 242 

Indexed Files 243 

Creating an Indexed File 243 

Retrieving and Updating an Indexed 

File 244 

Files Used in a Sort Operation . . . .244 
Sorting an Unlabeled Tape File . . .244 

INDEX 245 



APPENDIX C: STANDARD MASS STORAGE 
DEVICE LABELS 



203 



ILLUSTRATIONS 



FIGURES 



Figure 1. Sample Structure of Job Deck 
for Compiling, Linkage Editing, and 
Executing a Main Program and Two 

Subprograms 13 

Figure 2. Sample Logical Unit 

Assignments •••.. 19 

Figure 3. Possible Specifications for 
X'ss' in the ASSGN Control Statement . 24 
Figure 4. Sample Label and File 
Extent Information for Mass Storage 

Files 28 

Figure 5. Job Definition — Use of 

the Librarian .••.. 38 

Figure 6. Sample Coding to Calculate 

FICA 49 

Figure 7. Altering a Program from 
the Source Statement Library Using 

INSERT and DELETE Cards 49 

Figure 8. Effect of INSERT and 

DELETE Cards 50 

Figure 9. Sample Output of EXHIBIT 
Statement with the CHANGED NAMED 

Option 53 

Figure 10. Sample Dump Resulting from 

Abnormal Termination 58 

Figure 11. Examples of Compiler Output . 68 
Figure 12. Linkage Editor Output ... 76 
Figure 13. Output from Execution Job 

Steps 78 

Figure 14. Calling and Called 

Programs 81 

Figure 15. Example of Data Flow Logic 

in a Call Structure 83 

Figure 16. Sample Linkage Routines 

Used with a Calling Subprogram 86 

Figure 17. Sample In-line Parameter 

List 87 

Figure 18. Sample Linkage Routines 
Used with a Lowest Level Subprogram • . 87 
Figure' 19. Example of an Assembler 
Language Subroutine for Accomplishing 

Overlay 88 

Figure 20. Flow Diagram of Overlay 

Logic 89 

Figure 21. Job Control for 

Accomplishing Overlay «.. 90 

Figure 22. Calling Sequence to Obtain 
Overlay Between Three COBOL Subprograms 91 
Figure 23. Segmenting the Program 

SAVECORE 99 

Figure 24. Storage Layout for SAVECORE 100 
Figure 25. Compiler Output for 

SAVECORE 101 

Figure 26, Linkage Editing a 

Segmented Program 102 

Figure 27. Location of Sort Program 

in a Segmentation Structure 103 

Figure 28. Structures of the Actual 

Key Ill 



Figure 29. Permissible Specifications 
for the First Eight Bytes of the 

Actual Key 112 

Figure 30. Creating a Direct File 

Using Method B 116 

Figure 31. Creating a Direct File 
with Relative Track Addressing Using 

Method B 121 

Figure 32. Formats of Blocked and 

Unblocked Records 127 

Figure 33. Adding a Record to a Prime 

Track 129 

Figure 34. Standard Tape File Label 

and TPLAB Cards 145 

Figure 35. Standard Tape File Label 
and TLBL Card (Showing Maximiam 

Specifications) 146 

Figure 36. Standard Tape File Label 
and TLBL Card (Showing Minimum 

Requirements) .147 

Figure 37. Standard, User, and Volume 

Labels 148 

Figure 38. Nonstandard Labels 148 

Figure 39. Fixed-Length (Format F) 

Records 153 

Figure 40. Undefined (Format U) 

Records 154 

Figure 41. Unblocked V-Mode Records .154 
Figure 42. Blocked V-Mode Records . .155 
Figure 43. Fields in Unblocked V-Mode 

Records 156 

Figure 44. Fields in Blocked V-Mode 

Records 156 

Figure 45. First Two Blocks of 

VARIABLE-FILE-2 157 

Figure 46. Control Fields of an 

S-Mode Record 158 

Figure 47. One Logical Record 

Spanning Physical Blocks 159 

Figure 48. First Four Blocks of 

SPAN-FILE 160 

Figure 49. Advantage of S-Mode 

Records Over V-Mode Records 160 

Figure 50. Direct and Sequential 
Spanned Files on a Mass Storage Device 161 
Figure 51. Calculating Record Lengths 
When Using the OCCURS Clause with the 

DEPENDING ON Option 164 

Figure 52. Treatment of Varying 

Values in a Data Item of PICTURE S9 . .174 

Figure 53. Sample of GROUP INDICATE 

Clause and Resultant Execution Output . 179 

Figure 54. Format of a Report Record 

When the CODE Clause is Specified . . .180 

Figure 55. Activating the NEXT GROUP 

Clause 181 

Figure 56. Table Structure in Core 

Storage 184 

Figure 57. Track Format 210 

Figure 58. Communication Region in 

the Supervisor 239 



TABLES 



Table 1. Job Control Statements . . • 16 
Table 2, Symbolic Names, Functions, 

and Permissible Device Types 20 

Table 3. Glossary Definition and 

Usage 73 

Table U. Symbols Used in the Listing 
and Glossary to Define 

Compiler-Generated Information 74 

Table 5, System Message 

Identification Codes 79 

Table 6. Conventional Use of Linkage 

Registers 8U 

Table 7. Save Area Layout and Word 

Contents 85 

Table 8. Recording Capacities of Mass 

Storage Devices •.... 107 

Table 9. Partial List of Prime 

Numbers . .114 

Table 10. Fields Preceding DTFMT and 

DTFSD 134 

Table 11. Fields Preceding DTFDA - 
ACCESS IS RANDOM - Actual Track 

Addressing 134 

Table 12. Fields Preceding DTFDA - 
ACCESS IS RANDOM - Relative Track 
Addressing • ... • .. . 135 



Table 13. Fields Precedincr DTFDA - 
ACCESS IS SEQUENTIAL - Actual Track 

Addressing 136 

Table 14. Fields Preceding DTFDA - 
ACCESS IS SEQUENTIAL - Relative Track 

Addressing ;• .••.. • .137 

Table 15. Fields Preceding DTFIS . . .137 
Table 16. Meaning of Pre-DTF Switch . ,138 
Table 17. Errors Causing an Invalid 

Key Condition 139 

Table 18. Meaning of Error Bytes for 
GIVING Option of Error Declarative . . .140 
Table 19. Location and Meaning of 

Error Bits for DTFMT 142 

Table 20. Location and Meaning of 

Error Bits for DTFSD 142 

Table 21. Location and Meaning of 

Error Bits for DTFDA 142 

Table 22. Location and Meaning of 

Error Bits for DTFIS 143 

Table 23. Data Format Conversion • • .170 
Table 24. Relationship of PICTURE to 
Storage Allocation ...••... .• . 173 

Table 25. Rules for the SET Statement .185 
Table 26. Fiinctions of COBOL Library 
Conversion Subroutines ......... 213 

Table 27. Functions of COBOL Library 
Arithmetic Subroutines 214 



PART I 



• INTRODUCTION 

• JOB DEFINITION 

• JOB PROCESSING 

• PREPARING COBOL PROGRAMS FOR PROCESSING 

• LIBRARIAN FUNCTIONS 

• PROGRAM CHECKOUT 

• INTERPRETING OUTPUT 

• CALLING AND CALLED PROGRAMS 

• USING THE SEGMENTATION FEATURE 

• USING THE SORT FEATURE 



n 



INTRODUCTION 



c 



In the years since 1959, COBOL has 
undergone considerable refinement and 
standardization. Now, an extensive subset 
for a standard COBOL has been specified by 
the American National Standards Institute, 
an industry-wide association of computer 
manufacturers and users. This standard is 
called American National Standard COBOL. 
IBM American National Standard COBOL is 
compatible with American National Standard 
COBOL and includes a n\imber of extensions 
to it as well. 

An IBM American National Standard COBOL 
program may be processed by the IBM 
System/360 Disk Operating System. Under 
control of the operating system, a set of 
IBM American National Standard COBOL source 
statements is translated to form a module . 
In order to be executed, the module in turn 
must be processed to form a phase . The 
reasons for this will become clear later. 
For now it is sufficient to note that the 
flow of an IBM American National Standard 
COBOL (herein, simply termed COBOL) program 
through the operating system is from source 
statements to module to phase. 

The Disk Operating System consists 
essentially of a control program and a 
number of processing programs . 



JOB CONTROL PROCESSOR 



The primary function of the Job Control 
Processor is the processing of job control 
statements. Job control statements 
describe the jobs to be performed and 
specify the programmer's requirements for 
each job. Job control statements are 
written by the programmer using the job 
control language. The use of job control 
statements and the rules for specifying 
them are discussed later. 



INITIAL PROGRAM LOADER 



The Initial Program Loader (IPL) routine 
loads the Supervisor into main storage when 
system operation is initiated. Detailed 
information about the Initial Program 
Loader need not concern the COBOL 
programmer. Anyone interested in this 
material, however, can find it in the 
publication IBM Svstem/360 Disk Operating 
System; System Control and System Service 
Programs . 



PROCESSING PROGRAMS 



CONTROL PROGRAM 



The components of the control program 
are: the Supervisor, Job Control 
Processor, and the Initial Program Loader. 



The processing programs include the 
COBOL compiler, service programs, and 
application programs. 



SYSTEM SERVICE PROGRAMS 



SUPERVISOR 



The main ftinction of the Supervisor is 
to provide an orderly and efficient flow of 
jobs through the operating system. (A job 
is some specified unit of work, such as the 
processing of a COBOL program.) The 
Supervisor loads into the computer the 
phases that are to be executed. During 
execution of the program, control usually 
alternates between the Supervisor and the 
processing program. The Supervisor, for 
example, handles all requests for 
input/output operations. 



The system service programs provide the 
functions of generating the system, 
creating and maintaining the library 
sections, and editing programs into disk 
residence before execution. The system 
service programs are: 

1. Linkage Editor . The Linkage Editor 
processes modules and incorporates 
them into phases. A single module can 
be edited to form a single phase, or 
several modules can be edited or 
linked together to form one executable 
phase. Moreover, a module to be 
processed by the Linkage Editor may be 
one that was just created (during the 
same job) or one that was created in a 
previous job and saved. 



Introduction 11 



The programmer instructs the Linkage 
Editor to perform these functions 
through job control statements. In 
addition, there are several linkage 
editor control statements. 
Information on their use is given 
later. 

2, Librarian , The Librarian consists of 
a group of programs used for 
generating the system, maintaining and 
reorganizing the disk library areas, 
and providing printed and punched 
output from the libraries. The three 
system libraries are: the core image 
library, the relocatable library, and 
the source statement library. In 
addition, the Librarian supports 
private relocatable and source 
statement libraries. Detailed 
information on the Librarian is given 
later. 



multiprogramming support requires the 
storage protection feature. 

Multiprogramming refers to the ability 
of the system to control more than one 
program concurrently by interleaving their 
execution. This support is referred to as 
fixed partitioned multiprogramming, since 
programs are assigned to fixed locations 
when they are cataloged to the system. 
Each program occupies a contiguous area of 
main storage. The amount of main storage 
allocated to programs to be executed may be 
determined when the system is generated, or 
it may be determined by the operator when 
the program is loaded into main storage for 
execution. 



BACKGROUND VS. FOREGROUND PROGRAMS 



APPLICATION PROGRAMS 



Application programs are usually 
programs written in a higher-level 
programming language (e,g, , COBOL), All 
application programs within the Disk 
Operating System are executed under the 
supervision of the control program. 



IBM-SUPPLIED PROCESSING PROGRAMS 

The following are examples of 
IBM-supplied processing programs: 

1. Language translators, e,g, , COBOL 
compiler 

2. Sort/Merge 

3. Utilities 

4. Autotest 



MULTIPROGRAMMING 



For those systems with main storage 
equal to or in excess of 24K bytes, the 
Disk Operating System offers 
multiprogramming support. In addition to 
at least 2UK bytes of main storage. 



There are two types of problem programs 
in multiprogramming: background and 
foreground. Background programs are 
initiated by the Job Control Processor from 
batched- job input streams. Foreground 
programs may operate in either the 
batched-job mode or in the single-program 
mode. Single- prog ram foreground programs 
are initiated by the operator from the 
printer-keyboard. When one program is 
completed, the operator must explicitly 
initiate the next program. 

Background and foreground programs 
initiate and terminate independently of one 
another. Neither is aware of the other* S 
status or existence. 

The system is capable of concurrently 
operating one background program and one or 
two foreground programs. Priority for CPU 
processing is controlled by the Supervisor 
with foreground programs having priority 
over background programs, control is taken 
away from a high priority program when that 
program encounters a condition that 
prevents continuation of processing, until 
a specified event has occurred. Control is 
taken away from a lower priority program 
when an event for which a higher priority 
program was waiting has been completed. 
Interruptions are received and processed by 
the Supervisor, 

COBOL source modules must, be compiled as 
background programs, COBOL program phases 
can be executed as either background or 
foreground programs. 



12 



JOB DEFINITION 



A job is a specified unit of work to be 
performed under control of the operating 
system, A typical job might be the 
processing of a COBOL program — compiling 
source statements, editing the module 
produced to form a phase, and then 
executing the phase. Job definition — the 
process of specifying the work to be done 
during a single job — allows the 
programmer considerable flexibility. A job 
can include as many or as few job steps as 
the programmer desires. 



(second subprogram), (4) linkage edit 
(three modules combined into one phase) , 
and (5) execute (phase). Figure 1 shows a 
sample structure of the job deck for these 
five job steps. Compilation and execution 
in three job steps — compile, linkage 
edit, and execute — is applicable only 
when the COBOL source program is a single 
main program. 



[// JOB PROGl 



JOB STEPS 



A job step is exactly what the name 
implies — one step in the processing of a 
job. Thus, in the job mentioned above, one 
job step is the compilation of source 
statements; another is the linkage editing 
of a module; another is the execution of a 
phase. In contrast to a job definition, 
the definition of a job step is fixed. 
Each job step involves the execution of a 
program, whether it be a program that is 
part of the Disk Operating System or a 
program that is written by the user. A 
compilation requires the execution of the 
COBOL compiler. Similarly, an editing 
implies the execution of the Linkage Editor 
Finally, the execution of a phase is the 
execution of the problem program itself. 



I// EXEC FCOBOL 

{source deck - main program} 
I/* 



I// EXEC FCOBOL 

{source deck - first subprogram! 

I/* 



\// EXEC FCOBOL 

{source deck - second subprogram} 

I/* 



I// EXEC LNKEDT 



Compilation Job Steps 



The compilation of a COBOL program may 
necessitate more than one job step (more 
than one execution of the COBOL compiler) . 
In some cases, a COBOL program consists of 
a main program and one or more sxabprograms. 
To compile such a program, a separate job 
step must be specified for the main program 
and for each of the stibprograms. Thus, the 
COBOL compiler is executed once for the 
main program and once for each subprogram. 
Each execution of the compiler produces a 
module. The separate modules can then be 
combined into one phase by a single job 
step — the execution of the Linkage 
Editor. 

For a COBOL program that consists of a 
main program and two subprograms, 
compilation and execution rec[uire five 
steps: (1) compile (main program), (2) 
compile (first subprogram) , (3) compile 



I// EXEC 



Figure 1. 



Sample Structtire of Job Deck 
for compiling. Linkage Editing, 
and Executing a Main Program 
and Two Subprograms 



Multiphase Program Execution 



The execution of a COBOL program has 
thus far been referred to as the execution 
of a phase. It is possible, however, to 
organize a COBOL program so that it is 
executed as two or more phases. Such a 
progrsuti is known as a multiphase program . 

By definition, a phase is that portion 
of a program that is loaded into main 
storage by a single operation of the 
Supervisor. A COBOL program can be 
executed as a single phase only if there is 
an area of main storage available to 



Job Definition 13 



accoiranodate all of it. A program that is 
too large to be executed as a single phase 
must be structured as a multiphase program. 
The technique that enables the programmer 
to use subprograms that do not fit into 
main storage (along with the main program) 
is called overlay . 



The number of phases in a COBOL program 
has no effect on the number of job steps 
required to process that program. As will 
be seen, the Linkage Editor can produce one 
or more phases in a single job step. 
Similarly, both single-phase and multiphase 
programs require only one execution job 
step. Phase execution is the execution of 
all phases that constitute one COBOL 
program. 

Detailed information on overlay 
structures, as well as information on using 
the facilities of the operating system to 
create multiple phases and to execute them, 
can be found in the chapter "Calling and 
Called Programs." 



Compile and Edit : This type of job 
combines the functions of the compile-only 
and the edit-only jobs. It requires the 
execution of both the COBOL compiler and 
the Linkage Editor. The job can include 
one or more compilations, resulting in one 
or more modules. The programmer can 
specify that the Linkage Editor process any 
or all of the modules just produced; in 
addition, he can specify that one or more 
previously produced modules be included in 
the linkage editor processing. 



Execute-Only : This type of job involves 
the execution of a phase (or multiple 
phases) produced in a previous job. Once a 
COBOL program has been compiled and edited 
successfully, it can be retained as one or 
more phases and executed whenever needed. 
This eliminates the need for recompiling 
and re-editing every time a COBOL program 
is to be executed. 



TYPES OF JOBS 



A typical job falls into one of several 
categories. A brief description of these 
categories follows; a complete discussion 
is found in the chapter "Preparing COBOL 
Programs for Processing. " 



Compile- Only ; This type of job involves 
only the execution of the COBOL compiler. 
It is useful when checking for errors in 
COBOL source statements. A compile-only 
job is also used to produce a module that 
is to be further processed in a subsequent 
job. 

A compile-only job can consist of one 
job step or several successive job steps. 



Edit-Only ; This type of job involves only 
the execution of the Linkage Editor. It is 
used primarily to combine modules produced 
in previous compile-only jobs, and to check 
that all cross references between modules 
have been resolved. The programmer can 
specify that all modules be combined to 
form one phase; or he can specify that some 
modules form one phase and that others form 
additional phases. The phase output 
produced as the result of an edit-only job 
can be retained for execution in a 
subsequent job. 



Edit and Execute ; This type of job 
combines the functions of the edit-only and 
the execute-only jobs. It requires the 
execution of both the Linkage Editor and 
the resulting phase (s). 



Compile, Edit, and Execute : This type of 
job combines the functions of the compile 
and edit and the execute-only jobs. It 
calls for the execution of the COBOL 
compiler, the Linkage Editor, and the 
problem program; that is, the COBOL program 
is to be completely processed. 

When considering the definition of his 
job, the programmer should be aware of the 
following : if a job step is cancelled 
during execution, the entire job is 
terminated; any remaining job steps are 
skipped . Thus, in a compile-edit-and 
execute job, a failure in compilation 
precludes the editing of the module (s) and 
phase execution. Similarly, a failure in 
editing precludes phase execution. 

For this reason, a job usually should 
(but need not) consist of related job steps 
only. For example, if two independent 
single-phase executions are included in one 
job, the failure of the first phase 
execution precludes the execution of the 
second phase. Defining each phase 
execution as a separate job would prevent 
this from happening. If successful 
execution of both phases can be guaranteed 
before the job is run, however, the 
programmer may prefer to include both 
executions in a single job. 



L_ 



14 



JOB DEFINITION STATEMENTS 



Once the programmer has decided the work 
to be done within his job and how many job 
steps are required to perform the job, he 
can then define his job by writing job 
control statements. Since these statements 
are usually punched in cards, the set of 
job control statememts is referred to as a 
job deck . In addition to job control 
statements, the job deck can include input 
data for a program that is executed during 
a job step. For example, input data for 
the COBOL compiler — the COBOL program to 
be compiled — can be placed in the job 
deck. 



The JOB statement defines the start of a 
job. One JOB statement is required for 
every job; it must be the first statement 
in the job deck. The programmer must name 
his job on the JOB statement. 



The EXEC statement requests the 
execution of a program. Therefore, one 
EXEC statement is required for each job 
step within a job. The EXEC statement 
indicates the program that is to be 
executed (for example, the COBOL compiler, 
the Linkage Editor) • As soon as the EXEC 
statement has been processed, the program 
indicated by the statement begins 
execution. 



The inclusion of input data in the job 
deck depends upon the manner in which the 
installation has assigned input/output 
devices. Job control statements are read 
from the unit named SYSRDR (system reader) , 
which can be either a card reader, a 
magnetic tape unit, or a disk extent. 
Input to the processing programs is read 
from the unit named SYSIPT (system input), 
which also can be either a card reader, a 
magnetic tape unit, or a disk extent. The 
installation has the option of assigning 
either two separate devices for these units 
(one device for SYSRDR, a second device for 
SYSIPT) or one device to serve as both 
SYSRDR and SYSIPT. If two devices have 
been assigned, the job deck must consist of 
only job control statements; input data 
must be kept separate. If only one device 
has been assigned, input data must be 
included within the job deck. 



There are four job control statements 
that are used for job definition: the JOB 
statement, the EXEC statement, the 
end-of-data statement (/♦), and the 
end-of-job statement (/&). In this 
chapter, the discussion of these job 
control statements is limited to the 
function and use of each statement. The 
rules for writing each statement are given 
in the chapter "Preparing COBOL Programs 
■for Processing." 



The end-of-data statement, also referred 
to as the /* (slash asterisk), statement, 
defines the end of a program's input data. 
When the data is included within the job 
deck (that is, SYSIPT and SYSRDR are the 
same device) , the /* statement immediately 
follows the input data. For example, COBOL 
source statements would be placed 
immediately after the EXEC statement for 
the COBOL compiler; a /* statement would 
follow the last COBOL source statement. 



When input data is kept separate (that 
is, SYSIPT and SYSRDR are separate 
devices) , the /* statement immediately 
follows each set of input data on SYSIPT. 
For example, if a job consists of two 
compilation job steps, an editing job step, 
cind an execution job step, SYSIPT would 
contain the source statements for the first 
compilation followed by a /* statement, the 
source statements for the second 
compilation followed by a /* statement, any 
input data for the Linkage Editor followed 
by a /* statement, and perhaps some input 
data for the problem program followed by a 
/* statement. 



The end-of-job statement, .also referred 
to as the /g (slash ampersand) statement, 
defines the end of the job. A /& statement 
must appear as the last statement in the 
job deck. 



Job Definition 15 



OTHER JOB CONTROL STATEMENTS 



Table 1. Job Control Statements 



The four job definition statements form 
the framework of the job deck. There are a 
number of other job control statements in 
the job control language; however, not all 
of them must appear in the job deck. The 
job control statements are stMmarized 
briefly in Table 1. 



The double slash preceding each 
statement name identifies the statement as 
a job control statement. Most of the 
statements are used for data management — 
creating, manipulating, and keeping track 
of data files . (Data files are externally 
stored collections of data from which data 
is read eind into which data is written. ) 



1 Statement! Function ] 


|// 


ASSGN 


I 1 
1 Input/output assignments. | 


U^ 


CLOSE 


Closes a logical unit assigned] 
to magnetic tape. | 


|// 


DATE 


Provides a date for the | 
Communication Region. j 


|// 


DLAB 


Disk file label information. j 


|// 


DLBL 


Disk file label information. | 


K/ 


EXEC 


Execute program. | 


|// 


EXTENT 


Disk file extent. | 


|// 


JOB 


Beginning of control j 
information for a job. j 


|// 


LBLTYP 


Reserves storage for label j 
information. j 


|// 


LISTIO 


Lists input/output j 
assignments. j 


|// 


MTC 


Controls operations on | 
magnetic tape. | 


|// 


OPTION 


Specifies one or more job j 
control options. j 


|// 


PAUSE 


Creates a pause for operator | 
intearvention. | 


|// 


RESET 


Resets input/output | 
assignments to standard j 
assignments. j 


|// 


RSTRT 


Restarts a checkpointed j 
program. | 


|// 


TLBL 


Tape label information. j 


|// 


TPLAB 


Tape label information. | 


|// 


UPSI 


Sets user-program switches. | 


|// 


VOL 


Disk/tape label information. | 


I// 


XTENT 


Disk file extent. | 


|/* 




End-of-data-file or j 
end-of-job-step. j 


|/g 




End-of-job. 1 


|4> 
1 




Comments. j 



r 



16 



JOB PROCESSING 



c 



This chapter describes in greater detail 
the three types of job steps involved in 
processing a COBOL program. Once the 
reader becomes familiar with the 
information presented here, he should be 
able to write control statements by 
referring only to the next chapter, 
"Preparing COBOL Programs for Processing." 



o 



COMPILATION 



Compilation is the execution of the 
COBOL compiler. The programmer requests 
compilation by placing in the job deck an 
EXEC statement that contains the program 
name FCOBOL, the name of the COBOL 
compiler. This is the EXEC FCOBOL 
statement. 



Input to the compiler is a set of COBOL 
source statements, consisting of either a 
main program or a subprogreim. Source 
statements must be punched in Extended 
BiTiary-Coded-Decimal Interchange Code 
(EBCDIC) . The COBOL source statements are 
read from SYSIPT. The job deck is read 
from SYSRDR. If SYSRDR and SYSIPT are 
assigned to the same unit, the COBOL source 
statements should be placed after the EXEC 
FCOBOL statement in the job deck. 

Output from the COBOL compiler is 
dependent upon the options specified when 
the system is generated. This output may 
include a listing of source statements 
exactly as they appear in the input deck. 
The source listing is produced on SYSLST. 
In addition, the module produced by the 
ccmpiler may be written on SYSLNK, the 
linkage editor input unit, and punched on 
SYSPCH. Separate Data and/or Procedtire 
Division maps, a symbolic cross-r p^-FpT-PTir;^ 
list, and diagnostic messages can also be 
produced. The format of compiler output is 
discussed and illustrated in the chapter 
"Interpreting Output." 

The progreimmer can override aoiy of the 
compiler options specified when the system 
was generated, or include some not 
previously specified, by using the OPTION 
control statement in the compile job step. 
Compiler options are discussed in detail in 
the chapter "Preparing COBOL Programs for 
Processing." 



EDITING 



Editing is the execution of the Linkage 
Editor. The programmer requests editing by 
placing in the job deck an EXEC statement 
that contains the program name LNKEDT, the 
naume of the Linkage Editor. This is the 
EXEC LNKEDT statement. 

Input to the Linkage Editor consists of 
a set of linkage editor control statements 
and one or more modules to be edited. 
These modules include any of the following: 

1. Modules that were compiled previously 
in the job and placed at that time on 
the linkage editor input \init, SYSLNK. 

2. Modules that were compiled in a 
previous job and saved as modtile 
decks. The module decks must be 
placed on SYSIPT. Linkage editor 
control statements are read from 
SYSRDR. 

3. Modules that were compiled in a 
previous job step and cataloged in the 
relocatable library . The relocatable 
library is a collection of frecpiently 
used routines in the form of modules, 
that can be included in a program 
phase via the INCLUDE control 
statement in the linkage editor job 
step. 

Output from the Linkage Editor consists 
of one or more phases. A phase may be an 
entire program or it may be part of an 
overlay structure (multiple phases). 

A phase produced by the Linkage Editor 
can be executed immediately after it is 
produced (that is, in the job step 
immediately following the linkage editor 
job step) , or it can be executed later, 
either in a subsequent job step of the same 
job or in a subsequent job. In either of 
the latter cases, the phase to be executed 
must be cataloged in the core image libary. 
Such a phase can be retrieved in the 
execute job step by specifying the phase 
ncune in the EXEC statement, where phase 
name is the ncune under which it was 
cataloged. Otherwise, the phase output is 
retained only for the duration of one job 
step following the linkage editor job step. 
That is, if the module that was just 
linkage edited is to be executed in the 
next job step, it need not have been 
cataloged. An EXEC statement will cause 
the phase to be brought in from the 



Job Processing 17 



temporary part of the core image library 
and will begin execution. However, the 
next time such a module is to be executed, 
the linkage editor job step is required 
since the phase was not cataloged in the 
core image library. 

In addition to- the phase, the Linkage 
Editor produces a phase map on SYSLST. 
Linkage editor diagnostic messages are also 
printed on SYSLST. If the NOMAP option of 
the linkage editor ACTION control statement 
is specified, no phase map is produced and 
linkage editor diagnostic messages are 
listed on SYSLST, if assigned. Otherwise, 
the diagnostic messages are listed on 
SYSLOG. The contents of the phase map are 
disctissed and illustrated in the chapter 
"Interpreting Output." 

Linkage editor control statements direct 
the execution of the Linkage Editor. 
Together with any module decks to be 
processed, they form the linkage editor 
input deck , which is read by the Job 
Control Processor from SYSIPT and written 
on SYSLNK. 

There are four linkage editor control 
statements: the ACTION statement, the 
PHASE statement, the ENTRY statement, and 
the INCLUDE statement. These statements 
are discussed in the next chapter. 



PHASE EXECUTION 



Phase execution is the execution of the 
problem program, for example, the program 
written by the COBOL programmer. If the 
program is an overlay structure (multiple 
phase) , the execution job step actually 
involves the execution of all the phases in 
the program. 

The phase (s) to be executed must be 
contained in the core image library . The 
core image library is a collection of 
executable phases from which programs are 
loaded by the Supervisor. A phase is 
written in the temporary part of the core 



image library by the Linkage Editor at the 
time the phase is produced. It is 
perman *^Tii-i y retained (cataloged) in the 
core image library, if the programmer has 
so requested, via the CATAL option in the 
OPTION control statement. 

The programmer requests ,the execution of 
a phase by placing in the joH deck an EXEC 
statement that specifies the n^ame of the 
phase. However, if the phase to be 
executed was produced in the immediately 
preceding job step, it is not necessary to 
specify its name in the EXEC stateiitent. 



MULTIPHASE PROGRAMS 



A COBOL program can be executed as a 
single phase as long as there is an area of 
main storage available to accommodate it. 
This area, known as the problem program 
area, must be large enough to contain the 
main program and all called subprograms. 
When a program is too large to be executed 
as a single phase, it must be structured as 
a multiphase program. 

The overlay structure available to the 
COBOL programmer for multiphase programs is 
known as root phase overlay , and is used 
primarily for programs of three or more 
phases. One phase of the program is 
designated as the root phase (main program) 
and, as such, remains in the problem 
program area throughout the execution of 
the entire program. The other phases in 
the program — subordinate phases — are 
loaded into the problem program area as 
they are needed. A subordinate phase may 
overlay any previously loaded subordinate 
phase, but no subordinate phase may overlay 
the root phase. One or more siabordinate 
phases can reside simultaneously in main 
storage with the root phase. 

Use of the linkage editor control 
statements needed to effect overlay are 
discussed in the chapter "Calling and 
Called Programs." 



/""A 



18 



PREPARING COBOL PROGRAMS FOR PROCESSING 



( 



This chapter provides information about 
preparing COBOL source programs for 
compilation, linkage editing, and 
execution. 



ASSIGNMENT OF INPUT/OUTPUT DEVICES 



Almost all COBOL programs include 
input/output statements calling for data to 
be read from or written into data files 
stored on external devices. COBOL programs 
do not reference input/output devices by 
their actual physical address, but rather 
by their symbolic names. Thus, a COBOL 
program is dependent on the device type and 
not on the actual device address. The 
COBOL programmer need only select the 
symbolic name of a device from a fixed set 
of symbolic names. At execution time, as a 
'job control function, the symbolic name is 
associated with an actual physical device. 
The standard assignment of physical 
addresses to symbolic names may be made at 
system generation time. However, job 
control statements and operator commands 
can alter the standard device assignment 
before program execution. This is 
discussed later in this chapter. 

To simulate an installation environment, 
all the examples in this publication assume 
that the symbolic units and their physical 
and logical assignments are as shown in 
Figure 2. 

The symbolic names are divided into two 
classes: system logical units and 
programmer logical units . 

The system logical units (SYSIPT, 
SYSLNK, SYSLOG, SYSLST, SYSPCH, SYSRES, 
SYSSLB, SYSRLB, and SYSRDR) are used by the 
control program and by IBM- supplied 
processing programs. SYSIPT, SYSLST, 
SYSPCH, and SYSLOG can be implicitly 
referenced by certain COBOL proced\iral 
statements. Two additional names, SYSIN 
and SYSOUT, are defined for backgroimd 
program assignments. The names are valid 
only to the Job Control Processor, and 
cannot be referenced in the COBOL program. 
SYSIN can be used when SYSRDR and SYSIPT 
are the same device; SYSOUT must be used 
when SYSLST and SYSPCH are assigned to the 
same magnetic tape unit- 
Programmer logical \inits are those in 
the range SYSOOO through SYS221 and may be 
referenced in the COBOL source language 
ASSIGN clause. 



H- 

SYSRDR, jX'OOC* 
SYSIPT I 



SYSLST |X»OOE' |1403 Printer 
I ___^ 4 

SYSPCH |X«Ot)D» |25U0 Card punch 



Device 
Type 



Logical j Physical j 
Unit I Unit j 
I + 4 \ 

SYSRES |X*190« 1 2311 Disk unit 

SYSLNK |X'191' 12311 Disk unit 

-4 



1 2540 card reader 



. SYSLOG 

SYSSLB 

I 

SYSRLB 

SYS 001 
SYS002 

SYS003 

j 

SYSOOU 
I 

SYS005 

SYS006 

I 

SYS 007 

SYS008 

I 

SYS009 

SYSOIO 

I 

SYS Oil 
I 

SYS012 
SYS013 



JX'OIF* 
JX«191« 

|X«191* 

|X»191« 
l__ 

|X»191« 
l__ _ 

|X«190« 
I 

|X«281» 
|X'00E» 
|X'191« 

|X*191' 

-+ 

JX'282« 

-+— 

|X«283« 

|X'284' 



+. 



11052 

-+ 

I 2311 

-+ 

12311 

12311 
I 

-+ 

12311 

I 

-+ 

I 2311 

I 

-+ 

12400 

-+ 

|1U03 

-+ 

12311 

-+ 

12311 



Printer keyboard 



Disk unit 



Disk unit 



Disk system 
work file 

Disk system 
work file 

Disk system 
work file 

Tape work file 

Printer 

^ 



Disk unit 
Disk unit 






2U00 
4 

12400 



Tape unit 
Tape unit 






|X*285« 
IX'OOE* 
|X"OOC« 



12400 

-\ 

I 2400 
4 

11403 

-+ 

12540 



Tape unit 
Tape unit 
Printer 
Card reader 






SYS014 |X*01F' 11052 Printer keyboard 
SYS015 |X'192» 12314 Disk unit 



I 4 4 ^ 

SYS016 |X«192* 12314 Disk unit 

SYS 17 I Unas s igned I 
through | | 
SYS221 I I 
I J J J 

Figure 2. Sample Logical Unit Assignments 



Preparing COBOL Programs for Processing 19 



A COBOL programmer uses the source 
language ASSIGN clause to assign a file 
used by his problem program to the 
appropriate symbolic name. Although 
symbolic names may be assigned to physical 
devices at system generation time, the 
programmer may alter these assignments at 
execution time by means of the ASSGN 



control statement. However, if the 
programmer wishes to use the assignments 
made at system generation time for his own 
data files in the COBOL program, ASSGN 
control statements are iinnecessary. 

Table 2 is a complete list of symbolic 
names and their usage. 



Table 2. 

I : 

S3^bolic 
Name 

SYSRDR 



I 

SYSIPT 



I 

SYSPCH 



I 

SYSLOG 



SYSLNK 



I 

SYSRES 



Function 
Input unit for control statements. 



SYSLST 



^ 

Main iinit for printed output. 






I 

SYSSLB 

SYSRLB 
I 

SYS IN 



I 

SYSOUT 



Symbolic Names, Functions, and Permissible Device Types 

I 

f 



Input unit for programs. 



Main unit for punched output. 



Receives operator messages and logs in job control 
statements . 

Input to the Linkage Editor, 

Contains the operating system, the core image 
libraiY* relocatable library, and source state- 
ment library. 



+- 



A private source statement library. 



A private relocatable library- 



Permissible 
Device Types 



Card reader 
Magnetic tape unit 
Disk extent 



Card reader 
Magnetic tape unit 
Disk extent 



Card punch 
Magnetic tape unit 
Disk extent 



Printer 

Magnetic tape unit 

Disk extent 



Printer keyboard 
Printer 

Disk extent 



Disk extent 



Disk extent 



+-- 



Disk extent 



Must be used when SYSRDR and SYSIPT are assigned 
to the same disk extent. May be used when they 
are assigned to the same card reader or magnetic 
tape. 



Disk 

Magnetic tape unit 

Card reader 



This name must be used when SYSPCH and SYSLST are 
assigned to the same magnetic tape unit. It 
must be assigned by the operator ASSGN command. 
+— - 



Magnetic tape unit 



-H- 



SYSmax 



These units are available to the programmer as 
work files or for storing data files. They 
are called programmer logical units as opposed 
to the above-mentioned names which are always 
referred to as system logical units . The 
largest numt>er of programmer logical units 
available in the system is 222 (SYSOOO through 
SYS221). The value of SYSmax is determined by the 
distribution of the programmer logical units 
among the partitions. 



Any unit 






20 



JOB CONTROL 



The Job Control Processor for the Disk 
Operating System prepares the system for 
execution of programs in a batched job 
environment- Input to the Job Control 
Processor is in the form of job control 
statements and job control commands. 



may contain any character from the EBCDIC 
set. Comment statements are designed for 
commxini cation with the operator; 
accordingly, they are written on the 
console printer-keyboard, SYSLOG, in 
addition to being written on SYSLST. If 
followed by a PAUSE control statement, the 
comment statement can be used to request 
operator action. 



JOB CONTROL STATEMENTS 



Job control statements are designed for 
an 80-column punched card format. Although 
certain restrictions must be observed, the 
statements are essentially free form. Job 
control statements conform to these rules: 



Statement Formats 



The following notation is used in the 
statement formats: 



v^y 



1. Name . Two slashes (//) identify the 
statement as a job control statement. 
They must be in columns 1 and 2. At 
least one blank immediately follows 
the second slash. 

Exceptions : The end-of-job statement 
contains /S in columns 1 and 2; the 
end-of-data file statement contains /* 
in columns 1 and 2; the comment 
statement contains * in column 1 and a 
blank in column 2. 

2. Operation . This identifies the 
operation to be performed. It can be 
up to eight characters long. At least 
one blank follows its last character. 

3. Operand . This may be blank or may 
contain one or more entries separated 
by commas. The last term must be 
followed by a blank, unless its last 
character is in coliamn 71. 

U, comments , optional user comments must 
be separated from the operand by at 
least one space. 

Continuation cards are not recognized by 
the Job Control Processor. For the 
exception to this rule, see the 
descriptions of the DLAB and TPLAB 
statements. 

All job control statements are read from 
the device identified by the symbolic name 
SYSRDR. 



1. All upper-case letters represent 

specifications that are to appear in 
the actual statement exactly as shown 
in the statement format. For example/ 
JOB in the operation field of the JOB 
statement should be punched exactly as 
shown. 



2. All lower-case letters represent 

generic terms that are to be replaced 
in the actual statement. For example, 
jobname is a generic term that should 
be replaced by the name that the 
programmer is giving his job. 



3. Hyphens are used to join two or more 
words in order to form a single 
generic term. For example, 
device-address is one generic term. 



4. Brackets are used to indicate that a 
specification is optional and is not 
always required in the statement. For 
example, [type] indicates that the 
programmer's replacement for the 
generic teirm, type, may or may not 
appear in the statement, depending on 
the programmer's requirements. 



5. Braces enclosing stacked items 

indicate that a choice of one J-tem 
must be made by the programmer. For 
example : 



comments in Job Control Statements 



Comment statements (i.e., statements 
preceded by an asterisk in column 1 
followed by a blank) may be placed anywhere 
in the job deck. The remainder of the card 



SYS ) 
PROG f 
ALL ( 
SYSXXX ) 

indicates that either SYS, PROG, ALL, 
or SYSxxx must appear in the actual 
statement. 



Preparing COBOL Programs for Processing 21 



6. 



7. 



Brackets enclosing stacked items 
indicate that a choice of one item 
may, but need not, be made by the 
programmer. For example: 



r,x'ssn 

L,ALT J 



indicates that either ,X*gs' of ,ALT 
but not both, may appear in the actual 
statement, or the specification can be 
omitted entirely. 

All punctuation marks shown in the 
statement formats other than hyphens, 
brackets, and braces must be punched 
as shown. This includes periods, 
commas, and parentheses. For example, 
, [date] means that the specification, 
if present in the statement, should 
consist of the programmer's 
replacement for the generic term date 
preceded by the comma with no 
intervening space. Even if the date 
is omitted, the comma must be punched 
as shown. 



The label statements must be in the 
order i 

VOL 
TPLAB 



or 



or 



VOL 
DLAB 

XTENT (one for each area or file in 
the volume) 



DLBL 

EXTENT (one for each area or file in 
the volume) 



or 



TLBL 



and must immediately pT-t^ret^^ the JPX.EC 
statement to which they apply. 



8. The ellipsis (...) indicates where 
repetition may occur at the user' s 
option. The portion of the format 
that may be repeated is determined as 
follows : 

a. Scanning right to left, determine 
the bracket or brace delimiter 
immediately to the left of the 
ellipsis. 

b. Continue scanning right to left 
and determine the logically 
matching bracket . or brace 
delimiter. 

c. The ellipsis applies to the words 
and punctuation between the pair 
of delimiters. 



DESCRIPTION AND FORMATS. OF JOB CONTROL 
STATEMENTS 



This section contains descriptions and 
formats of job control statements. 

Job control statements, with the 
exception of /*, /6, and ♦, contain two 
slashes in columns 1 and 2 to identify 
them. 



ASSGN Statement 



c 



Seofuence of Job Control Statements 



The job deck for a specific job always 
begins with a JOB statement and ends with a 
/6 (end-of-job) statement. A specific job 
consists of one or more job steps. The 
beginning of a job step is indicated by the 
appearance of an EXEC statement. When an 
EXEC statement is encountered, it initiates 
the execution of the job step, which 
includes all preceding control statements 
up to, but not including, a previous EXEC 
statement. 

The only limitation on the sequence of 
statements within a job step is that which 
is discussed here for "the label information 
statements. 



The ASSGN control statement assigns a 
logical input/output unit to a physical 
device. An ASSGN control statement must be 
present in the job deck for each data file 
assigned to an external storage device in 
the COBOL program where these assignments 
differ from those established at system 
generation time. Data files are assigned 
to programmer logical units in COBOL by 
means of the source language ASSIGN clause. 
The ASSGN control statement may also be 
used to change a system standard assignment 
for the duration of the job. The format of 
the ASSGN control statement is as follows: 



i // ASSGN SYSxxx, device-address 



,X'ss' 

L,ALT J 1 
J 



V_.^ 



22 



SYSxxx 

is one of the logical devices listed 
in Table 2. 

Exception ; SYSOUT must be assigned 
using the ASSGN job control command. 
Job control commands are described in 
detail in the publication IBM 
Svstem/360 Disk Operating System; 
System Control and System Service " 
Programs » 



device-address 

allows three different formats; 



ALT 



must be specified in the control 
statement that assigns an alternate 
magnetic tape unit which is \ised when 
the capacity of the original 
assignment is reached. The 
specifications for the alternate unit 
must be the same as those of the 
orginal unit, since X'ss* 1 cannot be 
specified. The characteristics of the 
alternate unit must be the same as 
those of the original unit. Multiple 
alternates can be assigned to a 
symbolic unit. 



X* cuu* 

where c is the channel number amd uu 
the unit number in hexadecimal 
notation. The values of 'cuu* are 
determined by each installation. 

c = for multiplexor channel, 
1 through 6 for selector 
channels 1 through 6. 

uu = 00 to FE (0 to 254) in 
hexadecimal. 



Device assignments made by the ASSGN 
control statement are considered temporary. 
They are in effect until another ASSGN 
control statement or a RESET statement for 
that logical unit, or the next /£ or JOB 
statement is read, whichever occurs first. 
If a RESET, /S, or JOB statement is 
encountered, the assignment reverts to the 
standard assignment established at system 
generation time plus any modification by an 
ASSGN command. 



UA 



c 



\.-^ 



indicates that the logical unit is 
to be unassigned. Any sotarce 
language input/output operation 
attempted on this device causes 
cancellation of the job. 



IGN 



indicates that the logical unit is 
to be unassigned. References to 
this logical unit are ignored during 
program execution. However, if 
OPTIONAL has been specified in the 
SELECT sentence for an input file, 
the first READ statement for that 
file causes control to be 
transferred to the 
imperative- statement following the 
AT END option of the READ statement. 
The IGN option is not valid for 
SYSRDR, SYSIPT, and SYSIN. This 
option is useful in program 
debugging since source language 
input or output references to files 
residing on symbolic units for which 
IGN has been specified are ignored. 



The COBOL progrcimmer may assign only the 
programmer logical units (SYSOOO through 
SYS221) to data files used in his program. 
For example, if the following ASSIGN clause 
is used, 



SELECT IN-FILE ASSIGN TO SYS00U-UR-2540R-S 



an ASSGN control statement must appear in 
the job deck which assigns SYSOOU to a 
physical device if the physical device 
differs from the permanent assignment. In 
this case, the physical device must be a 
2540 card reader. An example of such a 
control statement is; 



// ASSGN SYS004,X«00C« 



Physical unit X' OOC ."was permanently 
assigned to a 2540 Card Reader at system 
generation time. 



X«ss« 



is the device specification. It is 
used for specifying mode settings for 
7-track and dual density 9-track 
tapes. If X'ss';is not specified, the 
system assumes X' 90V for 7-track tapes 
and X'CO* :for 9-track tapes. The 
possible specifications for X'ss* :are 
shown in Figure 3. 



Note ; The ASSGN control statement is 
necessary only when the symbolic unit 
assignment is being made to a physical 
device address which differs from that 
established at system generation time. 



"Appendix I: Sample Job Decks* contains 
illustrations of ASSGN statement usage. 



Preparing COBOL Programs for Processing 23 



1 1 .- — — — 


-T- 


~— ^— ^■"■" 


""■"" 


—————. 


__ — — .. 


T 


1 




1 




7- 


-Track Tape 


1 




Bytes J" 


— 


-T- 





J.- 


J| 




per 


1 






Translate | 


Convert 


1 ss 

1- — 1 

1 10 


Inch 
200 


1 
1 


Parity 


-+- 


Feature 


1 


Feature 
on 


odd 


off 


i 20 


200 


1 


even 




off 




off 


1 28 


200 


1 


even 




on 




off 


1 30 


200 


1 


odd 




off 




off 


1 38 


200 


1 


odd 




on 




off 


1 50 


556 


1 


odd 




off 




on 


1 60 


556 


1 


even 




off 




off 


i 68 


556 


1 


even 




on 




off 


1 70 


556 


1 


odd 




off 




off 


1 78 


556 


1 


odd 




on 




off 


1 90 


800 


1 


odd 




off 




on 


1 AO 


800 


1 


even 




off 




off 


i A8 


800 


1 


even 




on 




off f 


1 BO 


800 


1 


odd 




off 




off 


1 B8 


800 


1 


odd 


1 


on 


1 
J.- 


off 


















1 
h 

1 




9- 


•Track Tape 




1 CO 


800 


single density 


9-track | 


1 CO 


1600 


1 


single density 


9-track | 


1 CO 


1600 


1 


dual 


density 9- 


-track 1 


1 C8 
1 J 


800 


1 


dual 


density 9- 


■track 1 
1 



Figure 3. Possible Specifications for 
X'ss* in the ASSGN Control 
Statement 



CLOSE Statement 



The CLOSE control statement is used to 
close either a system or programmer logical 
unit assigned to tape. As a result of the 
CLOSE control statement, a standard 
end-of -volume label set is written and the 
tape is rewound and unloaded. The CLOSE 
statement applies only to a temporarily 
assigned logical unit, that is, a logical 
unit for which an ASSGN control statement 
has been specified within the same job. 
The format of the CLOSE control statement 
is as follows: 



I// CLOSE SYSxxx 



■,X'cuu' 
,UA 
,IGN 
,ALT 



l,X'gs«]- 



J 



The logical unit can optionally be 
reassigned to another device, unassigned, 
or switched to an alternate unit. 

Note that when SYSxxx is a system 
logical unit, one of the optional 
parameters must be specified. When closing 
a programmer logical unit, no optional 
parameter need be specified. 



SYSxxx 

may only be used for magnetic tape and 
may be specified as SYSPCH, SYSLST, 
SYSOUT, or SYSOOO through SYS221. 

X» cuu • 

specifies that after the logical unit 
is closed, it will be assigned to the 
channel and unit specified. (See 
"ASSGN Control Statement" for an 
explanation of • cuu' ; ) When 
reassigning a system logical unit, the 
new unit will be opened if it is 
either a mass storage device or a 
magnetic tape at load point. 



X»ss» 



UA 



IGN 



ALT 



represents device specification for 
mode settings on 7-track and 9-track 
tape. (See "ASSGN Control Statement" 
for an explanation of 'ss^.) If X' ss' 
is not specified, the mode settings 
remain unchanged. 



specifies that the logical unit is to 
be closed and unassigned. 



specifies that the logical unit is to 
be closed and lanassigned with the 
ignore option. This operand is 
invalid for SYSRDR, SYSIPT, or SYSIN. 



specifies that the logical unit is to 
be closed and an alternate unit is to 
be opened and used. This operand is 
valid only for system logical output 
units (SYSPCH, SYSLST, or SYSOUT) 
currently assigned to a magnetic tape 
unit. 



DATE Statement 



The DATE control statement contains a 
date that is put in the Communication 
Region of the Supervisor. A complete 
description of the fields of the 
Communication Region is given in "Appendix 
H: Communication Region. " The DATE 
statement is in one of the following 
formats : 

r 1 1 

|// DATE mm/dd/yy j 

I ^ 

|// DATE dd/mm/yy | 

I J 

where : 

mm = month (01 to 12) 
dd = day (01 to 31) 
yy = year (00 to 99) 



c; 



24 



C ; 



The format to be used is the format 
selected when the system was generated. 

When the DATE statement is used, it 
applies only to the current job being 
executed. The Job Control Processor does 
not check the operand except to ensure that 
its length is eight characters. If no DATE 
statement is specified in the current job, 
the Job Control Processor supplies the date 
given in the last SET command. The SET 
command is discussed in detail in the 
publication IBM Svstem/360 Disk Operating 
System; System Control and System Service 
Programs . 

A DATE statement should be included in 
every job deck that has as one of its job 
steps the execution of a COBOL program that 
utilizes the special register CURRENT-DATE, 
if the date desired is other than that 
designated in the previous SET command. 



TLBL Statement 



The TLBL control statement replaces the 
VOL and TPLAB combination used in previous 
versions of the system. However, the 
current system will continue to support 
these statements. The TLBL control 
statement contains file label information 
for tape label checking and writing. Its 
format follows: 



// TLBL filename, 

t • file-identifier' 3 , [date] , 
[ file-serial-number] , 
[volume-sequence-number] , 
[file-sequence- number] , 
[generation-number] , 
[version-number] 



filename 

identifies the file to the control 
program. It can be from one to seven 
characters in length. If the 
following SELECT sentence appears in a 
COBOL program: 

SELECT NEWFILE ASSIGN TO 
SYS003-UT-2U00-S-OUTFILE 

the filename operand on control 
statements for this file must be 
OUT FILE. If the SELECT clause were 
coded: 



•file-identifier' : 

consists of from 1 to 17 characters, 
contained within apostrophes^ 
indicating the name associated with 
the file on the volume. This operand 
may contain embedded blanks. If this 
operand is omitted on output files, 
the filename will be used. If this 
operand is omitted on input files, no 
checking will be done. 

date 

consists of from one to six 
characters, in the format yy/ddd, 
indicating the expiration date of the 
file for output or the creation date 
for input. (The day of the year may 
consist of from one to three 
characters.) For output files, a one 
to four character retention period 
(d-dddd) may be specified. If this 
operand is omitted, a 0-day retention 
period will be assumed for output 
files. For input files, no checking 
will be done if this operand is 
omitted or if a retention period is 
specified. 

file- serial-number 

consists of from one to six characters 
indicating the volume serial number of 
the first (or only) reel of the file. 
If fewer than six characters are 
specified, the field will be 
right- justified and padded with zeros. 
If this operand is omitted on output 
files, the voliame serial number of the 
first (or only) reel of the file will 
be used. If the operand is omitted on 
input files, no checking will be done, 

volume- sequence-number 

consists of from one to four 
characters in ascending order for each 
volume of a multivolume file. This 
number is incremented automatically by 
OPEN and CLOSE routines as required. 
If this operand is omitted on output 
files, BCD 0001 will be used. If 
omitted on input files, no checking is 
done. 

file- sequence -number 

consists of from one to four 
characters in ascending order for each 
file of a multivolume file. This 
number is incremented automatically by 
OPEN and CLOSE routines as required. 
If this operand is omitted on output 
files, BCD 0001 will be used. If it 
is omitted on input files, no checking 
will be done. 



SELECT NEWFILE ASSIGN TO 
SYS003-UT-2a00-S 

the filename operand on the control 
statement for the file must be SYS003. 



generation-number 

consists of from one to four numeric 
characters that modify the 
file-identifier. If this operand is 
omitted on output files, BCD 0001 is 



Preparing COBOL Programs for Processing 25 



used. If it is omitted on input 
files, no checking will be done. 

vers ion- number 

consists of from one to two numeric 
characters that modify the generation 
number. If this operand is omitted on 
output files, BCD 01 will be used. If 
it is omitted on input files, no 
checking will be done. 

Note ; If a tape file with standard labels 
is opened two different ways in the same 
COBOL program, and that file resides on a 
multifile volume, the programmer should use 
two separate TLBL cards with different 
filenames specified on each. 



DLBL Statement 



The DLBL control statement, in 
conjunction with the EXTENT statement, 
replaces the VOL, DLAB, and XTENT 
combination used in previous versions of 
the Disk Operating System. However, the 
current system will continue to support the 
VOL, DLAB, and XTENT statements. The DLBL 
statement has the following format: 



left- justified and padded with blanks. 
If this operand is omitted, filename 
will be used. 



date 



consists of from one to six characters 
indicating either the retention period 
of the file in the format d through 
dddd (1-9999), or the absolute 
expiration date of the file in the 
format yy/ddd. When the d through 
dddd format is used, the file is 
retained for the number of days 
specified as dddd. For example, if 
date is specified as 31, the file will 
be retained a month from the day of 
creation. When the yy/ddd foirmat is 
used, the file is retained until the 
day (ddd) in the year (yy) specified. 
For example, if date is specified as 
69/200, the file will be retained 
through the 200th day of the year 
1969. 



If date is omitted when the file is 
created, a 7-day retention period is 
assumed. If this operand is present 
for a file opened as INPUT or I-O, it 
is ignored. 



|// DLBL filename 

I , Cfile-identifer'], [date], (codes] 



codes 



filename 

identifies the file to the control 
program. It can be from one to seven 
characters in length. . If the 
following SELECT sentence appears in a 
COBOL program: 

SELECT INFILE ASSIGN TO 
SYS005-DA-2311-A-INPDTA 

the filename operand on control 
statements for this file must be 
INPDTA. If the SELECT sentence is 
coded : 



is a 2- or 3-character field 
indicating the type of file label, as 
follows : 



SD = Sequential Disk 
DA = Direct Access 
ISC = Indexed Sequential using Load 

Create 
ISE = Indexed Sequential using Load 
Extension, Add, or Retrieve 

If code is omitted, SD is assumed. 

"Appendix I: Sample Job Decks" contains 
illustrations of DLBL statement usage. 



SELECT INFILE ASSIGN TO 
SYS005-DA-2311-A 

the filename operand on control 
statements for the file must be 
SYS005. 

•file- identifier* : 

is the name associated with the file 
on the volume. This can consist of 
from 1 to 4U alphanumeric characters 
contained within apostrophes, 
including the file- identifier and, if 
used, generation- number and version- 
number of generation. If fewer than 
UU characters are used, the field is 



EXTENT Statement 



The EXTENT control statement defines 
each area (or extent) of a DASD file — a 
file assigned to a mass storage device. 
One or more EXTENT control statements must 
follow each DLBL statement. 

The EXTENT control statement replaces 
the XTENT statement used in previous 
versions of the Disk Operating System. 
However, XTENT will continue to be 
supported in the current system. 



26 



The format of the EXTENT control 
statement is: 



V / 



j// EXTENT [symbolic-unit], [serial-ntiraber] j 
I , [type] , (sequence-number] | 

I , [relative-track], [number-of-tracks] | 
I , [split-cylinder-track] , [B=bins] | 



symbolic-unit 

is a 6-character field indicating the 
symbolic unit (SYSxxx) of the volume 
for which this extent is effective. 
If this operand is omitted, the 
symbolic unit of the preceding EXTENT 
statement will be used. When 
specified, symbolic-unit may be any 
SYSxxx assigned to the device type 
indicated in the SELECT sentence for 
the file. For example, if the 
following coding appears in a COBOL 
program: 



SELECT ODTFILE ASSIGN TO 
SYS00U-DA-2311-'A 



the symbolic \init in the EXTENT 
control statement can by any SYSxxx 
assigned to a 2311 disk pack. The 
symbolic unit operand is not required 
for an IJSYSxx filename, where xx is 
IN, PH, LS, RS, SL, or RL. If SYSRDR 
or SYSIPT is assigned, this operand 
must be included. 

serial-number 

consists of from one to six characters 
indicating the volume serial number of 
the volume for which this extent is 
effective. If fewer than six 
characters are used, the field will be 
right- justified and padded with zeros. 
If this operand is omitted, the volume 
serial number of the preceding EXTENT 
control statement will be used. If no 
serial number was provided in the 
EXTENT control statement, the serial 
number will not be checked and it will 
be the user's responsibility if files 
are destroyed as a result of mo\inting 
the incorrect vol\ame. 



type 



consists of one character indicating 
the type of the extent, as follows: 

1 ■= — Data area (no split cylinder) 

2 — Overflow area (for an indexed 

file) 
4 — Index area (for an indexed file) 
8 — Data area (split cylinder) 

If this operand is omitted, 1 is 
assumed. 



sequence-number 

consists of from one to three 
characters containing a decimal number 
from to 255 indicating the sequence 
number of this extent within a 
multi-extent file. Extent sequence 
is used for the master index of an 
indexed file. If the master index is 
not used, the first extent of an 
indexed file has the sequence number 
1. The extent sequence number for all 
other types of files begins with 0. 
If this operand is omitted for the 
first extent of ISFMS files, the 
extent will not be accepted. For SD 
or DA files, this operand is not 
required. Direct files can have up to 
five extents. Indexed files can have 
up to eleven data extents (nine prime, 
one cylinder index, one separate 
overflow) . 



relative-track 

consists of from one to five 
characters indicating the sequential 
number of the track, relative to zero, 
where the data extent is to begin. If 
this field is omitted on an ISFMS 
file, the extent will not be accepted. 
This field is not required for DA 
input or for SD input files (the 
extents from the file labels will be 
used) . 

Formulas for converting actual to 
relative track addresses (RT) and 
relative track to actual for the DASD 
devices follow. 

Actual to Relative: 

2311 10 X cylinder number + track 
number = RT 

2314 20 X cylinder number + track 
number = RT 

2321 1000 X subcell niimber + 100 x 
strip number + 20 x block 
ntimber + track n\amber = RT 

Relative to Actual: 

2311 RT = quotient is cylinder, 
10 remainder is track 

2314 RT = quotient is cylinder, 
20 remainder is track 

2321 RT = quotient is subcell, 
1000 remainder 1 

remainderl = quotient is strip, 
100 remainder2 

remainder2 = quotient is block, 
20 remainder is track 



Preparing COBOL Programs for Processing 27 



Example ; Track 5, cylinder 150 on 
a 2311 = 1505 in relative track. 

number-of-tracks 

consists of from one to five 
characters indicating the ntmber of 
tracks to be allocated to the file. 
For SD input files, this field may be 
omitted. The number of tracks for a 
split cylinder file must be a multiple 
of the number of cylinders specified 
for the file and the number of tracks 
specified for each cylinder. 

split-cylinder-track 

consists of from one to two 
characters, with a value of through 
19, indicating the upper tack number 
for the split cylinder in SD files. 

bins 

consists of from one to two characters 
identifying the 2321 bin that the 
extent was created for, or on which 
the extent is currently located. If 
the field is one character, the 
creating bin is assumed to be zero. 
There is no need to specify a creating 
bin for SD or ISFMS files. If this 
operand is omitted, bin is assimied 
for both bins. If the operand is 
included and positional operands are 
omitted, only one comma is required 
preceding the keyword operand. If any 
operands preceding the bin 
specification are omitted, one comma 
for each operand is acceptable, but 
unnecessary. 

Figure 4 shows examples of using the 
DLBL statement in conjunction with the 
EXTENT statement. "Applendix I: Sample 
Job Decks" contains illustrations of EXTENT 
statement usage. 



VOL Statement 



The VOL control statement is used when 
standard labels for a DASD or tape file are 
checked. It is used in conjunction with 
TPLAB or DLAB and XTENT statements. The 
VOL and TPLAB or VOL, DIAB and XTENT 
statements must appear in that order and 
must immediately precede the EXEC statement 
to which they apply. The format of the VOL 
control statement is: 



|// VOL SYSxxx, filename 



SYSxxx 

is the symbolic unit name. The 
symbolic unit name is the same name 
that appears in the XTENT statement 
for the file. 

filename 

identifies the file to the control 
program. It can consist of from one 
to seven characters. The appearance 
of two identical operands is 
characteristic of COBOL object 
mod\iles, since filename might be the 
logical unit which is assigned to a 
device. 

Note that filename , as used in this 
context, does not refer to the COBOL 
file- name, but to filename as it is used by 
the system. 

For example, if the following COBOL 
coding appeared as part of a complete 
program, MASTERX is the name by which the 
file is known to the control program. 



Direct file: 



The following DLBL and EXTENT statements describe a direct file occupying 840 
tracks, beginning on relative track 10. 

// DLBL MASTER, ,7 5/0 01, DA 

// EXTENT SYS015, mill, 1,0,10,840 



Indexed file: 



The following DLBL and EXTENT statements describe an indexed file occupying 80 
tracks, beginning on relative track 1106. The first EXTENT allocates a U- track 
cylinder index. The second EXTENT allocates a 76-track data area. 

// DLBL MASTER, ,75/001, ISC 

// EXTENT SYS015,111111,4,1,1106,I» 

// EXTENT SYS015, mill, 1,2, 1110, 76 






Figure 4. Sample Label and File Extent Information for Mass Storage Files 



28 



C) 



ENVIRONMENT DIVISION. 

FILE-CONTROL. 

SELECT MASTER-FILE ASSIGN TO 
SYS 4-UT- 2400- S-MASTERX 



DATA DIVISION. 
FILE SECTION. 
FD MASTER-FILE 



The VOL control statement for the file 
could be coded as follows: 

// VOL SYS004,MASTERX 

If the COBOL SELECT sentence had been 
coded as : 

SELECT MASTER-FILE ASSIGN TO 
SYS004-UT-2U00-S 



on control statements for the file must be 
SYS004. Both of the following VOL control 
statements are acceptable: 

// VOL SYS004,SYS004 
// VOL SYS005,SYS00U 



DLAB Statement 



The DLAB control statement contains 
information for label checking and creation 
of files assigned to mass storage devices. 
This statement must immediately follow a 
VOL control statement. (Disk label formats 
are given in "Appendix C: Standard Mass 
Storage Device Labels.") The foimat of the 
DLAB control statement is: 



|// DLAB 'label fields 1-3 », 

I xxxx, yyddd, yyddd, • systemcode' [ , type] 



SYSOOU would be the name by which the file 
is known to the control program and the VOL 
statement could be coded as follows: 

// VOL SYS004,SYS00U 

The filename , as used in the VOL control 
statement format, is identical to the 
symbolic name of the program DTF that 
identifies the file. Although, in COBOL, 
displacement is from the symbolic name 
MASTER-FILE when referencing the DTF, the 
system interprets this to be MASTERX in the 
first case, and SYSOOU in the second case. 

When coding the VOL control statement 
for files assigned to mass storage devices, 
there is an additional consideration. If 
the following SELECT sentence appears in a 
COBOL program: 

SELECT INFILE ASSIGN TO 
SYS 01-DA- 2 311-A-INPTJTA 

the symbolic unit name on the control 
statements for the file can be any SYSxxx 
assigned to a 2311 disk pack. The filename 
on control statements for the file must be 
INPUTA. 

For example, the VOL control statement 
might be: 

// VOL SYSO 21, INPUTA 

If the SELECT sentence were coded: 

SELECT INFILE ASSIGN TO 
SYS004-DA-2311-A 

the symbolic unit name on control 
statements for the file can be any SYSxxx 
assigned to a 2311 disk pack. The filenaime 



•label fields 1-3* 

The first three- fields of the 
disk-file label are contained just as 
they appear in the label. This is a 
51-character string contained within 
apostrophes and followed by a comma. 

The DLAB statement requires two cards 
for completion; therefore, column 72 
of the first card reqiiires a character 
punch other than a blank. The columns 
between the comma and the continuation 
character must be blank. 

xxxx 

is the volume-sequence-number in field 
4 of the Format 1 label and must begin 
in card column 16 of the second card. 

yyddd,yyddd 

is the file creation date followed by 
the file expiration date. It is 
recommended that this field be left 
blank. 

• systemcode • 

is ignored by the Disk Operating 
System- The dummy field specified 
must be 13 characters long. 



type 



indicates the type of file label: 

SD = Sequential Disk 

DA = Direct Access 

ISC = Indexed Sequential (used when 

creating the file) 
ISE = Indexed Sequential (used when 

updating or retrieving the 

file) 

SD is assumed if this entry is 
omitted. 



Preparing COBOL Programs for Processing 29 



TPIiAB Statement 



The TPLAB control statement contains 
file label infoirmation for tape label 
checking and creation. It must immediately 
follow a VOL control statement. The TPIAB 
control statement contains an image of a 
portion of the standard tape file label. 
The format and contents of a standard tape 
label are given in "Appendix B: Standard 
Tape File Labels." The format of the TPLAB 
control statement is as follows: 



I 

j// TPIiAB 

I 

L 



•label fields 3-10* 
•label fields 3-13* 



•label fields 3-10* 

is a 49-byte character string 
contained within apostrophes, 
identical to positions 5 through 53 of 
the tape file label. These fields can 
be included in one line and are the 
only ones used for label checking. 

•label fields 3-13 • 

is a 69-byte character string 
contained within apostrophes, 
identical to positions 5 through 73 of 
the tape file label. These fields are 
too long to be included on a single 
line. The character string must 
extend into column 71, a continuation 
character (any character) must be 
placed in column 72, and the character 
string is completed on the next line. 
The continuation line starts in column 
16. Fields 3 through 13 are written 
in the corresponding fields when the 
output label is created. When 
specified for an input file, fields 11 
through 13 are ignored. However, even 
for output files, fields 11 through 13 
are never used by the Disk Operating 
System label processing routines. 



XTENT Statement 



The XTENT control statement is used to 
define an area of a file on a mass storage 
device. Each DASD file (file assigned to a 
mass storage device) requires one or more 
XTENT control statements. The format of 
the XTENT control statement is: 



j// XTENT type, sequence, lower, upper 
I • serial no • , SYSxxx ( , Ba 3 



Extent Type — occupies one or three 
colirains containing: 



1 = Data area (no split cylinder) 

2 = Overflow area (for an indexed 

file) 
4 = Index area (for an indexed file) 
128 = Data area (split cylinder). If 
type 128 is specified, the lower 
head is assumed to be H^ H^ H^ 
in lower, and the upper head is 
assumed to be Ha. Ha Ha in upper . 
(See the discussion of the lower 
and upper fields. ) 



sequence 



lower 



type 



Each XTENT type identifies the funtion 
of the defined area. 



Extent Sequence Number — 
indicates the sequence number 
of this extent within a 
multi -extent file. The 
sequence number occupies one 
to three columns and contains 
a decimal number from to 
255. Extent sequence is 
used for the master index of 
an indexed file. If the 
master index is not used, the 
first extent of an indexed 
file contains sequence number 
1. The extent sequence for 
all other types of files 
begins with 0. Direct files 
can have up to five extents. 
Indexed files can have up to 
eleven data extents (nine 
prime, one cylinder index, one 
separate overflow). 

Lower Limit of Extent — 
occupies nine columns and 
contains the lowest address of 
the extent in the form 
BxC-|.CiCaCaCaHjLHaHa 

where : 

B± is the initially assigned 
cell number. It is equal to: 

for 2311 and 2314 
to 9 for 2321 

CiCj. is the subcell number. 
It is equal to: 

00 for 2311 and 2314 
00 to 19 for 2321 

CaCaCa is the cylinder number. 
It can be: 

000 to 199 for 2311 and 
2314 

or strip number: 

000 to 009 for 2321 



v. 



30 



Hx is the head block position. 
It is equal to: 

for 2311 and 231U 
to 4 for 2321 

HaHa is the head niimber. * It 
can be: 

00 to 09 for 2311 
00 to 19 for 2321 and 
2314 



jobname 

is a user-defined name consisting of 
from one to eight alphanumeric 
characters. Any user comments can 
appear on the JOB control statement 
following the jobname (through column 
72), If the timer featiire is present, 
the time of day appears in columns 73 
to 80 when the JOB statement is 
printed on SYSLST. The time of day is 
also printed in columns 1 through 8 on 
the next line of SYSLOG. 



upper 



A lower extent of all zeros is 
invalid. 

Note : For 2321, the last five 
strips of subcell 19 are 
reserved for alternate tracks. 

Upper Ijimit of Extent — 
occupies nine columns 
containing the highest address 
of the extent in the same foinn 
as the lower limit. 



If a job is restarted, the jobname 
must be identical to that used when 
the checkpoint was taken. 

Note : The JOB statement resets the effect 
of all previously issued OPTION and ASSGN 
control statements. 



•serial no' Volume Serial Number -- This 
is a 6-byte alphanxraieric 
character string, contained 
within apostrophes. The 
number is the same as in the 
volume label (volume serial 
number) and the Format 1 label 
(file serial ritamber). 

SYSxxx This is the symbolic address 
of the DASD drive. If more 
than one symbolic address is 
to be specified on separate 
XTENT cards for the same file, 
the symbolic addresses must be 
in consecutive order. See 
"EXTENT Statement" for details 
on SYSxxx assignments. 

Ba Currently assigned cell 

number. Its value is: 

for 2311 or 2314 
to 9 for 2321 

This field is optional. If 
missing, the Job Control 
Processor assigns Ba = B^. 



JOB Statement 



The JOB control statement indicates the 
beginning of control information for a job. 
The JOB control statement is in the 
following format: 



LBLTYP Statement 



The LBLTYP control statement defines the 
amount of storage to be reserved at linkage 
edit time in the problem program area of 
main storage in order to process tape and 
nonsequential DASD file labels. It applies 
to both background and foreground object 
programs, and is required if the file 
contains standard labels. 

The LBLTYP control statement immediately 
precedes the // EXEC LNKEDT statement in 
the job deck, with the exception of 
self -relocating programs for which it is 
instead submitted immediately preceding the 
// EXEC statement for the program. The 
format of the LBLTYP control statement is: 



\// LBLTYP < 
I ( 



( TAPE((nn)] 
NSD(nn) 



j// JOB jobname 



TAPE[(nn)] 

is used only if tape files requiring 
label information are to be processed 
and if no nonsequential DASD files are 
to be processed, rm is optional and 
is present only for future expansion. 
It is ignored by the Job Control 
Processor. 

NSD(nn) 

is used if any nonsequential DASD 
files are to be processed, regardless 
of other type files that are used, nn 
specifies the largest number of 
extents to be used for a single file. 



Preparing COBOL Programs for Processing 31 



LISTIO Statement 



The LISTIO control statement causes the 
system to print a list of input/output 
assignments on SYSLST. The format of the 
LISTIO control statement is: 



X'cuu* 

causes the logical units assigned to 
the physical unit specified to be 
listed. 



I// LISTIO 



SYS 

PROG 

Fl 

F2 

M.L 

SYSxxx 

UNITS 

DOWN 

UA 

X" CUU» 



T 






J 



SYS 



PROG 



Fl 



F2 



2^L 



causes the physical units assigned to 
all system logical units to be listed. 



causes the physical units assigned to 
all background programmer logical 
\inits to be listed. 



causes the physical units assigned to 
all foreground-one logical units to be 
listed. 



causes the physical units assigned to 
all foreground-two logical units to be 
listed. 



causes the physical units assigned to 
all logical units to be listed. 



SYSxxx 

causes the physical units assigned to 
the logical unit specified to be 
listed. 



UNITS 



DOWN 



causes the logical units assigned to 
all physical units to be listed. 



causes all physical units specified as 
inoperative to be listed. 



UA 



causes all physical units not 
currently assigned to a logical unit 
to be listed. 



MTC Statement 



The MTC control statement controls 2400 
series magnetic tape operations. The 
format is as follows: 



\// MTC opcode, SYSxxx [,nn] 



opcode 

specifies the operation to be 
performed, opcode can be chosen from 
the following: 

BSF — Backspace to tapemark 

BSR — Backspace to interrecord gap 

ERG — Erase gap (write blank tape) 

FSF — Forward space to tapemark 

FSR — Forward space to interrecord 
gap 

RUN — Rewind and unload 

REW — Rewind 

WTM — Write tapemark 

SYSxxx 

represents any logical unit assigned 
to magnetic tape upon which the MTC 
control statement is to operate. 



[^nn] 



is the decimal number (01 through 99) 
which, if specified, represents the 
number of times the operation is to be 
performed. If nn is omitted, the 
operation is performed once. 



OPTION statement 



The OPTION control statement is used to 
specify one or more of the options of the 
Job Control Processor. The format of the 
OPTION statement is: 



j// OPTION optionl(,option2].. 



32 



The order in which the selected options 
appear in the operand field is arbitrary. 
Options are reset to the standard 
established at system generation time upon 
encountering the next JOB statement or the 
/g statement. 



The options are: 



LIST 



LOG 



causes the listing of columns 1 
through 80 of all control statements 
on SYSLST. If LOG is not the standard 
established at system generation time, 
control statements are not listed 
until a LOG option is encoxintered. 
Once a LOG option statement is read, 
logging continues from job step to job 
step until a NOLOG option is 
encountered or imtil either the JOB or 
/& control statement is encountered. 



NOLOG 



DUMP 



suppresses the listing of all control 
statements on SYSLST until a LOG 
option is encountered , or until either 
the JOB or /g control statement is 
encountered. 



causes a d\imp of the registers and 
main storage to be printed on SYSLST 
in the case of an abnormal program 
termination (such as a program check). 

NODUMP 

suppresses the DUMP option. 

LINK 

indicates that the object module is to 
be linkage edited. When the LINK 
option is used, the output of the 
COBOL compiler is written on SYSLNK. 
The LINK option must always precede an 
EXEC LNKEDT statement in the job deck. 
(CATAL also causes the LINK option to 
be set.) LINK is not acceptable to 
the Job Control Processor operating in 
the foreground. 

NOLINK 

suppresses the LINK option. The COBOL 
compiler can also suppress the LINK 
option if the program contains an 
error that would preclude the 
successful execution of the program. 

DECK 

causes the COBOL compiler to punch an 
object module on SYSPCH. If both DECK 
and LINK are specified, the output of 
the compiler is written on both SYSPCH 
and SYSLNK. 

NODECK 

suppresses the DECK option. 



causes the compiler to write the COBOL 
source statements on SYSLST. 



NOLIST 

suppresses the LIST option. 

LISTX 

causes the COBOL compiler to write a 
Procedure Division map on SYSLST. 

NOLISTX 

suppresses the LISTX option. 

XREF 

causes the COBOL compiler to write a 
symbolic cross-reference list on 
SYSLST. 

NOXREF 

suppresses the XREF option. 



SYM 



causes the COBOL compiler to write a 
Data Division map on SYSLST. 



NOSYM 



suppresses the SYM option. 



ERRS 



causes the COBOL compiler to write the 
diagnostic messages related to the 
source program on SYSLST. 

NOERRS 

suppresses the ERRS option. 



CATAL 



causes the cataloging of a phase or 
progrcim in the core image library upon 
completion of a linkage editor job 
step. CATAL also causes the LINK 
option to be set. CATAL is not 
accepted by the Job Control Processor 
operating in a batched- job foreground 
environment. 



STDLABEL 

causes the standard label track to be 
cleared and all DASD or tape labels 
submitted after this point to be 
written on the standard label track. 
This option is reset to the USRLABEL 
option at end-of-job or end-of-job 
step. All file definition statements 
s\ibmitted after the STDLABEL option 
are available to any program in any 
area until another set of standard 
file definition statements is 
submitted. STDLABEL is not accepted 
by the Job control Processor operating 
in a batched- job foreground 
environment. All file definition 
statements following OPTION STDLABEL 
are included in the standard file 
definition set until one of the 
following occurs: 



Preparing COBOL Programs for Processing 33 



• End-of-job step 
•' End-of-job 

• OPTION USRLABEL is specified 

• OPTION PARSTD is specified 



PAUSE Statement 



The PAUSE control statement allows for 
operator intervention between job steps. 
The format of the PAUSE control statement 
is: 



USRLABEL 

causes all DASD or tape labels 
siibraitted after this point to be 
written at the beginning of the user 
label track. 



PARSTD 

causes all DASD or tape labels 
submitted after this point to be 
written at the beginning of the 
partition standard label track. The 
PARSTD option is reset to the USRLABEL 
option at end-of-job or end-of-job 
step. All file definition statements 
submitted after the PARSTD option will 
be available to any program in the 
current partition until another set of 
partition standard file definition 
statements is submitted. All file 
definition statements submitted after 
OPTION PARSTD will be included in the 
standard file definition set until one 
of the following occurs; 



r 1 

|// PAUSE [comments] j 

I i J 

The PAUSE control statement is effective 
just before the next input control 
statement in the job deck is read. The 
PAUSE control statement always prints on 
SYSLOG and SYSLST. 

An example of this statement is: 

// PAUSE SAVE SYS004, SYS 005, MOUNT 
NEW TAPES 

This sample statement instructs the 
operator to save the output tapes and mount 
two new tapes. 

When the PAUSE statement is encountered 
by the Job Control Processor, the printer 
keyboard (IBM 1052) is unlocked for 
operator-message input. The 
end-of -communication indicator, B, causes 
processing to continue. If an IBM 1052 
Printer is not available, the PAUSE control 
statement is ignored. 



• End-of-job step 

• End-of-job 

• OPTION USRLABEL is specified 

• OPTION STDLABEL is specified 



For a given filename, the sequence of 
search for label information during an 
OPEN is the USRLABEL area, followed by 
the PARSTD area, followed by the 
STDLABEL area. 



The options specified in the OPTION 
statement remain in effect until a 
contradictory option is encountered or 
until a JOB control statement is read. In 
the latter case, the options are reset to 
the standard that was established at system 
generation time. 



Any assignment for SYSLNK, after the 
occurrence of the OPTION statement, cancels 
the LINK and CATAL options. These two 
options are also canceled after each 
occurrence of an EX^C statement with a 
blank operand. 



RESET statement 



The RESET control statement resets 
input/output assignments to the standard 
assignments. The standard assignments are 
those specified at system generation time 
plus any modifications made by the operator 
by means of the ASSGN command without the 
TEMP option. The RESET command is 
discussed in detail in the publication IBM 
System/360 Disk Operating System; System 
Control and System Service Programs . The 
format of the RESET statement is: 



j// RESET 



(SYS ) 
IPROG f 
lALL ( 
(sYSxxx) 



SYS 



PROG 



resets all system logical units to 
their standard assignments. 



resets all programmer logical units to 
their standard assignments. 



34 



c 



ALL 



resets all system and programmer 
logical lanits to their standard 
ass ignments . 



SYSxxx 

resets the logical unit specified to 
its standard assignment. 



When a checkpoint is taken, the 
completed checkpoint is noted on SYSLOG. 
Restarting can be done from any checkpoint 
record, not just the last. The jobname 
specified in the JOB statement must be 
identical to the jobname used when the 
checkpoint was taken. The proper 
input/output device assignments must 
precede the RSTRT control statement. 



RSTRT Statement 



A restart facility is available for 
checkpoint programs. A programmer can use 
the source language RERUN clause in his 
program to cause checkpoint records to be 
written. This allows sufficient 
information to be stored so that program 
execution can be restarted at a specified 
point. The checkpoint information includes 
the registers, tape positioning 
information, a dump of main storage, and a 
restart address. 

The restart facility allows the 
programmer to continue execution of an 
interrupted job at a point other than" the 
beginning. The procedure is to submit a 
group of job control statements including a 
RSTRT control statement. The format is as 
follows : 



\// RSTRT SYSxxx,nnnn[, filename] 



SYSxxx 

is the symbolic unit name of the 
device on which the checkpoint records 
are stored. This unit must have been 
assigned previously. 



nnnn 



C) 



is the identification of the 
checkpoint record to be used for 
restarting. This serial number 
consists of four characters. It 
corresponds to the checkpoint 
identification used when the 
checkpoint was taken. The serial 
number is supplied by the checkpoint 
routine. 



filename 

is the symbolic name of the 2311 or 
2314 disk checkpoint file used for 
restarting. It must be identical to 
the SYSxxx of the system-name 
specified in the RERUN clause. This 
operand applies only when specifying 
2311 or 231 U disk as the checkpoint 
file. 



Assignment of input/output devices to 
symbolic unit names may vary from the 
initial assignment. Assignments are made 
for restarting jobs in the same manner as 
assignments are made for normal jobs. 



See the chapter "Program Checkout" for 
fiarther details on taking checkpoints and 
restairting a program for which checkpoints 
have been taken. 



UPSI Statement 



The UPSI control statement allows the 
user to set program switches that can be 
tested by problem programs at execution 
time. The UPSI control statement has the 
following format: 



\// UPSI nnnnnnnn 



nnnnnnnn 

consists of from one to eight 
characters of 0, 1, or X. Positions 
containing 1 are set to 1; positions 
containing X are unchanged. 
Unspecified rightmost positions are 
assumed to be X. 

The UPSI byte is the 24th byte in the 
Communication Region of the Supervisor. A 
complete description of the fields of the 
Communication Region is given in "Appendix 
H: Communication Region." The Job Control 
Processor clears the UPSI byte to binary 
zeros before reading control statements for 
each job. VJhen the UPSI control statement 
is read, the Job control Processor sets 
these bits to the user's specifications. 
Any combination of the eight bits can be 
tested in the COBOL source program at 
execution time by means of the source 
language switches UPSI-0 through UPSI-7. 



CBL STATEMENT — COBOL OPTION CONTROL CARD 



Although most options for compilation 
are specified either at system generation 
time or in the OPTION control statement. 



Preparing COBOL Programs for Processing 35 



the COBOL compiler provides an additional 
statement, the CBL statement, for the 
specification of compile-time options 
lanique to COBOL. CLIST 



The CBL card must be placed between the 
EXEC FCOBOL Statement and the first 
statement in the COBOL program. The CBL 
card cannot be continued. However, if 
specification of options will continue past 
column 71, multiple CBL cards may be used. 



option is omitted, single spacing is 
provided. 



indicates that a condenseu listing is 
to be produced. The Procedure 
Division portion of the object listing 
will contain the address of the first 
generated instruction for each verb. 
The CLIST option overrides the LISTX 
or NOLISTX options. The LISTX or 
NOLISTX options are either established 
at system generation time or specified 
in the OPTION control statement. 



The options shown in the following 
format may appear in any order. No blanks STXIT 
may appear in the operand field. 
Underscoring indicates the default case. 



enables a user error declarative to 
get control when an input/output error 
occurs on a unit record device. 



r, SEQ 1 r,FLAGWl 
l] L»NOSEqJ Lr' 



CBL [BUF=nnnnn] L»NOSEQj LrFLAGEj 
[,SUPMAP] [,SPACEn] [, CLIST] [, STXIT] 



[: 



QUOTE"! 

apostJ 



r,LIBR -| r^ TRUNC "I 
|_, NQLIBR J [, NOTRUNC J 



QUOTE 
APOST 



J 



CBL 



must begin in column 2 and be preceded 
and followed by at least one blank. 



BUF=nnnnn 

the BUF option specifies the cimount of 
storage to be assigned to each 
compiler work file buffer, nnnnn is a 
decimal number from 256 to 32,767. If 
this option is not specified, 256 is 
assumed. 



SE2 
NOSEQ 



indicates whether the compiler will 
sequence-check source statements. 

FLAGW 

FLAGE 

FLAGW indicates that both warning and 
error diagnostic messages are to be 
listed; FLAGE indicates that only 
error diagnostic messages are to be 
listed. 

SUPMAP 

causes the LINK, DEck, CLIST, and 
LISTX options to be suppressed if an 
E-level diagnostic message is produced 
by the compiler. 

SPACEn 

indicates the type of spacing to be 
used on the output listing, n can be 
specified as either 1 (single 
spacing), 2 (double spacing), or 3 
(triple spacing). If the SPACEn 



QUOTE indicates to the compiler that 
the double quotation marks C) should 
be accepted as the character to 
delineate literals; APqST indicates 
that the apostrophe ( • 1 should be 
accepted. The compiler will generate 
the specified character for the 
figurative constant QUOTE (S). 

LIBR 

NOLIBR 

LIBR specifies that the BASIS card 
and/or the COPY statement are used in 
the source program. NOLIBR allows 
additional table space to be available 
during compilation. 

NOTRUNC 

TRUNC 

NOTRUNC specifies nonstandard 
truncation of COMPUTATIONAL items. 
With nonstandard truncation, an item 
is trxancated on the basis of the 
amount of storage it occupies, rather 
than on the basis of its PICTURE 
clause. 

For example, suppose that the 
programmer using the NOTRUNC option 
describes two Data Division items as 
follows : 

A PICTURE S9999 USAGE 

COMPUTATIONAL. 
B PICTURE S9 USAGE COMPUTATIONAL. 

After the following Procedure Division 
statement is executed, B contains the 
value of A, since each item occupies 
one halfword of storage. 

MOVE A TO B 

With the TRUNC option, standard 
truncation of COMPUTATIONAL items 
occ\ars. Standard truncation is based 



n 



^- 



-X 



36 



on the PICTURE clause of the item 
being moved. 

For example, with standard triancation, 
after the MOVE described above is 
executed, B contains only the 
low-order digit of A. According to 
the rules of standard truncation, 
COMPUTATIONAL items are converted to 
internal decimal, moved with decimal 
alignment, and truncated. 



JOB CONTROL COMMANDS 



Job control commands are distinguished 
from job control statements by the absence 
of // blank in positions 1 through 3 of 
each command. They permit the operator to 
adjust the system according to day-to-day 
operating conditions. This is particularly 
true in the area of device assignment, 
where the operator may need to (1) 
commtinicate to the system that a device is 
unavailable, or (2) designate a different 
device as the standard for a given symbolic 
unit. Therefore, these commands normally 
are not a part of the regular job deck for 
a job. Job control commands tend to be 
effective across jobs, whereas job control 
y \ statements are confined within a job. 

f ) 

^-,y Job control commands are discussed in 

detail in the publication IBM System/360 

Disk Operating System; System Control and 

System Service Programs . 



LINKAGE EDITOR CONTROL STATEMENTS 



Object modules used as input to the 
Linkage Editor must include linkage editor 
control statements. There are four linkage 
editor control statements: PHASE, INCLUDE, 
ENTRY, and ACTION. 

The discussion of these statements in 
this publication applies only to background 
programs. For foreground programs, see the 
publication IBM Svstem/360 Disk Operating 
System: System Control and System Service 
Programs. 

Linkage editor control statements 
initially enter the system through the 
device assigned to SYSRDR as part of the 
input job stream. PHASE and INCLUDE 
statements may also be present on SYSIPT or 
in the relocatable library. All four 
statements are verified for operation 
(INCLUDE, ACTION, ENTRY, or PHASE) and are 
copied to SYSLNK to become input when the 
Linkage Editor is executed. 



Linkage editor control statements must 
be blank in position 1 of the statement. 
The operand field is terminated by the 
first blank position. It cannot extend 
beyond column 72. 

The Linkage Editor is executed as a 
distinct job step. Figure 5 shows how the 
linkage editor f vinction is performed as a 
job step in three kinds of operations. 

1. Catalog Programs in Core Image 
Library. The linkage editor function 
is performed immediately preceding the 
operation that catalogs programs into 
the core image library. When the 
CATAL option is specified, programs 
edited by the Linkage Editor are 
cataloged in the core image librairy by 
the Librarian after the editing 
function is performed. The sequence 
of this operation is shown in Part (S) 
of Figure 5. Note that the input for 
the LNKEDT function could contain 
modules from the relocatable library 
instead of, or in addition to, those 
modules from the card reader, tape 
unit, or mass storage unit extent 
assigned to SYSIPT. This is 
accomplished by naming the module (s) 
to be copied from the relocatable 
library in an INCLUDE statement. 

2. Load- and- Execute . The sequence of 
this ^operation is shown in Part (S) of 
Figure 5. Specifying OPTION LINK 
causes the Job Control Processor to 
open SYSLNK, and allows the Job 
Control Processor to place the object 
module (s) and linkage editor control 
statements on SYSLNK. As with the 
catalog operation, the input can 
consist of object modules from the 
relocatable library instead of, or in 
addition to, those modules from the 
card reader, tape \init, or disk extent 
assigned to SYSIPT. This is accom- 
plished by specifying the name of the 
module to be included in the operand 
of an INCLUDE statement. After the 
object modules have been edited and 
placed in the core image librairy, the 
program is executed. The blank 
operand in the EXEC control statement 
indicates that the program that has 
just been linkage edited and 
temporarily stored in the core image 
library is to be executed. 

3. Compi le- and- Execute . Source modules 
can be compiled and then executed in a 
single sequence of job steps. In 
order to do this, the COBOL compiler 
is directed to write the object module 
directly on SYSLNK. This is done by 
using the LINK option in the OPTION 
control statement. Upon completion of 
this output operation, the linkage 



Preparing COBOL Programs for Processing 37 



@ CATALOG AS PERMANENT PROGRAM 




OPTION CATAL 

PHASE PROGA,* 

INCLUDE 

(object module} 

ENTRY 

EXEC LNKEDT 




Object 
Module 



SYSLNK 



EXEC FCOBOL 




OPTION LINK 

INCLUDE 

(object module) 

ENTRY 

EXEC LNKEDT 

EXEC 



© COMPILE AND EXECUTE 




OPTION LINK 

EXEC FCOBOL 

ENTRY 

EXEC LNKEDT 

EXEC 



Figure 5. Job Definition — Use of the Librarian 



editor function is performed. The 
program is linkage edited and tem- 
porarily stored in the core image 
library. The sequence of this 
operation is shown in Part (§) of Figure 
5« 



Control Statement Placement 



1. A single ENTRY statement should follow 
the last object module when multiple 
object modules are processed in a 
single linkage editor run. 

ACTION and ENTRY statements, when 
present, must be on SYSRDR. PHASE and 
INCLUDE statements may be present on 
SYSRDR, SYSIPT, or in the relocatable 
library. 



The placement of linkage editor control 
statements is subject to the following 
rules: 

1. The ACTION statement must be the first 
linkage editor control statement 
encountered in the input stream; 
otherwise, it is ignored. 

2. The PHASE statement must precede each 
object module that is to begin a 
phase. 

3. The INCLUDE statement must be 
specified for each object module that 
is to be included in a program phase. 



PHASE Statement 



The PHASE statement must be specified if 
the output of the Linkage Editor is to 
consist of more than one phase or if the 
program phase is to be cataloged in the 
core image library. Each object module 
that begins a phase must be preceded by a 
PHASE statement. Any object module not 
preceded by a PHASE statement will be 
included in the current phase. 

The statement provides the Linkage 
Editor with a phase neime and an origin 
point for the phase. The PHASE statement 
is in the following format: 



\ 



38 



PHASE name, origin [,NOADTO] 



^y 



name 



o 



is the symbolic name of the phase. It 
is the name under which the program 
phase is to be cataloged. This name 
does not have to be the name specified 
in the PROGRAM-'ID paragraph in the 
Identification Division of the source 
program eind, in the case of overlay 
and sort, it should not be the same. 
It must consist of from one to eight 
alphanumeric characters. Phases that 
are to be executed in an overlay 
structure should have phase names of 
from five to eight alphanumeric 
characters, the first four of which 
should be the same. An asterisk 
cannot be used as the first character 
of a phase name. 

origin 

indicates to the Linkage Editor the 
starting address of this specific 
phase. An asterisk may be used as an 
origin specification to indicate that 
this phase is to follow the previous 
phase. This origin specification 
format of the PHASE statement covers 
all applications that do not include 
setting up overlay structures. See 
the chapter "Calling and Called 
Programs" for information on the PHASE 
statement for overlay applications. 

NOADTO 

indicates that the Automatic Library 
Look-Up (AUTOLINK) feature is 
suppressed for both the private 
relocatable library and the system 
relocatable library. (The use of 
NOAUTO causes the AUTOLINK process to 
be suppressed for that phase only. ) 
The ADTOLINK feature is discussed 
later in this chapter. 



operand is used, a comma must precede the 
second operand, 

module-name 

must be specified when the object 
module is in the relocatable library- 
It is not specified when the module to 
be included is in the form of a card 
deck being entered from SYSIPT. 
module-name is the name under which 
the module was cataloged in the 
library, and must consist of from one 
to eight alphaniimeric characters. 

(namelist) 

causes the Linkage Editor to construct 
a phase from the control sections 
specified in the list. Since control 
sections are of no interest to the 
COBOL pi:ogrammer, users interested in 
this option should refer to the 
description of the INCLUDE statement 
in the publication IBM Svstem/360 Disk 
Operating System; System Control and 
System Service Programs . 



ENTRY Statement 



The ENTRY statement is required only if 
the user wishes to provide a specific entry 
point in the first phase produced by the 
Linkage Editor. When no ENTRY statement is 
provided, the Job Control Processor writes 
an ENTRY statement with a blank operand on 
SYSLNK to ensure that an ENTRY statement 
will be present to halt linkage editing. 
The transfer address will be the load 
address of the first phase. The ENTRY 
statement is described further in the 
publication IBM Svstem/360 Disk Operating 
System; System Control and System Service 
Programs . 



INCLUDE Statement 



ACTION Statement 



The INCLUDE statement must be specified 
for each object module deck or object 
module in the relocatable library that is 
to be included in a program phase. The 
format of the INCLUDE statement is as 
follows ; 



The ACTION statement is used to indicate 
linkage editor options. When used, the 
statement must be the first linkage editor 
statement in the input stream. The format 
of the ACTION statement is as follows; 



INCLUDE [module-name] [, (namelist)] j 



The INCLUDE statement has two optional 
operands. When both operands are used, 
they must be in the prescribed order. When 
the first operand is omitted and the second 



CLEAR 
MAP 
NOMAP 
ACTION < NOAUTO 
CANCEL 
Fl 
,F2 



Preparing COBOL Programs for Processing 39 



CLEAR 



MAP 



indicates that the entire tanporary 
portion of the core image library will 
be set to binary zero before the 
beginning of the linkage editor 
fiinction. CLEAR is a time-consiaming 
function and should be used only when 
necessary. 



indicates that SYSLST is available for 
diagnostic messages. In addition, a 
main storage map is output on SYSLST. 



These diagnostic messages can be found 
in the publication IBM Svstem/360 Disk 
Operating System: System Control and 
System Service Programs . 

Fl and F2 

are options used in conjunction with 
programs executed in the foreground 
area. See the publication IBM 
System/360 Disk Operating System; 
System Control and System Service 
Programs . 



NOMAP 

indicates that SYSLST is unavailable 
when performing the linkage-edit 
function. The mapping of main storage 
is not performed, and all linkage 
editor diagnostic messages are listed 
on the printer- key board (SYSLOG). 

NOAUTO 

suppresses the ADTOLINK function for 
both the private and system 
relocatable libraries during the 
linkage editing of the entire program. 
AUTOLINK is discussed later in this 
chapter. 

CANCEL 

causes an automatic cancellation of 
the job if any of the linkage editor 
errors 21001 through 21701 occur./ 



ADTOLINK FEATURE 



If any references to external-names are 
still unresolved after all modules have 
been read from SYSLNK, SYSIPT, and/or the 
relocatable library, AUTOLINK collects each 
unresolved external reference from the 
phase. It then searches the private 
relocatable library (if SYSRLB has been 
assigned) and the system relocatable 
library for module names identical to the 
tmresolved names and includes these modules 
in the program phase. This feature should 
not be suppressed (via PHASE or ACTION 
statements) in linkage editor job steps 
which include COBOL subroutines' cataloged 
in the relocatable library. See the 
chapter "Calling and Called Programs" for 
additional details. 



40 



r 



LIBRARIAN FUNCTIONS 



c 



The system residence device (SYSRES) for 
the Disk Operating System can contain three 
libraries: the core image library, the 
relocatable library, and the source 
statement library. Executable programs 
(core image format) are stored in the core 
image library; relocatable object modules 
are stored in the relocatable library; and 
source language routines are stored in the 
source statement library. 

The core image library is required for 
each disk resident system. The relocatable 
library and the source statement library 
are not required. 

In addition to the three system 
libraries located on SYSRES, the user may 
also request creation of private source 
statement and relocatable libraries. These 
libraries are discussed under "Private 
Libraries" in this chapter. 



LIBRARIAN 



The Librarian is a group of programs 
that perform three major functions: 



1. Maintenance 



CORE IMAGE LIBRARY 



The core image library may contain any 
number of programs. Each program consists 
of one or more separate phases. Associated 
with the core image library is a core image 
directory which contains a unique 
descriptive entry for each phase in the 
core image library. These entries in the 
core image directory are used to locate and 
retrieve phases from the core image 
library. 



Cataloging and Retieving Program Phases — 
Core Image Library 



If a program is to be cataloged in the 
core image library, the job control 
statement // OPTION with the CATAL option 
must be specified prior to the first 
linkage editor control card, and must 
precede the first PHASE card of the program 
to be cataloged. Upon successful 
completion of the linkage editor job step, 
output from the linkage editor is placed in 
the core image library as a permanent 
member. The program phase is cataloged 
under the name specified in the PHASE 
statement. 



2. Service 

3. Copy 

Maintenance functions are used to 
catalog (that is, add) , delete, or rename 
components of the three libraries, condense 
libraries and directories, set a condense 
limit for an automatic condense function, 
reallocate directory and library extents, 
eind update the source statement library. 

The copy function is used either to 
completely or selectively copy the disk on 
which the system resides. Service 
functions are used to translate information 
from a particular library to printed 
(displayed) or punched output. 

Only the catalog maintenance function of 
the Librarian is discussed in this 
publication for the three system libraries. 
In addition, the update function of the 
source statement library is discussed. A 
complete description of librarian functions 
can be found in the publication IBM 
System/360 Disk Operating System: System 
Control and System Service Programs . 



If a phas6 in the core image library is 
to be replaced by a new phase having the 
same name, only the catalog function need 
be used. The previously cataloged phase of 
the same name is implicitly deleted from 
the core image directory by the catalog 
function, and the space it occupies in the 
library can later be released by the 
condense function. 



Note : The necessary ASSGN control 
statements must follow the // JOB control 
statement if the current assignments are 
not the following: 

1. SYSRDR — Card reader, tape unit, or 

disk extent 

2. SYSIPT — Card reader, tape tanit, or 

disk extent 

3. SYSLST ' — Printer, tape unit, or disk 

extent 

4. SYSLOG — Printer keyboard 

5. SYSLNK -- Disk extent 



Librarian Functions 41 



The following is an example of 
cataloging a single phase, FODRA, into the 
core image library. (The program phase 
FOURA can be executed in the next job step 
by specifying the // EXEC statement with a 
blank name field. ) 



MAINTENANCE FUNCTIONS 



To request a maintenance function for 
the relocatable library, the following 
control statement is used: 



// JOB CATALOG 
// OPTION CATAL 

PHASE FOURA,* 

INCLUDE 

{object deck} 
/* 

// LBLTYP TAPE 
// EXEC LNKEDT 
// EXEC 
/& 



To compile, linkage edit, and catalog 
the phase FOURA into the core image library 
in the same job, the following job deck 
could be used: 

// JOB CATALOG 
// OPTION CATAL 

PHASE FOURA,* 
// EXEC FCOBOL 

{source deck} 
/♦ 

// EXEC LNKEDT 
/* 
/% 

When the phase is executed in a 
subsequent job, the EXEC statement that 
calls for execution must specify FOURi^, 
i.e., the name by which the phase has been 
cataloged. 

// JOB EXJOB 
// EXEC FOURA 
/g 



RELOCATABLE LIBRARY 



The relocatable librairy contains any 
ntimber of modules. Each module is a 
complete object deck in relocatable foinnat. 
The purpose of the relocatable library is 
to allow the user to maintain frequently 
used routines in residence and combine them 
with other modules without recompiling. 

Associated with the relocatable library 
is the relocatable directory. The 
directory contains a unique, descriptive 
entry for each module in the relocatable 
library. The entries in the relocatable 
directory are used to locate and retrieve 
modules in the relocatable librairy. 



// EXEC MAINT 



Cataloging a Module — Relocatable Library 



The catalog function adds a module to 
the relocatable library. A module in the 
relocatable library is the output of a 
complete COBOL compilation. 

The catalog function implies a delete 
function. Thus, if a module exists in the 
relocatable library with the same name as a 
module to be cataloged, the module in the 
library is deleted by deleting reference to 
it in the relocatable directory. 

The CATALR control statement is required 
to add a module to the relocatable library. 
The format of the CATALR control statement 
is: 



CATALR module-name [,v.m] 



module-name 

is the name by which the module is 
known to the control program. The 
module-name consists of from one to 
eight characters , the first of which 



/^""■^ 



must not be an asterisk. 



v.m 



specifies the change level at which 
the module is to be cataloged, v may 
be any decimal n\imber from through 
127. m may be any decimal number from 
through 255. If this operand is 
omitted, a change level of 0.0 is 
assxuned. A change level can be 
assigned only when a module is 
cataloged. 

All control statements required to 
catalog an object module must be read from 
SYSIPT. For the catalog function, device 
assignments must be as follows: 

1. SYSRDR -- Card reader, tape unit, or 

disk extent 

2. SYSIPT — Card reader, tape unit, or 

disk extent 

3. SYSLST *- Printer, tape unit, or disk 

extent 

4. SYSLOG -5- Printer keyboard 



^w^' 



42 



Note : If SYSRDR and/or SYSIPT are assigned 
to a tape unit, the MAINT program assiames 
that the tape is positioned to the first 
input record. The tape is not rewound at 
the end of the job. 



The following is an example of compiling 
a soiirce program and cataloging the 
resultant module in the relocatable 
library. The job deck is read from SYSIPT, 

// JOB NINE 
// OPTION DECK 
// EXEC FCOBOL 

{source deck} 
/* 

// PAUSE PLACE DECK AFTER CATALR CARD 
// EXEC MAINT 
CATALR MOD 9 



/♦ 
/g 



(punched deck goes here) 






In the above example, as a result of the 
compile step, the object module is written 
on SYSPCH. The next job step catalogs the 
object module (M0D9) into the relocatable 
library. Since the object module must be 
cataloged from SYSIPT, a message to the 
operator instructs him to place the object 
module on SYSIPT behind the CATALR 
statement. 



Each book in the source statement 
library is classified as belonging to a 
specific sublibrary. Sublibraries are 
defined for two programming languages : 
Assembler and COBOL. Individual books are 
classified by sublibrary names. Therefore, 
books written in each of these languages 
may have the same name. 

Associated with the source statement 
library is a source statement directory. 
The directory contains a unique descriptive 
entry for each book in the source statement 
library. The entries in the source 
statement directory are used to locate and 
retrieve books in the source statement 
library. 



MAINTENANCE FUNCTIONS 



To request a maintenance function for 
the source statement library, the following 
control statement must be used: 

// EXEC MAINT 



Cataloging a Book — Source Statement 



Library 



The following is an example of 
cataloging two previously created object 
modules in the relocatable librairy: 

// JOB EIGHT 
// EXEC MAINT 
CATALR MOD 8 A 

{object deck} 
CATALR M0D8B 

{object deck} 
/* 
/6 



The CATALS control statement is required 
to add a book to a sublibrary of the source 
statement library. 

A book added to a sublibrary of the 
source statement library is removed by 
using the delete function. When a book 
exists in a sublibrary with the same name 
as a book to be cataloged in that 
sublibrary, the existing book in the 
sublibrary is deleted. The following is 
the format of the CATALS control statement: 



i CATALS sublib. library- name [,v,m[,C]] 



c 



SOURCE STATEMENT LIBRARY 



The source statement library contains 
any number of books. Each book in the 
sotirce statement library is composed of a 
sequence of source language statements. 
The purpose of the source statement library 
is to allow the COBOL programmer to 
initiate the compilation of a book into the 
source program by using the COPY statement 
or BASIS card. 



The operation field contains CATALS. 

siablib 

represents the sublibrary to which a 
book is to be cataloged and can be: 

Any alphanumeric character (0-9, A-Z, 
#, $, and a) representing source 
statement libraries. The characters A 
and C have special uses: 

A is used for the Assembler s\iblibrary 

C is used for the COBOL sublibrary 



Librarian Functions 43 



The siiblib qualifier is required. If 
omitted, the operand will be flagged as 
invalid and no processing will be done on 
the book. 



library- name 

represents the name of the book to be 
cataloged. The 1 ibrary-name consists 
of from one to eight alphanxmieric 
characters, the first of which must be 
alphabetic. It is the name the 
programmer uses to retrieve the book 
when using the source language COPY 
statement or BASIS card. 



v.m 



specifies the change level at which 
the book is to be cataloged, v may be 
any decimal niamber from through 127; 
m may be any decimal number from 
through 255. If this operand is 
omitted, a change level of 0. is 
assumed. The v.m operand becomes part 
of the entry in the directory for the 
specified book. Its value is 
incremented each time an update is 
performed on the book. 



count 

specifies the number of card images in 
the book. When the count operand is 
used, the card input is counted, 
beginning with the preceding BKEND 
statement and including the subsequent 
BKEND statement. If an error is 
detected in the card count, an error 
message is printed. The error can be 
corrected, and the book can be 
recataloged. 

CMPRSD 

indicates that the book is to be 
cataloged in the library in compressed 
format. 

Card input for the catalog function is 
from the device assigned to SYSIPT. The 
CATALS control statement is also read from 
the device assigned to SYSIPT. For the 
catalog function, device assignments must 
be as follows: 

1. SYSRDR — Card reader, tape unit, or , 

disk extent ' 

2. SYSIPT — Card reader, tape iinit, or 

disk extent 



indicates that change level 
verification is required before 
updates are , accepted for this book. 

See the UPDATE control statement, 
discussed later in this chapter, for its 
relationship to the v.m and C operands of 
the CATALS control statement. 

In addition to the CATALS control 
statement, a control statement of the 
following form must precede and follow the 
book to be cataloged: 



BKEND (sublib. library-name], [SEQNCE] , 
[count], [CMPRSD] 



1 



All operand entries are optional. When 
used, the entries must be in the prescribed 
order and need appear only in the BKEND 
statement preceding the book to be 
cataloged. 

The first entry in the operand field is 
identical to the operand of the CATALS 
control statement. 

SEQNCE 

specifies that columns 76 to 80 of the 
card images constituting the book are 
to be checked for ascending sequence 
numbers. If an error is detected in 
the sequence checking, an error 
message is printed. The error can be 
corrected, and the book can be 
recataloged. 



3. SYSLST -^- Printer, tape unit, or disk 

extent 

4. SYSLOG — Printer keyboard 

Frequently used Environment Division, 
Data Division^ and Procedure Division 
entries can be cataloged in the COBOL 
sublibrary of the source statement library. 
A book in the source statement library 
might consist, for example, of a file 
description of the Data Division or a 
paragraph of the Procedure Division. 

The following is an example of 
cataloging a file description in the COBOL 
sublibrary of the source statement library. 

// JOB ANYNAME 
// EXEC MAINT 

CATALS C.FILEA 
BKEND C.FILEA 

BLOCK CONTAINS 13 RECORDS 
RECORD CONTAINS 120 CHARACTERS 
LABEL RECORDS ARE STANDARD 
DATA RECORD IS RECA. 
BKEND 
/* 
/g 



Retrieving a Cataloged Book — COBOL COPY 
Statement : The preceding file description 
can be included in a COBOL source program 
by writing the following statement: 

FD FILEB COPY FILEA. 



V. -' 



nn 



Note that the library entry does not 
include FD or the file-name. It begins 
with the first clause that is actually to 
follow the file-name. This is true for all 
options of the COPY statement. However, 
data entries in the library may have a 
level number (01 or 77) identical to the 
level number of the data-name that precedes 
the COPY statement. In this case, all 
information about the library data-name is 
copied from the library and all references 
to the library data-name are replaced by 
the data-name in the program if the 
REPLACING option is specified. For 
example, assume the following data entry is 
cataloged under the library-name DATAR, 

01 PAYFILE USAGE IS DISPLAY. 
02 CALC PICTURE 99. 
2 GRADE PICTURE 9 

OCCURS 1 DEPENDING ON CALC OF 

PAYFILE. 

and the following statement is written in a 
COBOL source module: 



One or more source statements may be 
added to, deleted from, or replaced in a 
book in the library without the necessity 
of replacing the entire book. The update 
function also provides these facilities : 



1. Resequencing statements within a book 
in the source statement library 

2. Changing the change level (v.m) of the 
book 

3. Adding or removing the change level 
requirement 

4. Copying a book with optional retention 
of the old book with a new name (for 
backup purposes) 



The UPDATE control statement is used for 
the update function and has the following 
format: 



01 



GROSS COPY DATAR REPLACING PAYFILE 
BY GROSS. 



The compiler interprets this as: 

01 GROSS USAGE IS DISPLAY. 
02 CALC PICTURE 99. 
/-- s, 02 GRADE PICTURE 9 

A OCCURS 1 DEPENDING ON CALC OF 

'"^-^' GROSS. 

Note also that the library-name is used 
to identify the book in the library. It 
has no other use in the COBOL program. 

Text cataloged in the source statement 
library must conform to COBOL margin 
restrictions • 

The COBOL COPY statement is discussed in 
detail in the section "Extended Soiirce 
Program Library Facility. " 



UPDATE sublib. library-name, ts.bookl], | 

[v.m], [nn] | 

* J 



The operation field contains UPDATE. 

s\iblib 

represents the sublibrary that 
contains the book to be updated. It 
may be any of the characters through 
9, A through Z, #, $, or a. 

s.bookl 

provides a temporary update option. 
The old book is renamed s.bookl and 
the updated book is named 
sublib. library-name . s indicates the 
sublibrary that contains the old, 
renamed book. It may be one of the 
characters through 9, A through Z, 
#, $, or a. If this operand is not 
specified, the old book is deleted. 



v.m 



'^, 



Updating Books — Source Statement Library 



The update f\inction is used to make 
changes to properly identified statements 
within a book in the source statement 
library. Statements are identified in the 
identification field, columns 73 through 
80, which is fixed in format as follows: 



Columns 73-76 



Columns 77-80 



Program identification 
which must be constant 
throughout the book. 

Sequence ntimber of the 
statement within the 
book. 



represents the change level of the 
book to be updated, v may be any 
decimal number from through 127; m 
may be any decimal number from 
through 255. This operand must be 
present if change level verification 
is to be performed. Use of the 
optional entry C in the CATALS control 
statement at the time the book is 
cataloged in the library determines 
whether change level verification is 
required before updating. If the 
directory entry specifies that change 
level verification is not required 
before updating, the change level 
operand in the UPDATE control 
statement is ignored. 



Librarian Functions U5 



nn 



If the change level is verified, the 
change level in the book's directory 
entry is increased by 1 by the system 
for verification of the next update. 
If m is at its maximum value and an 
update is processed, m is reset to 
and the value of v is increased by 1. 
If both V and m are at their maximum 
values and an update is processed, 
both V and m are reset to 0. 



represents the resequencing status 
required for the update, nn may be a 
1- or 2-character decimal number from 
1 through 10, or it may be the word 
NO. If nn is a decimal number, it 
represents the increment that will be 
used in resequencing the statements in 
the book. If nn is NO, the statements 
will not be resequenced. If nn is not 
specified, the statements will be 
resequenced with an increment of 1. 
When a book is resequenced, the 
sequence number of thefirst statement 
is 0000. For example, if a book is 
cataloged in the sotirce statement 
library with sequence numbers ranging 
from 0010 through 1000 with increments 
of 5 for each statement: 

and nn is not specified when the 
update function is performed, the book 
is resequenced with niambers 0000, 
0001, 0002, ... etc. 

and NO is specified, insertions, 
deletions, and/or replacements are 
made with no effect on the original 
sequence numbers. 

and nn is specified as 2, the book is 
resequenced with numbers 0000, 0002, 
0004, ... etc., regardless of the 
original sequencing of the book in the 
library or the sequence numbers of the 
added or replacement cards. 

The UPDATE control statement is followed 
by ADD, DEL (delete), and/or REP (replace) 
control statements as required, followed by 
the terminating END statement. The ADD, 
DEL, REP, and END statements are identified 
as update control statements by a right 
parenthesis in the first position (column 1 
in card format) . This is a variation from 
the general librarian control statement 
format; thus, it clearly identifies these 
control statements as part of the update 
function. 

ADD Statement ; The ADD statement is used 
for the addition of source statements to a 
book. The format is: 



I ) ADD seq-no | 



ADD indicates that source statements 
following this statement are to be added to 
the book. 



seq-no 

represents the sequence niamber of the 
statement in the book after which the 
new statements are to be added. It 
may be any decimal nximber consisting 
of from one to four characters. 



DEL Statement : The DEL statement causes 
the deletion of source statements from the 
book. The format is: 



j ) DEL first-seq-no[,last-seq-no] 



DEL indicates that statements are to be 
deleted from the book. 

first-seq-no 

last-seq-no 

represent the sequence niimbers of the 
first and last statements of a section 
to be deleted. Each number may be a 
decimal number consisting of from one 
to four characters. If last-seq-no is 
not specified, the statement 
represented by first-seq-no is the 
only statement deleted. 



REP Statement : The REP statement is used 
when replacement of source statements is 
required in a book. The format is: 



I ) REP first-seq-no[, last-seq-no] 



REP indicates that source statements 
following this statement are to replace 
existing statements in a book. 

first-seq-no 

last-seq-no 

represent the sequence numbers of the 
first and last statements of a section 
to be replaced. Each number may be a 
decimal number consisting of from one 
to four characters. Any number of new 
statements can be added to a book when 
a section is replaced. (The number of 
statements added need not eqiial the 
n\jmber of statements being replaced. ) 

Sequence number 9999 is the highest 
niimber acceptable for a statement to be 
updated. If the book is so large that 
statement sequence nximbers have "wrapped 
around" (progressed from 9998, 9999, to 
0000,0001), it will not be possible to 
"update statements 0000 and 0001. 



r 



V, 



46 



END Statement : This statement indicates 
the end of updates for a given book. The 
format is: 



I ) END [v.m[,C]] 

L 



v.m 



represents the change level to be 
assigned to the book after it is 
updated; v may be any decimal number 
from through 127. m may be any 
decimal number from through 255. 
This operand provides an additional 
means of specifying the change level 
of a book in the library. (The other 
method is through the use of the v.m 
operand in the CATALS statement. ) 



indicates that change level 
verification is required before any 
subsequent updates for a given book. 

If v.m is specified and C is omitted, 
the book does not require change level 
verification before a subsequent update. 
This feature removes a previously specified 
verification requirement for a particular 
book. 

If both optional operands are omitted, 
the change level in the book's directory 
entry is increased as a result of the 
update, and the verification requirement 
remains unchanged. 



Logical Unit Assignment and Control 
Statement Placement: 



For the update function, SYSIN must be 
assigned to a card reader, a tape unit, or 
a disk unit. SYSLST must be assigned to a 
printer, a tape unit, or a disk extent; 
SYSLOG must be assigned to the printer 
keyboard. 

Control statement input for the update 
function, read from the device assigned to 
SYSIN, must be in the following order: 

1. The JOB control statement. 

2. The ASSGN control statements, if the 
current assignments are not those 
required. The ASSGN control 
statements that can be used are SYSIN, 
SYSLST, and SYSLOG. 

3. The EXEC MAINT control statement. 

4. The UPDATE control statement. 



5. ) ADD, ) DEL, or ) REP statements with 
appropriate source statements. 

6. ) END statement. 

7. The /♦ control statement. 

8. The /g control statement, which is the 
last control statement of the job. 

The source statement library can also be 
updated by using the DELETE and INSERT 
cards. These are discussed in "Extended 
Source Program Library Facility" in this 
chapter, and in the publication IBM 
Svstem/360 Disk Operating System: American 
National standard COBOL. 



UPDATE Function — Invalid Operand Defaults 



UPDATE Statement : 

1. If the first or second operand is 
invalid, the statement is flagged, the 
book is not updated, and the remaining 
control statements are checked to 
determine their validity. 

2. If change level verification is 
required and the incorrect change 
level is specified, the statement is 
flagged, the book is not updated, and 
the remaining control statements are 
checked to determine their validity. 

3. If the re sequencing operand is 
invalid, resequencing is done in 
increments of 1. 

ADD, DEL, or REP Statements : 

1. If there is an invalid operation or 
operand in an ADD, DEL, or REP 
statement, the statement is flagged, 
the book is not updated, and the 
remaining control statements are 
checked to determine their validity. 
All options of the UPDATE and END 
statements are ignored. 

2. The second operand must be greater 
than the first operand in a DEL or REP 
statement. If not, the statement is 
considered invalid and is flagged, the 
book is not updated, and the remaining 
control statements are checked to 
determine their validity. All options 
of the UPDATE and END statements are 
ignored. 

3. All updates to a book between an 
UPDATE statement and an END statement 
must be in ascending sequential order 
of statement sequence numbers. The 



Librarian Functions 47 



first operand of a DEL or REP 
statement must be greater than the 
last operand of the preceding control 
statement. The operand of an ADD 
statement must be equal to or greater 
than the last operand of the preceding 
control statement. Consecutive ADD 
statements must not have the saime 
operand. If these conditions are not 
met, the default is the same as for 
items 1 and 2. 

END Statement ; If the first operand of the 
END statement is invalid, the statement is 
flagged, both operands are ignored, and the 
book is updated as though no operands were 
specified. If the second operand is 
invalid, the statement is flagged, the 
operand is ignored, and the book is updated 
as though the second operand were not 
specified- 

Out-of-Sequence Updates ; If the source 
statements to be added to a book are not in 
sequence or do not contain sequence 
numbers, the book is updated, and a message 
indicating the error appears following the 
END statement. . If the resequencing option 
has been specified in the UPDATE statement, 
the book is sequenced by the specified 
value, and subsequent updating is possible. 
If the resequencing option is not 
specified, the book is resequenced in 
increments of 1, and subsequent updating 
will be possible. If the resequencing 
option NO is specified, the book will be 
out of sequence, and subsequent updating 
may not be possible. 



PRIVATE LIBRARIES 



4. Private libraries cannot be 
reallocated. 

5. The COPY fianction is not effective for 
private libraries except when they are 
being created. 

An unlimited n\imber of private libraries 
is possible. However, each must be 
distinguished by a \inique file 
identification in the DLBL statement for 
the library. No more than one private 
relocatable library and one private source 
statement library may be assigned in a 
given job. 

The creation and maintenance of private 
libraries is discussed in the publication 
IBM Svstem/360 Disk Operating System; 
System Control and System Service Programs . 



SOURCE LANGUAGE CONSIDERATIONS 



To use the private source statement 
library for COPY, BASIS, INSERT, and DELETE 
(see "Extended Source Program Library 
Facility" for further details) , the ASSGN, 
DLBL, and EXTENT control statements that 
define this private library must be present 
in the job deck for compilation. When 
present, a search for the book is made in 
the private library. If it is not there, 
the system library is searched. If the 
statements for the private library are not 
present, the system library is searched. A 
programmer may create several private 
libraries, but only one private library can 
be used in a given job. 



Private libraries are desirable in the 
system to permit some libraries to be 
located on a disk pack other than the one 
used by SYSRES. 

Private libraries are supported for the 
relocatable library and for the source 
statement library on both the 2311 and 2314 
mass storage devices. However, the 
following restrictions apply; 

1. The private library must be on the 
same type of disk device as SYSRES. 

2. Reference may be made to a private 
relocatable library only if SYSRLB is 
assigned. If SYSRLB is assigned, the 
system relocatable library cannot be 
changed. 

3. Reference may be made to a private 
source statement library only if 
SYSSLB is assigned. If SYSSLB is 
assigned, the system source statement 
libraiT^ cannot be changed. 



EXTENDED SOURCE PROGRAM LIBRARY FACILITY 



A complete program may be included as an 
entry in the source statement library by 
using the catalog fiinction. This program 
can then be retrieved by a BASIS card and 
compiled in a subsequent job. 

The following control statements would 
be used to catalog the program SAMPLE as a 
book in the COBOL sublibrary of the source 
statement library: 

// JOB CATALOG 
// EXEC MAINT 

CATALS C. SAMPLE 

BKEND C. SAMPLE 

{source program} 

BKEND 
/♦ 
/g 



(^ "N 



48 



When compiling a progrcun that has been 
cataloged in the COBOL siablibrary of the 
source statement library, a BASIS card 
brings in an entire sotirce program. The 
following control statements could be used 
to compile the cataloged program SAMPLE: 

// JOB PGMl 

// OPTION LOG, DECK, LIST, LI STX, ERRS 

// EXEC FCOBOL 

BASIS SAMPLE 

/♦ 

/& 

INSERT or DELETE cards may follow the 
BASIS card if the user wishes to modify the 
book SAMPLE before it is processed by the 
compiler. The original so\irce program must 
have been coded with sequence n\imbers in 
columns 1 through 6 of each source card. 

The INSERT statement will add new source 
statements after the specified sequence 
numbers. The DELETE statement will delete 
the statements indicated by the sequence 
numbers, or will delete more than one 
statement when the first and last sequence 
nximbers to be deleted are specified, 
separated by a hyphen. Source prograim 
cards may follow a DELETE card for 
insertion before the card following the 



last one deleted. The sequence ntambers in 
columns 1 through 6 are used to update 
COBOL source statements at compilation 
time, and are in effect for the one run 
only. 



Assume that a company runs its payroll 
program each week as a source program taken 
from the source statement librairy. The 
name of the program is PAYROLL. During the 
year, social security tax (FICA) is 
deducted at the rate of 4-2/5% each week 
for all personnel until earnings exceed 
$7800. The coding to accomplish this is 
shown in Figure 6. 

At the beginning of the year, the test 
for earnings over $7800 is taken out of the 
program until a more appropriate time later 
in the year. In addition, at the beginning 
of the year, a union contract dictates that 
all draftsmen receive a 5% pay increase. 
Assume that records for all personnel 
contain an occupation code. The code 
identifying draftsmen is DR. The 
programmer can program these changes as 
shown in Figure 7. 

The altered program will contain the 
coding shown in Figure 8. 



1000730 
1000735 
I0007U0 
1000745 
1000750 
1000755 



1000850 



FICA-PAYR. 



PAY-WRITE. 



IF ANNUAL-PAY GREATER THAN 7800 GO TO PAY- WRITE. 

IF ANNUAL-PAY GREATER THAN 7800 - BASE-PAY GO TO LAST-FICA. 

COMPUTE FICA-PAY = BASE-PAY * .044 

MOVE FICA-PAY TO OUTPUT-FICA. 

MOVE BASE-PAY TO OUTPUT-BASE. 

ADD BASE-PAY TO ANNUAL-PAY. 



STOP RUN. 






Figure 6. Sample Coding to Calculate FICA 



\// JOB PGM2 

|// OPTION LOG, DECK, LIST, LISTX, ERRS 

|// EXEC FCOBOL 

I CBL QUOTE 

I BASIS PAYROLL 

IDELETE 000730, 000735 

I IF OCCUPATION-CODE = "DR" PERFORM PAY- INCREASE THRU EXl. 

j INSERT 000850 

I PAY-INCREASE. MULTIPLY 1.05 BY BASE-PAY. 

I EXl. EXIT. 

[/6 



Figure 7. Altering a Program from the Soijrce Statement Library Using INSERT and DELETE 
Cards 



Librarian Functions 49 



j IF OCCUPATION-CODE = "DR" PERFORM PAY-INCREASE THRU EXl. 

1 000740 FICA-PAYR. COMPUTE FICA-PAY = BASE-PAY * .044 

1000745 MOVE FICA-PAY TO OUTPUT-FICA. 

1000750 PAY-WRITE. MOVE BASE-PAY TO OUTPUT-BASE. 

1000755 ADD BASE-PAY TO ANNUAL-PAY. 

|. 

|. 

I- 

1000850 STOP RUN. 

I PAY-INCREASE. MULTIPLY 1.05 BY BASE- PAY. 

I EXl. EXIT. 



V.,., 



Figure 8. Effect of INSERT and DELETE Cards 



^^\ 
^-^ 



50 



PROGEAM CHECKOUT 



A programmer using the American National 
Standard COBOL compiler under the IBM 
System/360 Disk Operating System has 
several methods available to him for 
testing, debugging, and revising his 
programs for increased operating 
efficiency. 

The COBOL debugging language can be used 
by itself or in conjunction with other 
COBOL statements. A dump can also be used 
for program checkout. 



To reduce the length of the list and the 
time taken to generate it, a trace can be 
stopped with a RESET TRACE statement. The 
READY TRACE/RESET TRACE combination is 
helpfiil in examining a particular area of 
the program where the flow of control is 
difficult to determine, e.g., code consists 
of a series of PERFORM statements or nested 
conditional statements. The READY TRACE 
statement can be coded so that the trace 
begins before control passes to that area. 
The RESET TRACE statement can be coded so 
that the trace stops when the program has 
passed beyond the area. 



DEBUG LANGUAGE 



The COBOL debugging language is designed 
to assist the COBOL programmer in producing 
an error-free. program in the shortest 
possible time. The following sections 
discuss the use of the debug language and 
other methods of program checkout. 

The three debug language statements are 
TRACE, EXHIBIT, and ON. Any one of these 
statements can be used as often as 
necessciry. They can be interspersed 
throughout a COBOL source program, or they 
can be contained in a packet in the input 
stream to the compiler. 

Program checkout may not be desired 
after testing is completed. A debug packet 
can be removed after testing to eliminate 
the extra object program coding generated 
for the debug statements. 

The output produced by the TRACE and 
EXHIBIT statements is listed on the system 
logical output device (SYSLST). 



Use of the ON statement with the TRACE 
statement allows conditional control of the 
tracing. When the COBOL compiler 
encounters an ON statement, it creates a 
counter which is incremented during 
execution, whenever control passes through 
the ON statement. For example, if an error 
occurs when a specific record is processed, 
the ON statement can be used to isolate the 
problem record. The statement should be 
placed where control passes through it only 
once for each record that is read. When 
the contents of the counter equal the 
niimber of the record (as specified in the 
ON statement) , a trace can be taken on that 
record. The following example shows a 
method in which the 200th record could be 
selected for a TRACE statement. 



col. 

1 



Area A 
RD-REC. 



The following discussions describe 
methods of using the debug langtiage. 



DEBUG RD-REC 

PARA-NM-1, 



ON 200 READY TRACE. 
ON 201 RESET TRACE. 



FLOW OF CONTROL 



The READY TRACE statement causes the 
compiler-generated card niambers for each 
section-name and paragraph-name to be 
displayed. These card numbers are listed 
on SYSLST at execution time when control 
passes to these sections and paragraphs. 
Hence, the output of the READY TRACE 
statement appears as a list of card 
numbers. 



If the TRACE statement were used without 
the ON statement, every record would be 
traced. 

An example of a common program error is 
failing to break a loop or xinintentionally 
creating a loop in the program. If many 
iterations of the loop are required before 
it can be determined that a program error 
exists, the ON statement can be used to 
initiate a trace after the expected niamber 
of iterations has been completed. 



Program Checkout 51 



Note I If an error occurs in an ON 
statement, the diagnostic message may refer 
to the previous statement number. 



This coding will cause the values of the 
four fields to be listed for every tenth 
data record before net pay calculations are 
made. The output could appear as: 



r 



DISPLAYING DATA VALUES DURING EXECUTION 



RATE-PER-HOUR =4.00 HRSWKD =40.0 

OVERTIMEHRS =0.0 GROSS-PAY = 160.00 



A programmer can display the value of a 
data item during program execution by using 
the EXHIBIT statement. The EXHIBIT 
statement has three options: 



RATE-PER-HOUR =4.10 HRSWKD = 40-0 

OVERTIMEHRS =1.5 GROSS-PAY = 173.23 



1. EXHIBIT NAMED — Displays the names 

and values of the data-names listed in 
the statement. 



RATE-PER-HOUR = 3.35 HRSWKD = 40.0 

OVERTIMEHRS =0.0 GROSS-PAY = 134.00 



2. EXHIBIT CHANGED — Displays the vdlue 
of the data-names listed in the 
statement only if the value has 
changed since the last execution of 
the statement. 

3. EXHIBIT CHANGED NAMED — Displays the 
names and the values of the data-names 
only if the values have changed since 
the last execution of the statement. 

Data values can be used to check the 
accuracy of the program. For example, 
using EXHIBIT NAMED, the programmer can 
display specified fields from records, 
compute the calculations himself, and 
compare his calculations with the output 
from his program. The coding for a payroll 
problem might be; 



Col. 
1 



Note : Decimal points are included in this 
example for clarity, but actual printouts 
depend on the data description in the 
program. 



The preceding was an example of checking 
at regular intervals (every tenth record). 
A check of any unusual conditions can be 
made by using various combinations of COBOL 
statements in the debug packet. For 
example : 



IF OVERTIMEHRS GREATER THAN 2.0 
EXHIBIT NAMED PAYRCDHRS. . . 



.r\ 



Area A 



GROSS-PAY-CALC. 

COMPUTE GROSS-PAY = 
RATE-PER-HOUR * (HRSWKD 
+ 1.5 ♦ OVERTIMEHRS). 

NET-PAY-CALC. 



In connection with the previous example, 
this statement could cause the entire pay 
record to be displayed whenever an unusual 
condition (overtime exceeding two hours) is 
encountered. 



DEBUG NET-PAY-CALC 

SAMPLE- 1. ON 10 AND 

EVERY 10 EXHIBIT NAMED 
RATE-PER-HOUR, HRSWKD, 
OVERTIMEHRS, GROSS-PAY. 



52 



The EXHIBIT statement with the CHANGED 
option also can be used to monitor 
conditions that do not occur at regular 
intervals. The values of data-names are 
listed only if the value has changed since 
the last execution of the statement. For 
example, suppose the program calculates 
postage rates to various cities. The flow 
of the program might be: 



I READ INPUT I 
I DATA FOR |<- 
j CITY I 



— rg) 



The EXHIBIT statement with the CHANGED 
option in the program might be: 

EXHIBIT CH2USIGED STATE CITY RATE 

The output from the EXHIBIT statement 
with the CHANGED option could appear as: 

01 



02 



03 



01 


10 


02 


15 


03 




04 


10 


01 




02 


20 


03 


15 


OU 




01 


10 



I CALCULATE | 
I RATE FOR I 
I CITY I 



V 



EXHIBIT 
CHANGED 



/LAST^\ 

\ CITY / NO > (B) 



^^YES 



The first column contains the code for a 
state, the second coliimn contains the code 
for a city, and the third column contains 
the code for the postage rate. The value 
of a data-name is listed only if it has 
changed since the previous execution. For 
example, since the postage rate to city 02 
and city 03 in state 01 are the same, the 
rate is not printed for city 03. 

The EXHIBIT statement with the CHANGED 
NAMED option lists the data-name if the 
value has changed. For example, the 
program might calculate the cost of various 
methods of shipping to different cities. 
After the calculations are made, the 
following statement could appear in the 
program: 

EXHIBIT CHANGED NAMED STATE CITY RAIL 
BUS TRUCK AIR 

The output from this statement could appear 
as shown in Figure 9. Note that a 
data-name and its value are listed only if 
the value has changed since the previous 
execution. 



STATE = 01 CITY = 01 RAIL = 10 BUS =14 TRUCK =12 AIR =20 

CITY =02 

CITY = 03 BUS = 06 AIR =15 

CITY =04 RAIL = 30 BUS = 25 TRUCK = 28 AIR = 34 

STATE = 02 CITY = 01 TRUCK = 25 

CITY =02 TRUCK = 20 AIR =30 



Figtire 9. Sample Output of EXHIBIT Statement with the CHANGED NAMED Option 



Program Checkout 53 



TESTING A PROGRAM SELECTIVELY 



TESTING CHANGES AND ADDITIONS TO PROGRJ^S 



A debug packet allows the programmer to 
select a portion of the program for 
testing. The packet can include test data 
and can specify operations the programmer 
wants to be performed. When the testing is 
completed, the packet can be removed. The 
flow of control can be selectively altered 
by the inclusion of debug packets, as 
illustrated in the following example of 
selective testing of B: 



r 1 

I I 

I START I 






I A 

I 

L 



T" 
I 

1 

V 

1 r 1 

I I DEBUG I 

I PACKET I 

I I FOR A I 

J L y J 

V 



r 1 

I DEBUG I 
I PACKET I 
I FOR C I 
L ^ J 



If a program runs correctly, and changes 
or additions might improve its efficiency, 
a debug packet can be used to test changes 
without modifying the original source 
program. 



If the changes to be incorporated are in 
the middle of a paragraph, the entire 
paragraph with the changes included must be 
written in the debug packet. The last 
statement in the packet should be a GO TO 
statement that transfers control to the 
next procedure to be executed. 

There are usually several ways to 
perform an operation. Alternative methods 
can be tested by putting them in debug 
packets . 

The source program library facility can 
be used for program checkout by placing a 
source program in a library (see the 
chapter "Librarian Functions"). Changes or 
additions to the program can be tested by 
using the BASIS card and any number of 
INSERT and DELETE cards. Such changes or 
additions remain in effect only for the 
dinration of the run. 

A debug packet can also be used in 
conjunction with the BASIS card to debug a 
program or to test deletions or additions 
to it. The debug packet is inserted in the 
input stream immediately following the 
BASIS card and any INSERT or DELETE cards. 



DUMPS 




In this program, A creates data, B 
processes it, and C prints it. The debug 
packet for A simulates test data. It is 
first in the program to be executed. In 
the packet, the last statement is GO TO B, 
which permits A to be bypassed. After B is 
executed with the test data, control passes 
to the debug packet for c, which contains a 
GO TO statement that transfers control to 
the end of the program, bypassing C. 



If a serious error occurs during 
execution of the problem program, the job 
is abnoirmally terminated; any remaining 
steps are bypassed; and a program phase 
dump is generated. The programmer can use 
the dump for program checkout. (However, 
any pending transfers to an external device 
may not be completed. For example, if a 
READY TRACE statement is in effect when the 
job is abnormally tenninated, the last card 
nxjmber may not appear on the external 
device. ) In cases where a serious error 
occurs in other than the problem program 
(e.g.. Supervisor), a dxmp is not produced. 
Note that program phase dumps can be 
suppressed if the NODUMP option of the 
OPTION control statement has been specified 
for the job, or if NODUMP was specified at 
system generation time and is not 
overridden by the DUMP option for the 
current job. 



54 



HOW TO USE A DUMP 



When a job is abnormally terminated due 
to a serious error in the problem program, 
a message is written on SYSLST which 
indicates the: 



1. Type of interrupt (e.g., program 
check) 



2. Hexadecimal address of the instruction 
that caused the interrupt 



3. Condition code 



4. Reason for the interrupt (e.g., data 
exception) 



(^ The linkage editor map indicates that 
the program was loaded into address 
003000. This is determined by 
examining the load point of the 
control section TESTRUN. TESTRUN is 
the name assigned to the program 
module by the source coding: 

PROGRAM- ID. TESTRUN. 

(c) The specific instruction which caused 
the dump is located by subtracting the 
load address from the interrupt 
address (i.e., subtracting 3000 from 
373A) . The result, 73A, is the 
relative interrupt address and can be 
found in the object code listing. In 
this case the instruction in question 
is an AP (add decimal) . 

(d) The left-hand column of the object 
code listing gives the compiler- 
generated card number associated with 
the instruction. It is card 69. As 
seen in the source listing, card 69 
contains the COMPUTE statement. 



The instruction address can be compared 
to the Procedure Division map. The 
contents of LISTX provide a relative 
address for each statement. The load 
address of the module (which can be 
obtained from the map of main storage 
generated by the Linkage Editor) must be 
subtracted from the instruction address to 
obtain the relative instruction address as 
shown in the Procedtire Division map. If 
the interrupt occurred within the COBOL 
program, the programmer can use the error 
address and LISTX to locate the specific 
statement in the program which caused a 
dximp to be taken. Examination of the 
statement and the fields associated with it 
may produce information as to the specific 
nature of the error. 



Figure 10 is a sample dump which was 
caused by a data exception. Invalid data 
(i.e., data which did not correspond to its 
usage) was placed in the numeric field B as 
a result of redefinition. The following 
discussion illustrates the method of 
finding the specific statement in the 
program which caused the dump. Letters 
identifying the text correspond to letters 
in the program listing. 



@ The program interrupt occurred at HEX 
LOCATION 00373A. This is indicated in 
the SYSLST message printed just before 
the dump. 



Additional details about reading a dump 
are found in the chapter "Interpreting 
Output. " 



ERRORS THAT CAN CAUSE A DUMP 



A d\amp can be caused by one of many 
errors. Several of these errors may occur 
at the COBOL language level while others 
can occur at the job control level. 

The following are examples of COBOL 
language errors that can cause a diimp: 

1. A GO TO statement with no 
procedure-name following it may have 
been improperly initialized with an 
ALTER statement. The execution of 
this statement will cause an invalid 
branch. 

2. Arithmetic calculations or moves on 
numeric fields that have not been 
properly initialized. 

For example, neglecting to initialize 
the object of an OCCURS clause with 
the DEPENDING ON option, or 
referencing data fields prior to the 
first READ statement may cause a 
program interrupt and a dtjmp. 

3. Invalid data placed in a numeric field 
as a result of redefinition. 

4. Input/output errors that are 
nonrecoverable. 



Program Checkout 55 



5. Items with subscripts whose values 
exceed the defined maximum value can 
destroy machine instructions when 
moved. 

6. Attempting to execute an invalid 
operation code through a system or 
program error. 

7. Generating an invalid address for an 
area that has address protection, 

8. Subprogram linkage declarations that 
are not defined exactly as they are 
stated in the calling program. 

9. Data or instmictions can be modified 
by entering a subprogram and 
manipulating data incorrectly. A 
COBOL subprogram can acquire invalid 
information from the main program, 
e.g., a CALL statement using a 
procedure- name and an ENTRY statement 
using a data-name. 

10. An input file contains invalid data 

such as a blank numeric field or data 
incorrectly specified by its data 
description. 

The compiler does not generate a test 
to check the sign position for a valid 
configuration before the item is used 
as an operand. The programmer can 
test for valid data by means of the 
nimieric cla'ss test and, by using the 
TRANSFORM statement, convert it to 
valid data under certain conditions. 

For example, if the units position of 
a niimeric data item described as USAGE 
IS DISPLAY contained a blank, the 
blank could be transformed to a zero, 
thus forcing a valid sign. 



Notes Since the order is the same as 
the FD's in the Data Division, the 
order can be determined from the 
source program if the SYM option was 
not used (i.e., no glossary was 
printed) . 



2. Find the relative starting address of 
the block of DTF cells from the TGT 
listing in the Memory Map. 



3. Calculate the absolute starting 

address of the block by adding the 
hexadecimal relocation factor for the 
beginning of the object module as 
given in the linkage editor MAP. 



4. Allowing one fullword per DTF cell, 
count off the cells from the starting 
address found in step 3, using the 
order determined in step 1 to locate 
the desired DTF cell. 



5. If more than one DTF is generated for 
a file, the above procedure should be 
followed using the PGT and the SUBDTF 
cells rather than the TGT and the 
DTFADR cells. The order of multiple 
DTF's in core is dependent on the OPEN 
option as follows: 



a. INPUT 

b. OUTPUT 

c. I-O or INPUT REVERSED 



c 



LOCATING A DTF 



The following discussion illustrates the 
method of finding the DTF's in the sample 
program in Figure 10. Letters identifying 
the text refer to letters in the program 
listing. 



One or more DTF's are generated by the 
compiler for each file opened in the COBOL 
program. All information about that file 
is found within the DTF or in the fields 
preceding the DTF. See the chapter 
"Advanced Processing Capabilities" for the 
type of information available and its 
location. 

A particular DTF may be located in an 
execution- time dump as follows: 



® 



The DTF for FILE-1 precedes the DTF 
for FILE-2. 



DTFADR CELLS begin at relative 
location 5C0. 



(g) Since the relocation factor is 3000, 
the DTFADR CELLS begin at location 
3 SCO in the dump. 



1. Determine the order of the DTF address 
cells in the TGT from the DTF numbers 
shown for each file-name in the 
glossary. 



(h) The DTF for FILE-1 begins at location 
3158, and the DTF for FILE-2 begins at 
location 31E0. 



r 



56 



v.. 



LOCATING DATA 



The location assigned to a given 
data-name may similarly be found by using 
the BL niimber and displacement given for 
that entry in the glossary, and then 
locating the appropriate one fullword BL 
cell in the TGT. The hexadecimal s\im of 
the glossary displacement and the contents 
of the cell should give the relative 
address of the desired area. This can then 
be converted to an absolute address as 
described above. 

Since the problem program in Figure 10 
interrupted because of a data exception, 
the programmer should locate the contents 
of field B at the time of the interrupt. 
This Ccin be done as follows: 



® 



Locate data-name B in the glossary. 
It appears under the colxmin headed 
SOURCE-NAME. Source- name B has been 
assigned to base locator 3 (i.e., 
BL =3) with a displacement of 050. 
The sxaa of the value of base locator 
and the displacement value 50 is the 
address of data-name B. 



(k) The Register Assignment table lists 
the registers assigned to each base 
locator. Register 6 has been assigned 
to BL =3. 



(^ The contents of the 16 general 

registers at the time of the interrupt 
are displayed at the beginning of the 



dump. Register 6 contains the address 
000030E8. 



(B) The location of data-name B can now be 
determined by adding the contents of 
register 6 and the displacement value 
50. The result, 3138, is the address 
of the leftmost byte of the U-byte 
field B. 



Note ; Field B contains F1F2F3C4. 
This is external decimal 
representation and does not correspond 
to the USAGE COMPUTATIONAL-3 defined 
in the source listing. 



The location assigned to a given 
data-name may also be found by using 
the BL CELLS pointer in the TGT Memory 
Map, Figure 10 indicates that the BL 
cells begin at location 35B4 (add 5B4 
to the load point address, 3000, of 
the object module) . The first four 
bytes are the first BL cell, the 
second four bytes are the second BL 
cell, etc. Note that the third BL 
cell contains the value 30E8, This is 
the same value as that contained in 
register 6, 



Note ; Some program errors may destroy 
the contents of the general registers 
or the BL cells. In such cases, 
alternate methods of locating the 
DTF's are useful. 



Program Checkout 57 



COCCI 


000010 


00002 


000020 


00003 


000030 


00004 


000040 


00005 


000050 


000C6 


000060 


00007 


000C70 


00008 


000080 


00009 


0CCC90 


COOIO 


OOOlOC 


00011 


000110 


00012 


00012C 


00013 


000130 


0001^ 


C0014C 


00015 


CC015C 


00016 


000160 


00017 


00-0170 


00018 


000180 


OOOIS 


000190 


00C2C 


CC02CC 


00021 


000210 


00C22 


000220 


00023 


00023C 


0002A 


000240 


00025 


000250 


00C26 


000255 


00027 


000260 


00028 


000270 


ooo2g 


CC028C 


C0030 


000290 


00C31 


CC0300 


00032 


000310 


00033 


OC0320 


00034 


0CC33C 


00035 


000340 


00036 


CC035C 


00C37 


000360 



IDENTIFICATIGN DIVISION. 
PROGRAM-ID. TESTRUN. 

AUTHOR. PRCGRANNER NAME. 

INSTALLATICN. NEW YORK PROGRAMMING CENTER. 
DATE-WRITTEN. SEPTEMBER 10, 1968. 
DATE-COMPILED. 06/20/69 

REMARKS. THIS PROGRAM HAS BEEN WRITTEN AS A SAMPLE PROGRAM FOR 
COBOL USERS. IT CREATES An OUTPUT FILE AND READS IT BACK AS 
INPUT. 

ENVIRONMENT CIVISICN. 
CONFIGURATION SECTION. 
SOURCE-COMPUTER. IBM-360-H50. 
OBJECT-COMPUTER. IEM-360-H50. 
INPUT-OUTPUT SECTION. 
FILE-CONTROL. 

SELECT FILE-1 ASSIGN TO SYS008-UT-2400-S . 

SELECT FlLE-2 ASSIGN TO SYSQ08-UT-2400-S. 

DATA DIVISION. 
FILE SECTION. 
FD FILE-1 

LABEL RECORD 

BLOCK CONTAI 

RECORDING MO 

RECORD CONTA 

DATA RECORD 
RECORD-1 . 

05 FIELD-A P 
FlLE-2 

LABEL RECORD 
BLOCK CONTAIN 
RECORD CONTAI 
RECORDING MOD 
DATA RECORD I 
RECORD-2. 
05 FIELD-A PI 



01 



FD 



S ARE STANDARD 

NS 5 RECORDS 

OE IS F 

INS 20 CHARACTERS 

IS RECORD-1. 

IC X(20). 

S ARE STANDARD 

S 5 RECORDS 

NS 20 CHARACTERS 

E IS F 

S RECORD-2. 



® 



01 



C X(20). 



Figure 10. Sample Dxunp Resulting from Abnormal Termination (Part 1 of 6) 



58 



00C38 

ooc3q 

OOOAO 
00041 
00042 
00043 
00044 
00045 
00046 
00C41 
00048 
0004S 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
0006C 
00061 
C0062 
00063 
00064 
00065 
00066 
00067 
00068 

ccc6g 

C0C7C 
00071 
00C72 
00073 
00074 
00075 
00C76 
C0C77 
00078 
00tD79 
00C80 
00081 
00082 
00083 
00084 



0C037C 
000380 
000390 
000400 
0C0410 
000420 
CC0430 
0C0440 
0C0450 
CC0460 
000470 
000480 
0004SC 
000500 
0C051C 
000520 
C00530 
000534 
000535 
000536 
000540 
0C0550 
000560 

000570 
000580 
00059C 
000600 
CCC610 
000620 
00063C 
000640 
000645 
000650 
000660 
0C067C 
000680 
000690 
C00700 
CC071C 
C0072C 
000730 
000740 
000750 
000760 
00077C 
000780 
CCC79C 



WORKING-STORAGE SECTION. 
01 FILLER. 

02 COUNT PIC S?9 COMP SYNC. 

02 ALPHABET PIC X(26) VALUE IS "ABCDEFGHI JKLMNOPQR STUVWXYZ" , 

C2 ALPHA REDEFINES ALPHABET PIC X OCCURS 26 TIMES. 

02 NUMBR PIC S99 COMP SYNC. 

02 DEPENDENTS PIC X(26) VALUE "01234012340123401234012340". 

02 DEPEND REDEFINES DEPENDENTS PIC X OCCURS 26 TIMES. 
01 WORK-RECORD. 

05 NAME-FIELD PIC X. 

05 FILLER PIC X. 

05 RECORD-NO PIC 9999. 

05 FILLER PIC X VALUE IS SPACE. 

05 LOCATION PIC AAA VALUE IS "NYC". 

05 FILLER PIC X VALUE IS SPACE. 

05 NO-OF-DEPENDENTS PIC XX. 

05 FILLER PIC X ( 7J VALUE IS SPACES. 
CI RECORDA. 

02 A PICTURE S9(4J VALUE 1234. 

02 B REDEFINES A PICTURE S9(7) COMPUT AT IQN AL-3 . 

PROCEDURE DIVISION. 
BEGIN. READY TRACE. 

NOTE THAT THE FOLLOWING OPENS THE OUTPUT FILE TO BE CREATED 

AND INITIALIZES COUNTERS. 
STEP-1. OPEN OUTPUT FILE-1. MOVE ZERO TO COUNT, 

NOTE THAT THE FOLLOWING CREATES INTERNALLY T 

CONTAINED IN THE FILE, WRITES THEM ON TAPE, 

THEM ON THE CONSOLE. 
STEP-2. ADD 1 TO COUNT, NUMBR. MOVE ALPHA (COUNT) TO 

NAME-FIELD. /:rN 

1. -* ® 

TO NO-OF-DEPENDENTS. 

MOVE 'NUMBR TO RECORD-NO. 
STEP-3. DISPLAY WORK-RECORD UPON CONSOLE. WRITE RECOPD-1 FROM 

WORK-RECORD. 
STEP-4. PERFORM STEP-2 THRU STEP-3 UNTIL COUNT I 

NOTE THAT THE FOLLOWING CLOSES THE OUTPUT FI 

IT AS INPUT. 
STEP-5. CLOSE FILE-1. OPEN INPUT FILE-2. 

NOTE THAT THE FOLLOWING READS BACK THE FILE AND SINGLES 

OUT EMPLOYEES WITH NO DEPENDENTS. 
STEP-6. READ FILE^2 RECORD INTO WORK-RECORD AT E 
STEP-7. IF NO-OF-DEPENDENTS IS EQUAL TO "0" MOVE 

NO-OF-DEPENDENTS. EXHIBIT NAMED WORK-RECORD. 
STEP-8. CLOSE FILE-2. 

STOP RUN. 



NUMBR. 

HE RECORDS TO BE 

AND DISPLAYS 



COMPUTE B = B + 
MOVE DEPEND (COUNT) 



S EQUAL TO 26. 
LE AND REopEnS 



ND GO TO STEP-8 
"Z" TO 
GC TO STEP-6. 



Figure 10, Sample Dump Resulting from Abnoannal Termination (Part 2 of 6) 



Program Checkout 59 



INTRN 
DNM=1 
DNM=1 
DNM=1 
DNM=1 
DNM=1 
DNM=1 
DNM=1 
DNM=1 
DNM=1 
DNM=1 
0N^=1 
DNM=1 
DNM=1 
DNM=1 
DNM=1 
DNM = 1 
DNM=1 
DNM=1 
0NM=2 
0NM=2 
0NM=2 
DNM=2 
DNM=2' 
DNM=2 
DNM=2 



L NAME 

-146 

-176 

-199 

-21 e 

-246 

-267 

-287 

-306 

-321 

-339 

-357 

-372 

-392 

406 
-432 
-452 

471 

490 

000 

cie 

-037 
C63 
082 
102 
113 



LVL Source n/sme 



FD 

ci 

02 
FD 
01 
02 
CI 
02 
C2 
02 
02 
C2 
02 
01 
02 
02 
02 
02 
02 
C2 
02 
02 
01 
02 
02 



FILE-1 

RECORD-1 

FIELD- yi 

FILE-2 

RECORD-2 

FIELD-/) 

FILLER 

COUNT 

ALPHABET 

ALPHA 

NUMER 

DEPENDENTS 

DEPEND 

WORK-RECCRC 

NAME-FIELD 

FILLER 

RECORD-NO 

FILLER 

LGCATICN 

FILLER 

NO-OF-DEPENDENTS 

FILLER 

RECGRDA 

A 

B r— ® 



BAsE 


DISPL 


InTRNL NAME 


DEFINITION 


USAGE 


DTF=01 




DNM=1-148 






DTFMT 


BL=1 


000 


DNM=1-178 


DS 


0CL20 


GROUP 


BL = 1 


000 


DNM=1-199 


OS 


200 


DISP 


DTF=02 




DNM=1-216 






DTFMT 


BL = 2 


000 


DNM=l-246 


DS 


0CL20 


GROUP 


BL = 2 


000 


DNM=l-267 


DS 


20C 


DISP 


BL=3 


000 


DNM=l-287 


DS 


0CL56 


GROUP 


BL = 3 


000 


DNM=l-306 


DS 


IH 


CQMP 


BL = 3 


002 


DNM=1-321 


DS 


26C 


DISP 


BL=3 


002 


DNM=l-339 


DS 


ic 


DISP 


BL = 3 


oic 


DNM=l-357 


DS 


IH 


COMP 


BL=3 


OlE 


DNM=l-372 


DS 


26C 


DISP 


BL = 3 


OlE 


DNM=l-392 


DS 


ic 


DISP 


BL = 3 


038 


DNM=l-408 


DS 


0CL20 


GROUP 


BL=3 


038 


DNM= 1-432 


DS 


IC 


DISP 


BL = 3 


039 


DNM=l-452 


DS 


IC 


DISP 


BL = 3 


03A 


DNM= 1-471 


DS 


4C 


DISP-NM 


BL=3 


03E 


DNM=l-490 


DS 


IC 


DISP 


BL=3 


03F 


DNM= 2-000 


DS 


3C 


nisp 


BL=3 


042 


DNM=2-018 


DS 


IC 


DISP 


BL=3 


043 


DNM=2-037 


DS 


2C 


DISP 


BL = 3 


045 


DNM= 2-063 


DS 


7C 


DISP 


BL=3 


050 


DNM=2-082 


DS 


0CL4 


GROUP 


BL=3 


050 


DNM=2-102 


DS 


4C 


DISP-NM 


BL = 3 


050 


DNM=2-113 


DS 


4P 


COMP-3 



Q M 



^v_. 



NEMORY MAP 



TGT 

SAVE AREA 
SWITCH 
TALLY 
SORT SAVE 
ENTRY-SAVE 
SORT CORE SIZE 
NSTD-REELS 
SORT RET 
WORKING CELLS 
SORT FILE SIZE 
SORT MODE SIZE 
PGT-VN TBL 
TGT-VN TBL 
SORTAB ADDRESS 
LENGTH OF VN TBL 
LNGTH OF SORTAB 
PGM ID 
A(INITl) 
UPSI SWITCHES 
OVERFLOW CELLS 

BL CELLS -« (n) 

DTFAOR CELLS 
TEMP STORAGE 
TEMP STORAGE-2 
TEMP STORAGE-3 
TEMP STORAGE-4 
ELL CELLS 
VLC CELLS 
SEl CELLS 
INDEX CELLS 
SUBACR CELLS 
CNCTL CELLS 
PFMCTL CELLS 
PFMSAV CELLS 
VN CELLS 
SAVE AREA =2 
XSASW CELLS 
XSA CELLS 
PARAM CELLS 
RPTSAV AREA 
CHECKPT CTR 
lOPTR CELLS 



003F8 

003F8 

00440 

00444 

00448 

0044C 

00450 

00454 

00456 

00458 

00588 

0058C 

00590 

00594 

00598 

0059C 

0059E 

005A0 

005A8 

005AC 

005B4 

005B4 

005C0 -*— <f) 

005C8 

005DO 

005D0 

005D0 

005D0 

005D4 

005D4 

005D4 

00504 

005DC 

005DC 

005DC 

005E0 

005E4 

005E4 

005E4 

005E4 

005E8 

005E8 

OOSEfl 



REGISTER ASSIGNMENT 



REG 6 
REG 7 
REG 8 



BL =3 -< ® 

BL =1 
BL =2 



Figure 10. Sample Diamp Resulting from Abnormal Termination (Part 3 of 6) 



v. 



60 



67 



7C 



71 



72 



000708 


"54 


CF 


D 


106 




00070C 


4F 


30 


D 


IDO 




0CC71C 


40 


30 


6 


OIC 




000714 


41 


40 


6 


002 




000718 


48 


20 


6 


000 




00071C 


4C 


2C 


C 


042 




000720 


lA 


42 








000722 


5B 


4C 


C 


040 




000726 


50 


40 


D 


IDC 




00072A 


58 


EC 





IDC 




0C072E 


D2 


CC 


6 


038 E 


000 


000734 


F8 


70 


D 


IDO C 


044 


00073A 


FA 


43 


D 


1D3 6 


05 


OC0740 


F8 


33 


6 


050 D 


1D4 


000746 


41 


4C 


6 


OlE 




0CC74A 


48 


2C 


6 


000 




00074E 


4C 


20 


C 


042 




000752 


lA 


42 








CCC754 


5B 


4C 


C 


040 




000758 


50 


40 





lEO 




0CC75C 


58 


EC 


D 


lEO 




000760 


02 


OC 


6 


043 E 


000 


000766 


92 


40 


6 


044 




0C076A 


48 


3C 


6 


OIC 




00076 E 


4E 


3C 


D 


IDO 




0C0772 


F3 


31 


6 


03A D 


1D6 


000778 


96 


FC 


6 


03D 




00077C 


58 


FC 


C 


004 





©— 



Nl 

CVB 

STH 

LA 

LH 

MH 

AR 

S 

ST 

L 

MVC 

ZAP 

AP 

ZAP 

LA 

LH 

KH 

AR 

S 

ST 

L 

MVC 

MVI 

LH 

CVD 

UNPK 

CI 

L 



1D6(13) 

3,100(0 

3,01C{0 

4,002(0 

2,000(0 

2,042(0 

4,2 

4,040(0 

4,1DC(0 

14,1DC( 

038(1,6 

1D0(8,1 

103(5,1 

050(4,6 

4,01E(0 

2,000(0 

2,042(0 

4,2 

4,040(0 

4,1EO(0 

14,1E0( 

043(1,6 

044(6), 

3,01C(0 

3,100(0 

03A(4,6 

030(6), 

15,C04( 



,X'0F« 

tl3) 

t6) 

,6) 

,6) 

,12) 

tl2) 

,13) 

0,13) 

), 000(14) 

3) ,044(1,12) 

3), 050(4, 6) 

) ,104(4,13) 

,6) 

.6) 

,12) 

,12) 

,13) 

0,13) 

), 000(14) 

X'40' 

,6) 

,13) 

), 1D6(2,13) 

X'FO' 

0,12) 



TS=01+6 

TS = 01 

DNM=l-357 

DNM=l-339 

0NM=l-306 

LIT+2 

LIT+0 

SBS = 1 

SBS=1 

DNM= 1-432 

TS=01 

TS=04 

DNM=2-113 

DNM=l-392 

DNM= 1-306 

LIT+2 

LIT+0 

SBS=2 

SBS=2 

DNM=2-37 

DNM=2-37+l 

DNM=l-357 

TS=01 

DNM=1-471 

DNM=l-471+3 

V( ILBDDSPO) 



DNM=l-339 
LIT+4 
DNM= 2-113 
TS=04+1 



DNM=l-392 



TS = 07 



.J 



PHASE XFR-AD LOCORE HICURE OSK-AU ESD TYPE LABEL LOADED 

TEST CC300C 0030CO 0048E3 50 07 2 CSECT TESTRUN 003000 

CSECT IJFFBZZN 0039D8 

* ENTRY IJFFZZZN 0039D8 

* ENTRY IJFFBZZZ 0039D8 

* ENTRY IJFFZZZZ 0039D8 

CSECT ILBDSAEO 0047FO 

ENTRY ILBOSAEI 004810 



REL-FR 
0C3000-«— (b) 
003908 



0047F0 



CSECT 



ILBDMNSO 0C47E8 



CSECT ILBDCSPO 003FA8 

* ENTRY ILBDDSPl 0044F8 

* ENTRY ILBDDSP2 004590 

* ENTRY ILBDCSP3 004748 



0C47E8 
0C3FA8 



CSECT 



ILBDIMLO 004780 



CSECT IJJCPDl 003DE0 

ENTRY IJJCPDIN 003DE0 

* ENTRY IJJCPD3 003DE0 



004780 
003DE0 



Figure 10. Sample Dump Resulting from Abnormal Termination (Part U of 6) 



Program Checkout 61 



0S03I PROGR/iM CHECK IMERRUPTION - HEX LOCAnON 00373A - CONDITION CODE - DATA FXCEPTION (A) 
OSOOI JOB SAMPLE CANCELED ^^ 



SAMPLE 



06/20/69 



GR C-7 000035CO 000036D8 OOCCCCOl 00000001 

GR 8-F 00003328 0CC0396A 00CC3CCC 00003000 

FP REG 00000000 00000000 OOCCCCOO COOOOOOO 

COMREG BG ADCR IS OOOIFO 



© 



000030EA 5000399A 000030E8 000032CO 
0Q0035F0 000033F8 000030EA 00003FA8 
OOOOOOCO OCOOOOOO OCOCOOOO OCOOOOOO 



— BG — 
002F80 
002F/iO 
002FC0 
0C2FEC 
0C30C0 
00302C 
0030^0 
003C60 
003CeC 
00.30A0 
CC3CCC 
003CEO 
003100 
00212C 
0031-^0 
00-3160 
0C318C 
0031AC 
(^ 0031C0 
^^ 0031EC 
0032CC 
003220 
0032AO 
003260 
003280 
0C32A0 
0032CC 
0C32E0 
003200 
003320 
0022-^0 
003360 
003380 
0032A0 
0033CC 
0C32E0 



00CC300C 
OCCOCCOl 
CCCCOOOO 
00E2E8E2 
FCFOFOFl 
FCC4C6E2 
E5C1D3C9 
E2C9E9C5 
47F0F0AO 
OCCC30CO 
E3C5E2E3 
E6E7E8E9 
C1C3C5D7 
CICICOI^ 
00003190 
CCCOCOOO 
00000C14 
O100A7F0 



000C35F0 
CCC030EA 
— SAME — 
F0F0F840 
FOFOFOFl 
61E3D6E2 
C4A0D6D7 
58C0F0C6 
98CEF03A 
0CCC3000 
D9E4D54C 
OOOlFOFl 
E3C540D5 
OCCCCCCC 
OOCOOOOO 
86BCF018 
00003322 
OCCOOOOO 



D5D64CD5 C1D4C540 
000C33F8 C00030EA 
50CC399A 000030E8 



FF1500C7 CC003740 0000396A 00003000 
000C3FA8 0CC035C0 0C0C36D8 00000001 
000C32C0 00003328 OOCCOCCO 0C0E607D 



PCOC82C0 C0C OC1C8 



800C0000 
000C339C 
COCCCCOC 
C1C34E7E 
4C6C40F6 
E2E3C5D9 
C1C7C540 
D56CD9C5 
D7D6E2C9 
C9C3E3E4 
15CC4770 
E4D9C540 
C9D5C740 
C74CC6C9 
D9E340C7 
E2E3C5D9 



2CC00CC0 
OCCOCOCO 
OCCCCCCC 
15E2E3C5 
4CD6D940 
D3C9D5C7 
C5D6E340 
D7D6D9E3 
E3C9D6D5 
D9C54060 
946A45EC 
6C4CC4C9 
D5C6D560 
C5D3C440 
C9C3E3E4 
D3C905C7 



00E3C1C7 
FOFOFOFl 
61F3F6FC 
C5D540C6 
58E0CCCC 
90ECDCCC 
000035FC 
CCC1C1C2 
F2F3F4FC 
E8C340E3 
COCCCCCC 
10C039D8 
41ECECC1 
0064CC63 
0101C014 
O0CC3218 
OOCCCOOO 
00000014 
OCCCCOOO 
D9C3C9D5 
F740C9D5 
4CD5D6D5 
C4C9E2D7 
40D7C9C3 
4B7E15E2 
40E240C9 
E2E3C509 
C7C9E340 
D9C5D7C6 
C7E34CF2 
D9C54C6C 
40D5D6D5 






C5C6C9D3 
F0F140F6 
40400000 
C6D940C6 
58D0F0CA 
185D989F 
000033F8 
C3C4C5C6 
F1F2F3F4 
C5404040 
COOOOOOO 
1260£2Ea 
58201044 
COOOOOOO 
COOOOOOO 
COOOOOOO 
86BCF013 
COOOOOOO 
00000000 
C740D5D6 
40C9D3D3 
60D9C5D7 
03C1E860 
E3E4D9C5 
E3C509D3 
Ci3 40C9D3 
C3C9D5C7 
C3C5D5C7 
D9t340D7 
4B7E15E2 
40D7C505 
60D9C5D7 



C54C404C 
F9F1F7F1 
F1F240C1 
C9D3C54B 
9500E000 
F0BA9110 
000C3664 
C7C8C9D1 
F0F1F2F3 



4S4(i4040 
130C00CC 



4C4C4040 
4CF6F9F3 
C3C3C5C7 
4CC6C9D3 
4770F0A2 
D048C719 
00003950 
D2D3D4D5 
F4FCF1F2^ 



404CF1F1 
F6F5F0F0 
E3C5C461 
C57E02C2 
961CD048 
07FF0700 
C3D6C2C6 
C6C7D8D9 
F3F4F0F1 



C6C560D9 
CCOOOOOO^ 



F;1F2F3c4( 



FIFIFIFI 
FOFOFOFO 
61D5D640 
D3D6C3D2 
92FFE00C 
0000396A 
FOFOFOFO 
E2E3E4E5 
F2F3F4FC 
OCOCOOOO 



300C9200 00000108 



E2FCFCF8 
01003258 
OOOOFIFI 
OOOCOOCC 
100039C8 
4iEOEOCl 
00640063 
0000C3C5 
D56CD9C5 
C5C7C1D3 
06D9E340 
E2E34B7E 
406040E5 
C9D5C740 
D3C5C7C1 
40D5D6C5 
fc3C840C7 
C9C3E3E4 
E3C5D9D3 
C3C540C6 
D6D9E340 



4C40C166 
2C000064 
FlFlFlFl 
OCCOOOOO 
1468E2E8 
58201044 
CCCOCOOO 
4CC6C9C5 
D7D6D9E3 
40D7D6E2 
D7C9C3E3 
16E2E3C5 
4CC9D540 
D5D6D560 
C340D7D6 
60C9C5D7 
E340F1F8 
C^C54060 
C9C5C740 
C9C5D3C4 
D7C9C3E3 



900C0000 
00CC32C0 
FOFOFOFl 
OCOCOCOO 
E2FCFCF8 
02003328 
0000481C 
D3C440C9 
4CD7C9C3 
C9E3C9D6 
E409C540 
D9D3C9D5 
C9D3D3C5 
D9C5D7D6 
E2C9E3C9 
D6D9E340 
4B7E15E2 
40E2C8C9 
C5C6D560 
4CC7E340 
E4D9C540 



04000000 
000C32C0 
FOFOFOFl 
OCOOOOOO 
40400276 
00000064 
0C0047FC 
D3D3C5C7 
E3E4D9C5 
D54B7E15 
6040E4E2 
C740D5D6 
C7C1D340 
D9E340D7 
D6D54B7E 
D7C9C3E3 
E3C5D903 
D3D3C9D5 
D9C5D7D6 
F24B7E15 
6040D5D6 



Figure 10. Sample "Dump Resiilting from Abnormal Termination (Part 5 of 6) 



62 



©■ 



003^00 
003^20 
003^^0 
003^60 
003480 
0034A0 
0034CC 
0034E0 
CC35C0 
0C3520 
003540 
C03560 
003580 
0C35A0 



40D7D6E4 
D4C5E24C 
7C000C4B 
0CCC3C0C 
C5E4C4C5 
D6E2C9E3 
4CC5D3D3 
E4D9C540 
7CCC36AC 
CC0030E8 
00003FA8 
C9C2E3E4 
CCOOCOOO 
00003000 



05C44CE2 
C3D3C1E4 
OCCOOOCO 
00003158 
D9C9C340 
C9C6C54B 
C5C7C1D3 
6040D5D6 
0CC03FA8 
000032CC 
000035C0 
D9C-54C6C 
00000000 
E2C3C1D3 



0035C0 
0035E0 
CO360O 
0C3620 
003640 
00366G 
003680 
0C3eA0 
0036C0 
0036E0 
0037C0 
003720 
003740 
003760 
003780 
0037A0 
0037C0 
0037E0 
CC3800 
003820 
003840 
003860 
003880 
0038AQ 
0038C0 
0038E0 
CC39C0 
003920 
003940 
003960 
03980 
0039A0 
0C39C0 
0039E0 
003AC0 
003A20 
003A40 
003A6G 
003A80 
003AA0 
003ACO 
0C3AE0 
003E00 
0C3B20 



100003158 0CCC31E"C 



000037C2 
C00037C2 
OC0C38EC 
5E5EC2C3 
D6D9C4F7 
4004F6F3 
OAC24100 
C04CD201 
4E3CC1CC 
D1DCD7C5 
1A425B4C 
F8336C50 
D20C6C43 
C51F0001 
C2137000 
07F158FC 
D1E84830 
C004051F 
50CCFC08 
1840O5F0 
961C1020 
C71F1841 
6C388000 
581CCC34 
5810CC64 
00140D0C 
581CD1CC 
0A02580C 
C77992FF 
58ECDC54 
50401000 
D2C3DlEe 
47F0F046 
F3F490AE 
F3DC45AC 
F32E45A0 
CA0C45AC 
D7031C4C 
1003471C 
50A0F4OO 
48BC1000 
58E01048 
91201C02 



E84B7E2D 
00003864 
CCCC38D6 
C3D6E2C5 
58FCCCC4 
404040F0 
C1C858F0 
6C1CC040 
D7C5C1DC 
DICODIDO 
CC4C5C40 
D1D44140 
ECCC9240 
4004F7F2 
60385810 
CCC4C51F 
t600C4930 
CCC140C4 
45C0FCCC 
5000F008 
58F0CC04 
41F0CC2C 
58F0C018 
5g2CCC30 
5010D1EC 
C1C40038 
94EF1020 
C1CC4110 
200C9610 
C7FE962C 
871650C0 
C038586C 
47F0F02A 
F3D09620 
FCB847FC 
FCC645A0 
F32ED2C0 
1C4C07FE 
F37C9140 
45A0F32E 
41E01058 
lOEElBBE 
4710F1A2 



C5D7C1D9 
E2C54CD4 
OOCCCOOO 
500C399A 
D7C9C3E3 
7E16D5E4 
40D7D6E2 
4CF940C9 
000035C0 
000C3328 
000C44F8 
4CC4C9C7 
OOCCCOOO 
00003000 

locccooco 

000047CO 
000038B0 
000C37C2 
5B5BC2C6 
051F00C1 
411CC048 
C00805EF 
58F0CC04 
D1DC94CF 
940FD1C6 
DlDC5gEC 
601E4820 
6C444830 
40404CC8 
D1C81841 
CCC140C4 
CC4658F0 
F7F74C4C 
OCCCCCCC 
45C0FCCC 
051FCCC1 
D2C21025 
07FF5810 
D5CCCC60 
4120D1EC 
FFFF5810 
18011840 
CC580AC2 
D04850E0 
DC48416C 
4180D1BC 
D1C45870 
47FCF272 
103C45A0 
F03690/^E 
F32ED2C1 
1038101E 
D7C31044 
1005471C 
58A0F400 
12BB478C 
47F0F110 
58E01C38 



C1E3D6 09 
C1E840C2 
00003664 
40C9D3D3 
E4L)9C540 
D4C5D9C9 
C9E3C9D6 
D540D7C9 
000036D8 
0000396A 
000G32C0 
C9E340D3 
COOOOOOO 
C0G00250 
OOOQOOIC 
00003f 90 
00003910 
C01A8B5B 
C3D4E4D3 
4004F6F0 
56000108 
5810D1C8 
051F0001 
DliD64F30 
4F30D1D0 
D1DCD200 
60004C20 
601C4E30 
58F0C004 
58F01010 
F7F44040 
C028078F 
40005810 
0A025800 
00000000 
4004F8F0 
F00158F0 
C01C07F1 
60430772 
58F0C004 
C01407F1 
4110C050 
CAOEOAOE 
D05405F0 
00044110 
4170D1CF 
C1BC5880 
47F0F052 
F0B89faAE 
F3D058A0 
103E1050 
C7011000 
104407FE 
F33A9180 
91011004 
F1349640 
91401005 
948F1005 



IOC0032C 01 0000332 8 |0C003CE8 
C540D5D6 



4B7E15C6 
C54CE2D7 
00000000 
C5C7C1C3 
604CD740 
C34CC7C9 
D54E7E16 
C3E3E4D9 
000C32C0 
00003000 
00C1C5C7 
C5C5C7E3 
^C4C9C7C9 
vtV000CC32Cr 
00000000 
000C47E8 
0G0037BC 
OOOCOOCl 
F0E900C0 
404040C1 
184C05F0 
961C1020 
4004F6F7 
U1DC403C 
4030601C 
6038E000 
C0421A42 
D1D0F331 
051F00C2 
45ECF0CC 
408F5800 
5810C00C 
D1C894EF 
D1C84110 
0A0241CC 
404C40F0 
101C45E0 
58FCCC04 
95406044 
051F80C1 
58FCC004 
070005F0 
5GD050Ce 
9120D048 
C00C4170 
051058CC 
D1CC58E0 
47F0F0C6 
F3D044C0 
10445BA0 
47F0F036 
100058A0 
98BD1044 
1D15478C 
4710F282 
10051266 
4710F1A2 
D2021039 



C5D3E840 
C5C3C9C6 
COOOOOOO 
40D7D6E2 
C9D540C9 
C3E3E4D9 
D5E4D4C5 
CCCC36D0 
00003000 
00003000 
0C0036D0 
C840C7E3 
E340D3C5 



E3C8C540 
0000004B 
00003158 
C9E2C9D6 
D3D3C5C7 
C54C6C4C 
D9C9C340 
0CCC32C0 
000C3158 
000C35F0 
E4D4C5D9 
40F1F84B 
D5C7E3C8 



D9C5D5C1 
OCOOOOOO 
0C0C32CC 
D54B7E16 
C1D340D7 
E540C9D5 
D7C9C3E3 
0100C34C 
5000399A 
000036D8 
C9C340D7 
7E16D5E4 
404E40E2 



0C0030EA 
CCC03FA8 
000037E2 
ICCOOOIA 
CCCOCOCO 
9640C048 
5C00F008 
5C20D1BC 
4C4040D0 
6CCC4830 
41406002 
F87CD1D0 
5B40C040 
6C3AD1D6 
0C000014 
5020D1BC 
D1E85000 
07F15800 
10201801 
CC580A02 
D1CC58F0 
5810D1CC 
FCC85020 
051FC001 
0772D200 
ICOOOOOB 
C51FC0C1 
5CC0F008 
5C50D0C4 
47E0F016 
CC40C670 
8CC01E0B 
D05407FE 
47F0F150 
1C249101 
1C404780 
5CACF3D0 
F3C007FE 
4400102C 
F37C9120 
58E01028 
41E01058 
91101003 
1C4141BB 



000C478C 
0OOC37F6 
5B5BC2D6 
E6D6D9D2 
58FOC004 
4500F00C 
587CD1BC 
4830C042 
CC424A30 
48206000 
C044F/S43 
504CD1E0 
96F0603D 
CD0001C4 
587CD1BC 
D1E458C0 
01E45000 
184C4110 
4110C048 
CCC805EF 
58F0C02C 
D1CC5880 
4004F8F1 
6C43C061 
OC000068 
4CC4F8F3 
4500F00C 
'58200000 
580CBC48 
055C5840 
5CCC8000 
47F0F070 
09D10606 
1C15078E. 
F03640A0 
45ACF32E 
91041015 
50B01044 
1C15471C 
440C1030 
4740F1A2 
41E01050 
000C50B0 



E3400409 
00003608 
000038AA 
D705D54C 
60D90 5C3 
051F0001 
00003158 
D2016000 
4A3060C0 
60104E3C 
40200042 
D1D36050 
58E0D1E0 
58F0C004 
0038FFFF 
5810D1E8 
0C24500C 
D1E858FC 
005005FO 
5800C10C 
5810D1CC 
91201010 
D100D213 
4040405F 
92406044 
OOOOOOOC 
40404000 
00000000 
95002000 
982DB050 
10001E4B 
87861000 
47F0F0A0 
02E9E9D5 
0A0990AE 
103E45AC 
42001038 
4710F0BC 
07FA9110 
F0E80A00 
50E01028 
948F1005 
4710F1A2 
10409104 



Figure 10. Sample Diamp Resulting from Abnormal Termination (Part 6 of 6) 



Program Checkout 63 



DIAGNOSTIC MESSAGES 



Diagnostic messages are generated by the 
compiler and listed on SYSLST when errors 
are found in the source program- 
Note: Diagnostic messages are suppressed ^ 
when the NOERRS option is in effect. 



WORKING WITH DIAGNOSTIC MESSAGES 



1. Approach the diagnostic messages in 
the order in which they appear on the 
source listing. It is possible to get 
compound diagnostic messages. 
Frequently, an earlier diagnostic 
message indicates the reason for a 
later diagnostic message. For 
example, a missing quotation mark for 
an alphabetic or alphanumeric literal 
could involve the inclusion of some 
clauses not intended for that 
particular literal. This could cause 
an apparently valid clause to be 
diagnosed as invalid because it is not 
complete, or because it is in conflict 
with something that preceded it. 

2. Check for missing or superfluous 
punctuation, or other errors of this 
type. 

3. Frequently, a seemingly meaningless 
message is clarified when the valid 
syntax or format of the clause or 
statement in question is referenced. 



GENERATION OF DIAGNOSTIC MESSAGES 



The compiler scans the statement, 
element by element, to determine whether 
the words are combined in a meaningful 
manner. Based upon the elements that have 
already been scanned, there are only 
certain words or elements that can be 
correctly encotintered. 

If the anticipated elements are not 
encountered, a diagnostic message is 
produced. Some errors may not be uncovered 
until information from various sections of 
the program is combined and the 
inconsistency is noted. Errors uncovered 
in this manner can produce a slightly 
different message format than those 
uncovered when the actual source text is 
still available. The message that is made 
unique through that particular error may 
not contain, for example, the actual source 
statement that produced the error. 



Errors that appear to be identical are 
diagnosed in a slightly different manner, 
depending on where they were encountered by 
the compiler and how they fit within the 
context of valid syntax. For example, a 
period missing from the end of the 
Working- Storage section header is diagnosed 
specifically as a period required. There 
is no other information that can appear at 
that point. However, if at the end of a 
data item description entry, an element is 
encountered that is not valid at that" 
point, such as the digits 02, it is 
diagnosed as invalid. Any clauses 
associated with the 02 entry which conflict 
with the clauses in the previous entry (the 
one that contained the missing period) , are 
diagnosed. Thus, a missing period produces 
a different type of diagnostic message in 
one situation than in the other. 



LINKAGE EDITOR OUTPUT 



The Linkage Editor produces diagnostic 
messages, console messages, and a storage 
map. For a complete description of output 
and error messages from the Linkage Editor, 
see the publication IBM System/360 Disk 
Operating System; System Control and 
System Searvice Programs . Output resulting 
from the linkage editing of a COBOL program 
is discussed in the chapter "Interpreting 
Output. " 



EXECUTION TIME MESSAGES 



When an error condition that is 
recognized by compiler-generated code 
occurs during execution, an error message 
is written on SYSLST and SYSLOG. No 
message is written on SYSLST when an error 
occurs in the foreground and SYSLST is 
assigned to a disk. 

Messages that normally appear on SYSLOG 
are provided with a code indicating whether 
the message originated in a foreground or 
background program. These messages are 
listed in "Appendix F: Diagnostic 
Messages." 



RECORDING PROGRAM STATUS 



When a program is expected to run for an 
extended period of time, provision should 
be made for taking checkpoint information 
periodically d\iring the run. A checkpoint 
is the recording of the status of a problem 
progreun and main storage (including 



64 



o 



input/output status and the contents of the 
general registers). Thus, it provides a 
means of restarting the job at an 
intermediate checkpoint position rather 
than at the beginning, if for any reason 
processing is teirminated before the normal 
end of the program. For example, a job of 
higher priority may require immediate 
processing, or some malfunction (such as a 
power failure) may occur and cause an 
interruption. Checkpoints are taken using 
the COBOL RERUN clause. 

Restart is a means of resuming the 
execution of the program from one of the 
checkpoints rather than from the beginning. 
The ability to restart is provided through 
the RSTRT job control statement. 



RERUN CLAUSE 



The presence of the RERUN clause in the 
source program causes the CHKPT macro 
instruction to be issued at the specified 
interval. When the CHKPT macro instruction 
is issued, the following information is 
saved: 

1. Information for the Restart and other 
supervisor or job control routines. 

2. The general registers. 

3. Bytes 8 through 10, and 12 through 45 
of the Communication Region. 

4. The problem program area. 

5. All file protection extents for files 
assigned to mass storage devices if 
the extents are attached to logical 
units contained in the program for 
which checkpoints are taken. 

Since the COBOL RERUN clause provides a 
linkage to the system CHKPT macro 
instruction, any warnings and restrictions 
on the use of this macro instruction also 
apply to the use of the RERUN clause. See 
the publication IBM .Svstem/360 Disk 
Operating System; Supervisor and 
Input/Output Macros for a complete 
description of the CHKPT macro instruction. 



TAKING A CHECKPOINT 



In order to take a checkpoint, the 
programmer must specify the source language 
RERUN clause and must define the file upon 
which checkpoint records are to be written 
(e.g., ASSGN, EXTENT, etc.) Checkpoint 
information must be written on a 2311 or 



2314 mass storage device or on a magnetic 
tape — either 7- or 9-track. Checkpoint 
records cannot be imbedded in one of the 
problem program's output files, i.e., the 
program must establish a separate file 
exclusively for checkpoint records. 



In designing a program for which 
checkpoints are to be taken, the user 
should consider the fact that, upon 
restarting, the program must be able to 
continue as though it had just reached that 
point in the program at which termination 
occurred. Hence, the user should ensure 
that: 

1. File handling is such as to permit 
easy reconstruction of the status of 
the system as it existed at the time 
of checkpoint was taken. For example, 
when multifile reels are used, the 
operator should be informed (by 
message) as to which file is in use at 
the time a checkpoint is to be taken. 
He requires this information at 
restart time. 



2. The contents of files are not altered 
between the time of the checkpoint and 
the time of the restart. For 
sequential files , all records written 
on the file at the time the checkpoint 
is taken should be xinaltered at ^ 
restart time. For nonsequential 
files, care must be taken to design 
the program so that a restart will not 
duplicate work that has been completed 
between checkpoint time and restart 
time. For example, suppose that 
checkpoint 5 is teiken. By adding an 
amount representing the interest due, 
account XYZ is updated on a 
direct-access file that was opened 
with the I-O option. If the program 
is restarted from checkpoint 5 and if 
the interest is recalculated and again 
added to accoiant XYZ, incorrect 
results will be produced. 

If the program is modular in design, 
RERUN statements must be included in all 
modules that handle files for which 
checkpoints are to be taken. (When an 
entry point of a module containing a RERUN 
statement is encountered, a COBOL 
subroutine, ILBDCKPO, is called. ILBDCKPO 
enters the files of the module into the 
list of files to be repositioned.) 
Repositioning to the proper record will not 
occur for any files that were defined in 
modules other than those containing RERUN 
statements. Moreover, a restart from any 
given checkpoint may not reposition other 
tapes on which checkpoints are stored. 
Note, too, that only one disk checkpoint 
file can be used. 



Program Checkout 65 



RESTARTING A PROGRAM 



If the programmer requests checkpoints 
in his job by means of the COBOL RERUN 
clause, the following message is given each 
time a checkpoint is taken: 

OCOOl CHKPT nnnn HAS BEEN TAKEN ON 
SYSxxx 



nnnn 



is the 4-character identification of 
the checkpoint record. 



To restart a job from a checkpoint, the 
following steps are required: 

1. Replace the // EXEC statement with a 
// RSTRT statement. The foinnat of the 
RSTRT statement is discussed in the 
chapter "Preparing COBOL Programs For 
Processing," All other job control 
statements applicable to the job step 



should be the same as when the job was 
originally run. If necessary, the 
channel and \init addresses for the // 
ASSGN control statements may be 
changed. 



2. Rewind all tapes used by the program 
being restarted, and mount them on 
devices assigned to the symbolic units 
required by the program. If 

multi volume files are used, mount (on 
the primary unit) the reel being used 
at the time that the checkpoint was 
taken, and rewind it. If multifile 
volumes are used, position the reel to 
the start of the file referenced at 
the time the checkpoint is being 
taken, 

3, Reposition any card file so that only 
cards not yet read when the checkpoint 
was taken are in the card reader. 



< 



4, Execute the job. 



I 



66 



INTERPRETING OUTPUT 



C)> 



I The American National Standard COBOL 
compiler, COBOL object module, Linkage 
Editor, and other system components can 
produce output in the form of printed 
listings, punched card decks, diagnostic or 
informative messages, and data files 
directed to tape or to mass storage 
devices. This chapter gives the format of 
and describes this output. The same COBOL 
program is used for each example. 
"Appendix A: Sample Program Output" shows 
the output f oannats in the context of a 
complete listing generated by the sample 
program. 

COMPILER OUTPUT 



The output of the compilation job step 
may include: 

o A printed listing of the job control 
statements 

• A printed listing of the statements 
contained in the source program 

• • A glossary of compiler-generated 
information about data 

• A printed listing of the object code 

• A condensed listing containing only the 
first generated instruction for each 
verb 

• Compiler diagnostic messages 

• A cross-reference listing 

• System messages 

• An object module 

The presence or absence of the 
above-mentioned types of compiler output is 
determined by options specified at system 
generation time. These options can be 
overridden or additional options specified 
at compilation time by using the OPTION 
control statement and the CBL card. 

The level of diagnostic message printed 
depends upon the FLAGW or FLAGE option of 
the CBL card. 

All output to be listed is written on 
the device assigned to SYSLST. Line 
spacing of the source listing is controlled 
by the SPACEn option of the CBL card and by 
SKIP 1/2/3 and EJECT in the COBOL source 



program. The number of lines per page can 
be specified in the SET command. In 
addition, a listing of input/output 
assignments can be printed on SYSLST by 
using the LISTIO control statement. 

Figure 11 contains the compiler output 
listing shown in "Appendix A: Sample 
Program Output. " Each type of output is 
n\2mbered, and each format within each type 
is lettered. The text following the figure 
is an explanation of the figure. 



® 



The listing of the job control 
statements associated with this job 
step . These statements are listed 
because the LOG option was specified 
at system generation time. 



(^ Compiler options . The CBL card, if 

specified, is printed on SYSLST unless 
the LIST option is suppressed. 



® 



The source module listing . The 
statements in the source program are 
listed exactly as submitted except 
that a compiler- generated card number 
is listed to the left of each line. 
This is the niomber referenced in 
diagnostic messages and in the object 
code listing. It is also the number 
printed on SYSLST as a result of the 
source language TRACE statement. The 
source module is not listed when the 
NOLIST option is specified. 



The following notations may appear on 
the listing: 

C Denotes that the statement was inserted 
with a COPY statement. 

** Denotes that the card is out of 

sequence. NOSEQ should be specified on 
the CBL card if the sequence check is 
to be suppressed. 

I Denotes that the card was inserted with 
an INSERT or BASIS card. 

If DATE-COMPILED is specified in the 
Identification Division, any sentences in 
that paragraph are replaced in the listing 
by the date of compilation. It is printed 
in one of the following formats depending 
upon the format chosen at system generation 
time. 

DATE-COMPILED, month/day/year or 

DATE-COMPILED. day/month/year 



Interpreting Output 67 



// JCB SANPLE J 

// CPTICN NODECK, LINK, LIST, LISTX,SYM, ERRS \ (J) 

PHASE TEST,* ( ^"^ 

// EXEC FCOBCL ■' 



CBL CUCTE 



© 



OOOOi OCOOIC IDENTIFICATION DIVISION. 

00DC2 OC002C PROGRAM-ID. TESTRUN. 

00003 000030 AUTHOR. PROGRAMMER NAME. 

OOCCA 000040 INSIALLATICN. NEW YORK PROGRAMMING CENTER. 

00005 000050 DATE-WRITTEN. SEPTEMBER 10, 1968. 

O00C6 000060 DATE-CCMPILED. 06/20/69 

00CC7 00007C REMARKS. THIS PRCGRAM HAS BEEN WRITTEN AS A SAMPLE PROGRAM FOR 

00OC8 000080 COBOL USERS. IT CREATES AN OUTPUT FILE AND READS IT BACK AS 

00CC9 000090 INPUT. 

OOOIC CCOICC 

00011 000110 ENVIRONMENT DIVISION. 

00012 C0012C CONFIGURATION SECTION. 

00013 00013C SOURCE-COMPUTER. IBM-360-H50. 
OOOIA 000140 OBJECT-COMPUTER. IEM-360-H50. 

00015 CC015C INPUT-CUTPUT SECTICN. 

00016 000160 FILE-CONTROL. 

00017 000170 SELECT FlLE-1 ASSIGN TO SYS008-UT-24CC- S. 
OOOie 000180 SELECT FILE-2 ASSIGN TO SYS008-UT-2400-S . 
00019 000190 



00056 000550 PROCEDURE DIVISION. 

O0C57 000560 BEGIN. READY TRACE. 

00058 000570 NOTE THAT THE FOLLOWING OPENS THE OUTPUT FILE TO BE CREATED 

00059 CC058C AND INITIALIZES COUNTERS. 

00060 000590 STEP-1. OPEN OUTPUT FlLE-1. MOVE ZERO TO COUNT, NUMBP. 



(D 



00C73 OC0720 STEP-5. CLOSE FILE-1. OPEN INPUT FILE-2. 

00074 000730 NOTE THAT THE FOLLOWING READS BACK THE FILE AND SINGLES 

00075 C0C74C OUT EMPLOYEES WITH NO DEPENDENTS. 

00076 000750 STEP-6. READ FILE-2 RECORD INTO WORK-RECORD AT END GC TO STEP-8. 

00077 000760 STEP-7. IF NC-OF-DEPENDENTS IS EUUAL TO "0" MOVE "Z" TO 

00078 000770 NO-OF-DEPENDENTS . EXHIBIT NAMED WORK-RECORD. GO TO STEP-6. 

00079 CC0780 STEP-8. CLOSE FILE-2. 
CCOeO CC0790 STOP RUN. 



Figure 11. Examples of Compiler Output (Part 1 of 4) 



68 



V. 



@ 


® 


© 


® 


® 


® 


© 


® 


® 




INTRNL NAME 


LVL 


SOURCE NAME 


BASE 


DISPL 


INTRNL NAME 


DEFINITION 


USAGE 


R 


M 


DNM-=1-148 


FD 


FILE-1 


DTF=01 




DNM=1-148 




DTFMT 




F 


DNM=1-178 


01 


RECORD-1 


BL=1 


000 


DNM=1-178 


OS 0CL20 


GROUP 






DNM=1-199 


02 


FIELD-A 


BL=1 


oco 


DNM=1-199 


OS 2CC 


DTSP 






DNM=1-216 


FD 


FILE-2 


DTF=02 




DNM=1-216 




OTFMT 




F 


DNM=l-246 


01 


RECORD-2 


BL = 2 


oco 


DNM=l-246 


OS 0CL20 


GROUP 






DNM=l:-267 


C2 


FIELD-A 


BL=2 


000 


DNM=l-267 


DS 20C 


DISP 






DNN=l-287 


01 


FILLER 


BL=3 


000 


DNM=l-287 


DS 0CL56 


GROUP 






DNM=l-30 6 


C2 


COUNT 


BL=3 


000 


DNM=l-306 


DS IH 


COMP 






DNM= 1-321 


C2 


ALPHABET 


BL=3 


002 


DNM=1-321 


DS 26 C 


DISP 






DNM=l-339 


C2 


ALPHA 


BL=3 


002 


DNM=1-33Q 


DS IC 


oisp 


R 




DNM=l-357 


C2 


NUMBR 


BL=3 


OlC 


DNM=l-357 


DS IH 


COMP 







® 





MEMORY MAP 




TGT 


® 


G03F0 


SAVE AREA 




003F0 


SWITCH 




00438 


TALLY 




0043C 


SORT SAVE 




00440 


ENTRY-SAVE 




00444 


SORT CORE 


SIZE 


00448 


NSTD-REELS 




0044C 



LITERAL POOL (HEX) 

00628 (LIT+Cl 
0C64C (LIT+24) 



® 



COOOOOOl 001A5B5B C2D6D7C5 D54C5B5B C2C3D3D6 E2C55B5B 
C2C6C3D4 E4D3FCE9 COOOOOOO 



DISPLAY LITERALS (BCD) 
0064C {LTL + 36) • WCRK-RECORD > 



PGT 



© 



005E8 



OVERFLOW CELLS 
VIRTUAL CELLS 
PROCEDURE NAME CELLS 
GENERATED NAME CELLS 
SUECTF ACDRESS CELLS 
VNI CELLS 
LITERALS 
DISPLAY LITERALS 



005E8 
005E8 
005F4 
00608 
00620 
00620 
00628 
0064C 



Figure 11. Examples of Compiler Output (Part 2 of 4) 



Interpreting Output 69 



REGISTER ASSIGNMENT 



REG 


6 BL : 


= 3 


\ 


® 










REG 


7 BL : 


= 1 


1 


f ^"^ 










REG 


e BL = 


= 2 




^ 




* 






© 


® 




© 


1 




® 


© 




57 


000658 






START EQU 


* 








0CC65a 


58 


FC C 


004 


L 


15,004(0,12) 


V( ILBODSPO) 






00065C 


05 


IF 




BALR 


If 15 








CCC65E 


CC0140 




CC 


X»000140« 








000661 


04F5F7404040 


DC 


X'04F5F7404040' 






57 


000668 


96 


40 D 


048 


CI 


048(13), X'40' 


SWT+0 




60 


0C066C 


58 


FC C 


004 


L 


15,004(0,12) 


V( ILBODSPO) 






000670 


05 


IF 




BALR 


1»15 








00C672 


0C0140 




DC 


X'000140' 








000675 


C4F6FC4C4040 


DC 


X'04F6F0404040' 






60 


00067C 


41 


10 C 


046 


LA 


1,046(0,12) 


LIT+6 






00068C 


58 


CC D 


1C8 


L 


0,1C8(0,13) 


0TF=1 






000684 


18 


40 




LR 


4,0 








000686 


C5 


FO 




BALR 


15,0 








C00688 


50 


CC F 


008 


ST 


0,008(0,15) 








00068C 


45 


00 F 


OOC 


BAL 


0,00C(0,15) 








000690 


occccooo 


DC 


X'OOOOOOOO" 








00C694 


OA 


02 




SVC 


2 








000696 


41 


00 D 


1C8 


LA 


0,1C8(0,13) 


DTF = 1 






CCC69A 


58 


FC C 


008 


L 


15,008(0,12) 


V( ILBOIMLO) 






00069E 


05 


EF 




BALR 


14,15 








0006AO 


58 


10 D 


1C8 


L 


1,1C8(0,13) 


0TF = 1 






CCC6A4 


96 


10 1 


020 


CI 


020(1 ),X'10» 








0006A8 


50 


20 D 


IBC 


ST 


2,1BC(0,13) 


BL =1 






0006AC 


58 


70 D 


IBC 


L 


7,1BC(0,13) 


BL =1 




60 


0C06B0 


D2 


01 6 


000 C 040 (g 


) MVC 


000(2,6) ,040(12) 


DNM=l-306 


LIT+0 




0006B6 


D2 


01 6 


OIC C 040 


MVC 


01C(2,6) ,040(12) 


DNM=l-357 


LTT+0 


64 


0006BC 






PN=( 


31 ECU 


* 








0C06EC 


58 


FC C 


004 


L 


15,004(0,12) 


V(ILBDOSPO) 






0006CC 


C5 


IF 




BALR 


1t15 








0006C2 


CC014C 




CC 


X«000140« 








0006C5 


C4F6F4404040 


DC 


X»04F6F4404040' 






64 


0006CC 


48 


30 C 


042 


LH 


3,042(0,12) 


LIT + 2 






0C06DC 


4A 


30 6 


000 


AH 


3,000(0,6) 


0NM=l-306 






0006D4 


4E 


30 D 


IDO 


CVD 


3,100(0,13) 


TS = 01 






0CC6D8 


07 


05 D 


100 D 100 


XC 


100(6, 13), 100(13) 


TS=01 


TS = 01 




0006DE 


94 


OF D 


1D6 


NI 


106(13) ,X'OF' 


TS=01+6 






0006E2 


4F 


30 D 


100 


CVB 


3,100(0,13) 


TS = 01 






CC06E6 


40 


30 6 


000 


STH 


3,000(0,6) 


ONM= 1-306 






0006EA 


48 


30 C 


042 


LH 


3,042(0,12) 


LIT+2 






0CC6EE 


4A 


30 6 


OIC 


AH 


3,01C(0,6) 


ONM= 1-357 






0006F2 


4E 


30 D 


100 


CVD 


3,100(0,13) 


TS=01 






0006F6 


D7 


05 D 


100 D 100 


XC 


100(6, 13), 100(13) 


TS=01 


TS=01 


Figure 11. 


E3 


camp] 


Les of Compi] 


Ler Output 


t (Part 3 of 4) 







^,. 



70 



® 

DATA NAMES 

FILE-1 

RECCRD-1 

FILE-2 

RECORD-2 

COUNT 

ALPHA 

NUMBR 

DEPEND 

WORK-RECORD 

NAf'E-FIELD 

RECORD-NO 

NC-OF-DEPENDENTS 



CROSS-REFERENCE DICTIONARY 



(D 



PROCEDURE NAMES 

STEP-2 

STEP- 6 
STEP-8 



DEFN 


REFERENCE 










00017 


0006C 


C006C 


C0068 


OC073 






00028 


00068 












00018 


00073 


00073 


00076 


00076 


00079 




00036 


00076 












00040 


00060 


00064 


00064 


00064 


00066 


00070 


00C42 


00064 


CC064 










00043 


0006C 


CC064 


00064 


0CC67 




\ 


00045 


00066 


00066 








I 


0C046 


00068 


00068 


C0076 


00078 




1 


00047 


00064 










1 


00049 


00067 


00067 








1 


00053 


00066 


00066 


00077 


0C077 


00077 


00077 1 


DEFN 


REFERENCE 










000b4 


0007C 












000 7b 


00078 












00079 


00076 













® 



CARD 
® 



64 
64 



ERROR MESSAGE 

® ©. 
ILA5011I-W 
ILA5011I-W 



® 



HIGH ORDER TRUNCATION MIGHT OCCU 
HIGH ORDER TRUNCATIJN MJliHT OCC 



UR. ( 
UR. \ 



® 



o 



c 



Figure 11, Examples of Compiler Output (Part 4 of 4) 



Interpreting Output 71 



(5) Glossary . The glossary is listed 
when the SYM option is specified. 
The glossary contains information 
about names in the COBOL soxirce 
program. 

(a) and(^ The internal-name 

generated by the compiler. 
This name is used in the 
compiler object code listing 
to represent the name used in 
the source program. It is 
repealed in col\jmn F for 
readability. 

(b) a normalized level number. 
This level number is 
determined by the compiler as 
follows: the first level 
n\amber of any hierarchy is 
always 01, and increments for 
other levels are always by 
one. Only level numbers 03 
through 49 are affected; 
level numbers 66, 77, and 88, 
and FD, SD, and RD indicators 
are not changed. 

(c) The data-name that is used in 
the source module. 



CODE- 
CELL 



E. nnnn 



S.nnnn 



N. nnnn 



Used to hold code 
specified. 



Name generated from 
COLUMN clause in 
02- level statement. 

Used for elementary 
level with SUM clause, 
but not with data-name. 

Used to save the total 
n\imber of lines used by 
a report group when 
relative line numbering 
is specified. 



(D)and(E) For data-names, these columns 
contain information about the 
address in the form of a base and 
displacement. For file-names, the 
column contains information about 
the associated DTF, if any. 

(G) This column defines storage for 

each data item. It is represented 
in assembler-like terminology. 
Table 3 refers to information in 
this column. 



Note: The following Report Writer 
internally- generated data-names 
can appear under the SOURCE NAME 
column: 



CTL.LVL Used to coordinate 
control break 
activities. 

GRP.IND Used by coding for GROUP 
INDICATE clause. 

TER.COD Used by coding for 
TERMINATE clause. 

FRS.GEN Used by coding for 
GENERATE clause. 

-nnnn Generated report record 
associated with the file 
on which the report is 
to be printed. 

RPT.RCD Build area for print 
record. 

CTL.CHR First or second position 
of RPT.RCD. Used for 
carriage control 
character. 

RPT.LIN Beginning of actual 

information which will 
be displayed. Second or 
third position of 
RPT.RCD. 



@ Usage of the data-name. For FD 
entries, the DTF type is 
identified (e.g., DTFDA) . For 
group items containing a USAGE 
clause, the usage type is printed. 
For group items that do not 
contain a USAGE clause, GROUP is 
printed. For elementary items, 
the information in the USAGE 
clause is printed. 

(j) A letter \inder column: 

R - Indicates that the data-name 
redefines another data-name. 

O - Indicates that an OCCURS 

clause has been specified for 
that data-name. 

Q - Indicates that the data- name 
is or contains the DEPENDING 
ON object of the OCCURS 
clause. 

M - Indicates the record format. 
The letters which, may appear 
under column M are: 

F - fixed- length records 

U - undefined records 

V - variable -length records 

S - spanned records 



72 



Table 3. Glossary Definition and Usage 



L 



h- 



Type 



Definition 



Group Fixed-Length 


DS 


OCLN 


Alphabetic 


DS 


NC 


Alphanumeric 


DS 


NC 


Alphanxmieric Edited 


DS 


NC 


Numeric Edited 


DS 


NC 


Index-Name 


DS 


IH 


Group Variable-Length 


DS 


VLI=N 


Sterling Report 


DS 


NC 


External Decimal 


DS 


NC 


External Floating-Point 


DS 


NC 


Internal Floating-Point 


DS 


IF 




DS 


ID 


Binary 


DS 


IH, 1] 


Internal Decimal 


DS 


NP 


Sterling Non-Report 


DS 


NC 


Index-Name 


BLANK 


File (FD) 


BLANK 


Condition (88) 


BLANK 


Report Definition (RD) 


BLANK 


Sort Definition (SD) 


BLANK 



OR 2F 



X 



Usage 



GROUP 
DISP 
DISP 
AN- EDIT 
NM-EDIT 
INDEX-NM 
GROUP 
RPT-ST 
DISP-NM 
DISP-FP 
COMP-1 
COMP-2 
COMP 
COMP-3 
DISP- ST 
INDEX-NAME 
DTF TYPE 
BLANK 
BLANK 
BLANK 
-X : 



Note: Under the definition column, N = size in bytes, except in group variable- length 
where it is a variable cell number. 

- J 



('■^1 



(5) Global tables and literal pool ; 
Global tables are listed when the 
LISTX option is specified, unless 
SUPMAP is also specified and an 
E-level error is encountered. A 
global table contains easily 
addressable infoinmation needed by the 
object program for execution. For 
example, in the Procedure Division 
output coding (3), the address of the 
first instruction under STEP-1 (OPEN 
OUTPUT FILE-1) is found in the 
PROCEDURE NAME CELLS portion of the 
Program Global Table (PGT). 



© 



time subroutine (marked "DISPLAY 
LITERALS"). 



The Program Global Table (PGT) . 
This table contains literals and 
the addresses of procedure-names 
referenced by Procedure Division 
instructions . 



(6) Register assignment ; This lists the 

register assigned to each base locator 
in the object program. 



_^ 



(K) The Task Global Table (TGT) . This 
table is used to record and save 
information needed during the 
execution of the object program. 
This information includes 
switches, addresses, and work 
areas. 

(b) The Literal Pool. This lists all 
literals used in the program, with 
duplications removed. These 
literals include those specified 
by the programmer (e.g., MOVE 
"ABC" TO DATA-NAME) and those 
generated by the compiler (e.g., 
to align decimal points in 
arithmetic computations). The 
literals are divided into two 
groups; those that are referenced 
by instructions (marked "LITERAL 
POOL") and those that are 
parameters to the display object 



(7) Object code listing . The object code 
listing is produced when the LISTX 
option is specified, unless SUPMAP is 
also specified and an E-level error is 
encountered. The actual object code 
listing contains; 



® 



The compiler-generated card 
niamber. This niimber identifies 
the COBOL statement in the source 
deck which contains the verb that 
generates the object code found in 
column C. 



(b) The relative location, in 
hexadecimal notation, of the 
object code instruction in the 
module. 

(c) The actual object code instruction 
in hexadecimal notation. 



Interpreting Output 73 



(D) The procedure-name n\3mber. A 
number is assigned only to 
procedure-naimes referred to in 
other Procedure Division 
statements. 



(S) Ihe object code instruction in the 
form that closely resembles 
assembler language, (Displacements 
are in hexadecimal notation. ) 



(F) compiler- generated information 
about the operands of the 
generated instruction. This 
includes names and relative 
locations of literals. Table 4 
refers to information in this 
column. 



(s) Cross-reference Dictionary : The cross 
reference dictionary is produced when 
the XREF option is specified. It 
consists of two parts: 

(S) The XREF dictionary for data-names 
consists of data-^names followed by 
the generated card number of the 
statement which defines each 
data-name, and the generated card 
number of statements where each 
data-name is referenced. 



Table U. Symbols Used in the Listing and 


Glossary to Define 


Compiler-Generated Information 


r T ~ " .— — — — — — ■- 1 


1 Symbol 


Meaning 1 | 


j ^ j 


JDNM 


SOURCE DATA NAME | 


JSAV 


SAVE AREA CELL | 


JSWT 


SWITCH CELL | 


JTLY 


TALLY CELT, | 


|WC 


WORKING CELL | 


|TS 


TEMPORARY STORAGE CELL | 


|VLC 


VARIABLE LENGTH CELL | 


JSBL 


SECONDARY BASE LOCATOR | 


|BL 


BASE LOCATOR . j 


IBLL 


BASE LOCATOR FOR LINKAGE \ 




SECTION I 


|0N 


ON COUNTER | 


JPFM 


PERFORM COUNTER | 


|PSV 


PERFORM SAVE | 


JVN 


VARIABLE PROCEDURE NAME | 


|SBS 


SUBSCRIPT ADDRESS j 


jxsw 


EXHIBIT SWITCH | 


JXSA 


EXHIBIT SAVE AREA | 


JPRM 


PARAMETER | 


|PN 


SOURCE PROCEDURE NAME | 


|GN 


GENERATED PROCEDURE NAME j 


|DTF 


DTF ADDRESS j 


jVN 


VARIABLE NAME INITIALIZATION | 


|LIT 


LITERAL 1 


|TS2 


TEMPORARY STORAGE j 




(NON-ARITHMETIC) \ 


|RSV 


REPORT SAVE AREA j 


ITS 3 


TEMPORARY STORAGE j 




(SYNCHRONIZATION) j 


|TSU 


TEMPORARY STORAGE | 




(SYNCHRONIZATION) j 


|INX 


INDEX CELL j 


IV(BCDNAME) 


VIRTUAL 1 


JVIR 


VIRTUAL I 


L _ 


L_.. : J 



® 



® 



The XREF dictionary for 
procedure-names consists of the 
procedure-names followed by the 
generated card number of the 
statement where each 
procedure-name is used as a 
section-name or paragraph-name, 
and the generated card number of 
statements where each 
procedure- name is referenced. 



The names appear in the order in which 
they appear in the source program. 
The nimiber of references appearing in 
the cross-reference dictionary for a 
given name is based upon the number of 
times the name is referenced in the 
code generated by the compiler. 

Diagnostic messages : The diagnostic 
messages associated with the 
compilation are always listed. The 
format of the diagnostic message is : 

(a) Compiler-generated card number. 
This is the ntamber of a line in 
the source program related to the 
error. 



® 



© 



Message identification. The 
message identification for the 
Disk Operating System American 
National Standard COBOL compiler 
always begins with the symbols 
ILA. 

The severity level. There are 
four severity levels as follows: 

(W) Warning 

This level indicates that an 
error was made in the source 
program. However, it is not 
serious enough to interfere 
with the execution of the 
program. These warning 
messages are listed only if 
the FLAGW option is specified 
in the CBL card or chosen at 
system generation time. 

(C) Conditional 

This level indicates that an 
error was made but the 
compiler usually makes a 



74 



( ) 



corrective assiamption. The 
statement containing the error 
is retained. Execution can be 
attempted. 

(E) Error 

This level indicates that a 
serious error was made. 
Usually the compiler makes no 
corrective assumption. The 
statement or operand 
containing the error is 
dropped. Compilation is 
completed, but execution of 
the program should not be 
attempted. 

(D) Disaster 

This error indicates that a 
serious error was made. 
Compilation is not completed. 
Results are unpredictable. 

(S) The message text. The text 

identifies the condition that 
caused the error and indicates the 
action taken by the compiler. 

Since Report Writer generates a 
number of internal data items and 
procedural statements, some errdr 
messages may reflect internal 
names. In cases where the error 
occurs mainly in these generated 
routines, the error messages may 
indicate the. card number of the RD 
entry for the report under 
consideration. In addition, there 
are errors that may indicate the 
n\imber of the card upon which the 
statement containing the error 
ends rather than the card upon 
which the error occ\ars. Internal 
name formats for Report Writer are 
discussed under "Glossary" 
(heading U, item C). 

" Appendix F: Diagnostic Messages" 
gives a complete list of compiler 
diagnostic messages. 



OBJECT MODULE 



The object modiile contains the external 
symbol dictionary, the text of the program. 



and the relocation dictionary. It is 
followed by an END statement that marks the 
end of the module. For additional 
information about the external symbol 
dictionary and the relocation dictionary, 
see the publication IBM System/360 Disk 
Operating System; System Control and 
System Service Programs. 



An object deck is punched if the DECK 
option is specified, unless SUPMAP option 
was specified cind an E-level diagnostic 
message was generated. The object module 
is written on SYSLNK if the LINK option is 
specified, unless SUPMAP was specified and 
an E-level diagnostic message is generated. 



LINKAGE EDITOR OUTPUT 



The output of the linkage edit step may 
include : 

• A printed listing of the job control 
statements 

• A map of the phase after it has been 
processed by the Linkage Editor 

• Diagnostic messages 

• A listing of the linkage editor control 
statements 

• A phase which may be assigned to the 
core image library 

Any diagnostic messages associated with 
the Linkage Editor are automatically 
g^^nerated as output. The other forms of 
output may be requested by the OPTION 
control statement. All output to be listed 
is printed on the device assigned to 
SYSLST. 

Figure 12 is an example of a linkage 
editor output listing. It shows the job 
control statements and the phase map. The 
different types of output are nimibered and 
each type to be explained is lettered. The 
text following the figure is an explanation 
of the figtire. 



r 



Interpreting Output 75 



ENTRY 
// EXEC LNKEDT 



}® 



JOB S/iMPLE 

ACTICN TAKEN MAP 

LIST PHASE TESTt* 

LIST AUTOLINK IJFFBZZN 

LIST AUTCLJNK ILBDDSPO 

LIST INCLUDE IJJCPDl 

LIST AUTOLINK ILBDIMLO 

LIST AUTOLINK ILBDMNSO 

LIST AUTOLINK ILBDSAEO 

LIST ENTRY 



DISK LINKAGE EDITOR DIAGNOSTIC OF INPUT 



® ® © © 
PHASE XFR-AD LOCOPE HICORE 



TEST 



® 


® 


© 


® 


@ 


DSK-AD 


ESD TYPE 


LABEL 


LOADED 


REL-FR 


50 07 2 


CSECT 


TESTRUN 


003000 


003000 




CSECT 


IJFFBZZN 


0039C0 


0G39C0 




* ENTRY 


IJFFZZZN 


0039C0 






* ENTRY 


IJFFBZZZ 


0C39C0 






* ENTRY 


IJFFZZZZ 


0039C0 






CSECT 


ILBDSAEO 


0047D8 


0047 D8 




ENTRY 


ILBDSAEl 


0047F8 





CSECT 

CSECT 

* ENTRY 

* ENTRY 



® 



ILBDMNSO 0047D0 

ILBDDSPO 003F90 

ILBDCSPl 0044E0 

ILBDDSP2 004578 



* ENTRY ILBDDSP3 004730 

CSECT ILBDIMLO 004768 

CSECT IJJCPDl 003DC8 

ENTRY IJJCPDIN 003DC8 

* ENTRY IJJCPD3 003DC8 



0047D0 
003F90 

0C4768 
003DC8 



Figure 12. Linkage Editor Output 



"^ 



76 



© 



© 



r 



© 



The job controls statements . These 
statements are listed since the LOG 
option is specified. 

Disk linkage editor diagnostic message 
of input . The ACTION statement is not 
required. If the MAP option is 
specified, SYSLST must be assigned. 
If the statement is not used and 
SYSLST is assigned, MAP is assumed and 
a map of main storage and any error 
diagnostic messages are considered 
output on SYSLST. 

Map of main storage . A phase map is 
printed when MAP is specified (or 
ass\3med) during linkage editor 
processing. The following infoimation 
is contained in the map of main 
storage : 

(A) The name of each phase. This is 
the name specified in the phase 
statement. 

(b) The transfer address of each 
phase. 

(C) The lowest main storage location 
of each phase. 

(d) The highest main storage location 
of each phase. 

(E) The hexadecimal disk address where 
the phase begins in the core image 
library. 

(F) The names of all CSECT's belonging 
to a phase. 

(^ All defined entry points within a 
CSECT. If an entry point is not 
referenced, it is flagged with an 
asterisk (*). 

(h) The address where each CSECT is 
loaded. 

(j) The relocation factor of each 
CSECT. 



comments on the Phas.e Map 



The severity of linkage editor 
diagnostic messages may affect the 
production of the phase map. Since various 
processing options affect the structure of 



the phase, the text of the phase map will 
sometimes provide additional information. 
For example, the phase may contain an 
overlay structure. In this case, a map 
will be listed for each segment in the 
overlay structure. 



Linkage Editor Messages 



The Linkage Editor may generate 
informative or diagnostic messages. A 
complete list of these messages is included 
in the publication IBM System/360 Disk 
Operating System: System Control and 
System Service Progrcims . 



COBOL PHASE EXECUTION OUTPUT 



The output generated by program 
execution (in addition to data written on 
output files) may include: 

» Data displayed on the console or on the 
printer 

• Messages to the operator 

• System informative messages 

• System diagnostic messages 

• A system dtamp 

A dump and system diagnostic messages 
are generated automatically during program 
execution only if the program contains 
errors that cause abnormal termination. 

Figure 13 is an example of otitput from 
the execution job step. The following text 
is an explanation of the illustration. 

(l) Job control statements. These 

statements are listed becaiise the LOG 
option is specified. 

(?) Program output on printer . The 

results of execution of the TRACE and 
EXHIBIT NAMED statements appear on the 
program listing. 

(3) Console output . Data is printed on 
the console as a result of the 
execution of DISPLAY UPON CONSOLE. 



Interpreting Output 77 



// ASSGN SYS008,X'282' . ^-^ 

// TLBL SYS008, 'TAPEFILE', 69/365, ,0001, 0001 /CD 
//. EXEC 



6if 

68 

73 

76 

77 

WORK-RECORD = ACOOOl NYC Z 

76 

77 

WORK-RECORD = BC0002 NYC 1 

76 

77 

WORK-RECORD = CC0003 NYC 2 

76 

77 

WORK-RECORD = DCOOO't NYC 3 

76 

77 

WORK-RECORD = EC0005 NYC k 

76 

77 

WORK-RECORD = FC0006 NYC Z 

76 

77 

WORK-RECORD = GC0007 NYC 1 

76 

77 

WORK-RECORD = HC0008 NYC 2 



© 



BG // JOB SAMPLE 

00.'t7.1'» 
BG I 

imOA NO VOLl LBL FOUND 
BG mill 
BG ACOOOl NYC 
BG BC0002 NYC 1 
BG CC0003 NYC 2 
BG 000001+ NYC 3 
BG EC0005 NYC 4 
BG FC0006 NYC 
BG GC0007 NYC 1 
BG HC0008 NYC 2 
BG IC0009 NYC 3 
BG OCOOIO NYC «♦ 
BG KCOOll NYC 
BG LC0012 NYC 1 
BG MC0013 NYC 2 
BG NCOOltf NYC 3 
BG OC0015 NYC 4 
BG PC0016 NYC 
BG QC0017 NYC 1 
BG RC0018 NYC 2 
BG SC0019 NYC 
BG TC0020 NYC 
BG UC0021 NYC 
BG VC0022 NYC 



TLBL= 



SYS008 SYS008=282 







BG WC0023 NYC 
BG XC002't NYC 
BG YC0025 NYC 
BG ZC0026 NYC 



BG 000101 69171 



Figure 13. Output from Execution Job Steps 



OPERATOR MESSAGES 



The COBOL phase may issue operator 
messages. In the message, XX denotes a 
system-generated 2- character numeric field 
that is used to identify the program 
issuing the message. 



Operator Response ; Follows the 
instructions given both by the message and 
on the job request form supplied by the 
programmer. If the job is to be resumed, 
hit end-of-block. 



STOP Statement 



The following message is generated by 
the STOP statement with the literal option; 



ACCEPT Statement 



The following message is generated by an 
ACCEPT statement with the FROM CONSOLE 
option: 



XX ClllA "AWAITING REPLY" 



I XX CllOA STOP 'literal* 



Explanation ; This message is issued at the 
programmer's discretion to indicate 
possible alternative action to be taken by 
the operator. 



Explanation ; This message is issued by the 
object program when operator intervention 
is required. 



Operator Response ; Enter the reply and hit 
end-of-block. To send message, hit 
end-of-block again. (The contents of the 
text field shoiild be supplied by the 
programmer on the job request f oim. ) 



78 



o 



SYSTEM OUTPUT 



Informative and diagnostic messages may 
appear in the listing diiring the execution 
of the object program. 

Each of these messages contains an 
identification code in the first column of 
the message to indicate the portion of the 
operating system that generated the 
message. Table 5 lists these codes, 
together with identification for each. 



Table 5. System Message Identification 
Codes 



I T- 

I Code I 



H- 



l- 



Identification 



An on-line console message from 
the Supervisor 



A message from the Job Control 
Processor 



A message from the Linkage Editor 



A message from the Librarian 



A message from LIOCS 



A message from the Sort program 



A message from COBOL object time 
subroutines 






Interpreting Output 79 



r 



CALLING AND CALLED PROGRAMS 



c 



O 



This chapter- describes the accepted 
linkage conventions for calling and called 
programs and discusses linkage methods when 
iising an assembler language program. In 
addition, this chapter contains a 
description of the overlay facility which 
enables different called programs to occupy 
the same area in main storage at different 
times. It also contains a suggested 
assembler language program to be used in 
conjiinction with the overlay feature. 



A COBOL source program that passes 
control to another program is a calling 
program . The program that receives control 
from the calling program is referred to as 
a called program . Both programs must be 
compiled (or assembled) in separate job 
steps, but the resulting object modules 
must be linkage edited together in the same 
phase. 



A called program can also be a calling 
progrcim; that is, a called program can, in 
turn, call another program. In Fig\ire 14 
for instance, program A calls program B; 
program B calls program C. Therefore: 

1. A is considered a calling program by B 

2. B is considered a called program by A 

3. B is considered a calling program by C 
U. c is considered a called program by B 



B 



[Calling 
I program 
lof B 



>| 



r ^ 

I Called 

I program 

I of A 






I Calling 
I program 
I of C 

L 



> 1 



j Called 
I program 
|of B 



J 



Figure 14. Calling and Called Programs 

By convention, a called program may call 
to an entry point in any other program, 
except one on a higher level in the ''path" 
of that program. That is, A may call to an 
entry point in B or C, and B may call C; 
however, C should not call A or B. 
Instead, c transfers control only to B by 
issuing the EXIT PROGRAM or GOBACK 
statements in COBOL (or its equivalent in 
another language) . B then retuims to A. 



Compiler generated switches, e.g., ON 
and ALTER, are not reinitialized upon each 
entrance to the called program, that is, 
the program is in its last executed state. 



LINKAGE 



Whenever a program calls another 
program, linkage must be established 
between the two. The calling program must 
state the entry point of the called program 
and must specify any argtiments to be 
passed. The called program must have an 
entry point and must be able to accept the 
arguments. Further, the called program 
must establish the linkage for the return 
of control to the calling program. 



LINKAGE IN A CALLING PROGRAM 



A calling COBOL program must contain the 
following statement at the point where 
another program is to be called: 



JCALL literal-1 [ USING identifier-1 
1 [identif ier-2 ] . . . ] 



literal-1 

is the name specified as the 
program-name in the PROGRAM-ID 
paragraph of the called program, or 
the name of the entry point in the 
called program. When the called 
program is to be entered at the 
beginning of the Procedure Division, 
literal-1 is the name of the program 
being called. When the called program 
is to be entered at some point other 
than the beginning of the Procedure 
Division, literal-1 should not be the 
same as the name specified in the 
PROGRAM- ID paragraph of the called 
program. Since the program-name in 
the PROGRAM-ID paragraph produces an 
external reference defining an entry 
point, this entry point name would not 
be uniquely defined as an external 
reference. 

identifier-1 [identif ier-2] .- . 

are the argtaments being passed to the 
called program. Each identifier 
represents a data item defined in the 
Linkage Section of the called program 



Calling and Called Programs 81 



and must contain a level niomber 01 or 
77. If the called program is an 
assembler language program, the 
arguments may represent file-names and 
procedure- names. If no arguments are 
to be passed, the USING option is 
omitted. 



r n 

I EXIT PROGRAM. | 

j. ^ 

I GOBACK. I 

L J 

Both the EXIT PROGRAM and GOBACK 
statements cause the restoration of 
the necessary registers, and return 
control to the point in the calling 
program immediately following the 
calling sequence. 



V. 



LINKAGE IN A CALLED PROGRAM 



A called COBOL program must contain two 
sets of statements: 



1. 



One of the following statements must 
appear at the point where the program 
is entered. 

If the called program is entered at 
the first instruction in the Procedure 
Division and arguments are passed by 
the calling program: 



i PROCEDURE DIVISION [ USING ] 

I identifier-1 [ identifier- 2 ]... ]. 

L J 

If the entry point of the called 
program is not the first statement of 
the Procedure Division: 



j ENTRY literal-1 [ USING identifier-1 j 
[identifier- 2] ••; ] 



2. 



literal-1 

is the name of the entry point in 
the called program. It is the 
same name that appears in the 
CALL statement of the program 
that calls this program. 
literal-1 must not be the name of 
any other entry point or 
program-name in the run unit. 

identifier-1 [ identifier- 2]. . • ] 

are the data items representing 
parameters. They correspond to 
the argumeiits of the CALL 
statement of the calling program. 
Each data item in this parameter 
list must be defined in the 
Linkage Section of the called 
program and must contain a level 
number of 01 or 77. 

Either of the following statements 
must be inserted where control is to 
be returned to the calling program. 



ENTRY POINTS 



Each time an entry point is specified in 
a called program, an external - name is 
defined. An external-name is a name that 
can be referenced by another program that 
has been separately compiled or assembled. 
Each time an entry name is specified in a 
calling program, an external reference is 
defined. An external reference is a symbol 
that is defined as an external-name in 
another separately compiled or assembled 
program. The Linkage Editor resolves 
external-names and external references, and 
combines calling and called programs into a 
format suitable for execution together, 
i.e., as a single phase. 

Note ; Several different entry points may 
be defined in one COBOL source module. 
Different CALL statements in any module of 
the phase may specify the same entry point, 
but each definition of an entry point must 
be unique in the same phase. 



CORRESPONDENCE OF ARGUMENTS AND PARAMETERS 



The number of identifiers in the 
parameter list of the called program must 
be the same as the number of identifiers in 
the arg\3ment list of the calling program. 
There is a one- for- one correspondence. The 
correspondence is positional and not by 
name. An identifier must not appear more 
than once in the same USING claiase. 

Only the address of an argument is 
passed. Consequently, both the identifier 
that is an argument and the identifier that 
is the corresponding parameter refer to the 
same location in main storage. The pair of 
identifiers need not be identical, but the 
data descriptions must be equivalent. For 
example, if an argument is a level-77 
data- name representing a 30-character 
string, its corresponding parameter could 
also be a level-77 data-name representing a 
character string of length 30, or the 
parameter could be a level- 01 data item 



82 



with subordinate items representing 
character strings whose combined length is 
30. 



Although all parameters in the ENTRY 
statement must be described with level 
numbers 01 or 77, there is no such 
restriction made for arguments in the CALL 
statement. An argument may be a qualified 
name or a subscripted name. When a group 
item with a level number other than 01 is 
specified as an argument, proper bo\mdary 
word alignment is required if subordinate 
items are described as COMPUTATIONAL, 
COMPUTATIONAL-1, or COMPUTATIONAL- 2. If 
the argument corresponds to an 01- level 
parameter, doiableword alignment is 
required. 



// JOB NOVERLAY 

// OPTION LINK, LIST, DUMP 

ACTION MAP 

PHASE EXAMPl,* 

INCLUDE 



/* 



{object module COBMAIN} 





INCLUDE SUBPRGB 




INCLUDE SUBPRGC 




INCLUDE SUBPRGD 




INCLUDE 




{object module SUBPRGA} 


/* 






ENTRY 


// 


EXEC LNKEDT 


// 


EXEC 




{data for program} 


/* 




/£ 





LINKAGE EDITING WITHOUT OVERLAY 



Figure 15 is an example of the data flow 
logic of this call structure where all the 
programs fit into main storage. 



Assume that a COBOL main program 
(COBMAIN) , at one or more points in its 
logic executes CALL statements to COBOL 
programs SUBPRGA, SUBPRGB, SUBPRGC, and 
SUBPRGD. Also asstime that the module sizes 
for the main program and svibprograms are: 



SYSIPT 



Program 
COBMAIN 
SUBPRGA 
SUBPRGB 
SUBPRGC 
SUBPRGD 



Module Size 

(in bytes) 

20,000 

4,000 

5,000 

6, 000 

3,000 



Through the linkage mechanism, all 
called programs plus COBMAIN must be 
linkage edited together to form one module 
of 38,000 bytes. Therefore, COBMAIN would 
require 38, 000 bytes of storage in order to 
be executed. No overlay structure need be 
specified at linkage edit time if 38,000 
bytes of core storage are available. 



The following is an example of the job 
control statements needed to linkage edit 
these calling and called programs without 
specifying an overlay structure. The 
source decks for COBMAIN and SUBPRGA are 
included in the job deck, whereas SUBPRGB, 
SUBPRGC, and SUBPRGD are in the relocatable 
library. 



Main Program 






SUBPRG B 






SUBPRG C 





SUBPRG D 



Execute 
LNKEDT 



SUBPRG A 



Job Control 



Linkage 
Editor 





Storage 
Layout 



Figiure 15. Example of Data Flow Logic in a 
Call Structxare 



Note: For the example given, it is assumed 
that SYSLNK is a standard assignment. The 
flow diagram illustrates how the various 



Calling and Called Programs 83 



program segments are linkage edited into 
storage in a sequential arrangement. 



Table 6. 



Conventional Use of Linkage 
Registers 



ASSEMBLER LANGUAGE SUBPROGRAMS 



A main program written in COBOL can call 
programs written in other languages that 
use the same linkage conventions. Whenever 
a COBOL program calls an assembler language 
program, certain conventions and techniques 
m\ist be used. 

There are three basic ways to use 
assembler-written called programs with a 
main program written in COBOL: 

1. A COBOL main program or called program 
calling an assembler-writtem program. 

2. An assembler-written program calling a 
COBOL program. 

3. An assembler-written program calling 
another assembler-written program. 

From these combinations, more 
complicated structures can be formed. 

In a COBOL program, the expansions of 
the CALL and GOBACK or EXIT PROGRAM 
statements provide the save and return 
coding that is necessary to establish 
linkage between the calling and called 
programs in accordance with the linkage 
conventions of the system. Assembler 
language programs must be prepared in 
accordance with the same linkage 
conventions. These conventions include: 

1. Using the proper registers to 
establish linkage. 

2. Researving, in the calling program, a 
storage area for items contained in 
the argument list. This storage area 
can be referenced by the called 
program. 

3. Reserving, in the calling program, a 
save area in which the contents of the 
registers can be saved. 



Reg. 
No. 



13 



14 



— + 



I 

15 



Reg. 
Name 



Argument 

list 

register 



-+- 



Save 
area 



register 



+ 

Return 
register 



Entry 
point 
register 



Function 



Address of the argument 
list passed to the called 
program. 



Address of the area re- 
served by the calling pro- 
gram in which the contents 
of certain registers are 
stored by the called 
program. 



Address of the location in 
the calling program to 
which control is returned 
after execution of the 
called program. 



Address of the entry point 
in the called program. 



SAVE AREA 



A calling assembler language program 
must reserve a save area of 18 words, 
beginning on a fullword boundary, to be 
used by the called program for saving 
registers; it must load the address of this 
area into register 13. Table 7 shows the 
layout of the save area and the contents of 
each word. 



A called COBOL program does not save 
floating-point registers. The programmer 
is responsible for saving and restoring the 
contents of these registers in the calling 
program. 



REGISTER USE 



ARGUMENT LIST 



The Disk Operating System has assigned 
functions to certain registers used in 
linkages. Table 6 shows the conventions 
for using general registers as linkage 
registers. The calling program must load 
the address of the return point into 
register lU, and it must load the address 
of the entry point of the called program 
into register 15. 



The argiiment list is a group of 
contiguous fullwords, beginning on a 
fullword boundary, each of which is an 
address of a data item to be passed to the 
called program. If the program is to pass 
arguments, an argument list must be 
prepared and its address loaded into 
register 1. The high- order bit of the last 
arg\iment, by convention, is set to 1 to 
indicate the end of the list. 



8U 



Table 7. 

AREA 
(word 1) 



Save Area Layout and Word 
Contents 



AREA+4 
(word 2) 



AREA+8 
(word 3) 



AREA+12 
(word 4) 

2mEA+16 
(word 15) 

AREA+20 
(word 6) 

AREA+24 
(word 7) 



AREA+68 
(word 18) 



This word is a part of the 
standard linkage convention 
established \ander the Disk 
Operating System. The word 
miist be reserved for proper 
addressing of the subsequent 
entr i e s • Howe ve r , an 
assembler subprogram may use 
the word for any desired 
purpose. 

The address of the previous 
save area, that is, the save 
area of the subprogram that 
called this one. 

The address of the next save 
area, that is, the save area 
of the subprogram to which 
this subprogram refers. 



The contents of register lU, 
that is, the return address. 

The contents of register 15, 
that is, the entiy address. 



The contents of register 0. 



The contents of register 1. 



-^ 



I 

The contents of register 12. 



J 



Any assembler- written program must be 
coded with a detailed knowledge of the data 
formats of the arguments being passed. 
Most coding errors occur because of the 
data format discrepancies of the arguments. 



If one programmer writes both the 
calling program and the called program, the 
data format of the arguments should not 
present a problem when passed as 
parameters. However, when the programs are 
written by different programmers, the data 
format specifications for the arg\iments 
must be clearly defined for the user. 



The linkage conventions used by an 
assembler program that calls another 
program are illustrated in Figrure 16. The 
linkage should include: 



1. The calling sequence. 

2. The save and return routines. 

3. The out-of-line parameter list. (An 
in-line parameter list may be used. ) 

U. A save area on a fullword boundary. 



In-Line Parameter List 



The assembler programmer may establish 
an in-line parameter list instead of an 
out-of-line list. In this case, he may 
substitute the calling sequence and 
parameter list illustrated in Figure 17 for 
that shown in Figure 16. 



Calling and Called Programs 85 



/^ 



deckname START 

♦ 

ENTRY 
EXTRN 
USING 

♦ SAVE ROUTINE 

namGi STM 

* 

LR 

DROP 
USING 
LR 

* 

LA 



ST 



ST 



BC 
DS 



namea. 
name 2 
namei,15 

lU,ri, 12(13) 



r3,15 
15 

namCi, ra 
r2,13 



13, AREA 
13,8(r2) 

r2f'*(13) 



15,probi 
18F 



INITIATES PROGRAM ASSEMBLAGE AT FIRST 
AVAILT^LE LOCATION. ENTRY POINT TO THE 
PROGRAM. 



THE CONTENTS OF REGISTERS 14, 15, AND 

THROUGH ri ARE STORED IN THE SAVE 

AREA OF THE CALLING PROGRAM (PREVIOUS 

SAVE AREA), r^. IS ANY NUMBER FROM THROUGH 12. 



WHERE ra AND ra HAVE BEEN SAVED 

LOADS REGISTER 13, WHICH POINTS TO THE 

SAVE AREA OF THE CALLING PROGRAM, INTO 

ANY GENERAL REGISTER, Ta, EXCEPT AND 13. 

LOADS THE ADDRESS OF THIS PROGRAM'S 

SAVE AREA INTO REGISTER 13. 

STORES THE ADDRESS OF THIS PROGRAM'S SAVE 

AREA INTO WORD 3 OF THE SAVE AREA OF THE 

CALLING PROGRAM. 

STORES THE ADDRESS OF THE PREVIOUS SAVE 

AREA (I.E., THE SAME AREA OF THE CALLING 

PROGRAM) INTO WORD 2 OF THIS PROGRAM'S 

SAVE AREA. 



LM 



AREA DS 18F RESERVES 18 WORDS FOR THE SAVE AREA 

* THIS IS LAST STATEMENT OF SAVE ROUTINE, 
probi {User-written program statements} 

* CALLING SEQUENCE 

LA 1,ARGLST 

L 15,ADC0N 

BALR 14,15 

{Remainder of user-written program statements} 

* RETURN ROUTINE 

LOADS THE 2U)DRESS OF THE PREVIOUS SAVE 
AREA BACK INTO REGISTER 13. 
THE CONTENTS OF REGISTER 2 THROUGH rj. ARE 
RESTORED FROM THE PREVIOUS SAVE AREA. 
LOADS THE RETURN ADDRESS, WHICH IS IN 
WORD 4 OF THE CALLING PROGRAM'S SAVE AREA, 
INTO REGISTER 14. 

SETS FLAG FF IN THE SAVE AREA OF THE 
CALLING PROGRAM TO INDICATE THAT CONTROL 
HAS RETURNED TO THE CALLING PROGRAM. 
LAST STATEMENT IN RETURN ROUTINE 
CONTAINS THE ADDRESS OF SUBPROGRAM namea. 

FIRST STATEMENT IN PARAMETER AREA SETUP 

FIRST BYTE OF LAST ARGUMENT SETS BIT TO 
LAST STATEMENT IN PARAMETER AREA SETUP 



13,4(13) 
2, ri, 28(13) 
14,12(13) 



* 




♦ 




MVI 


12(13), X' 


* 




* 




BCR 


15,14 


ADCON DC 


A (namea) 


* PARAMETER LIST 


ARGLST DC 


AL4(argi) 


DC 


AL4(arg2) 


DC 


X'80' 


DC 


AL3(argn) 



Figure 16. Sample Linkage Routines Used with a Calling Subprogram 



86 



L 



ADCON 



RETURN 



DC 



LA 

L 

CNOP 

BALR 

DC 

DC 



DC 
DC 
EQU 



A(probi) 



lU, RETURN 

15, ADCON 

2,4 

1,15 

ALUCargi) 

Amtarga) 



X»80« 
AL3(argn) 



Figure 17. Sample In-line Parameter List 



OVERLAYS 



If a program is too large to be 
contained in the niimber of bytes available 
in main storage, it can still be executed 
by means of an overlay structure . 7^ 
overlay structure permits the re-use of 
storage locations previously occupied by 
another program. In order to use an 
overlay structure, the programmer must plan 
his program so that one or more called 
programs need not be in main storage at the 
same time as the rest of the program phase. 



The following is a diagram of the basic 
form of a program to be overlaid: 



LOWEST LEVEL PROGRAM 



ROOT PHASE 



/:' 



If an assembler called program does not 
call any other program (i.e., if it is at 
the lowest level), the programmer should 
omit the save routine, calling sequence, 
and parameter list shown in Figxire 16. If 
the assembler called program uses any 
registers, it must save them. Figure 18 
illustrates the appropriate linkage 
conventions used by an assembler program at 
the lowest level. 



SUBA 



SUBB 



The root phase consists of the COBOL 
main program and an assembler language 
subroutine which handles the overlay 
structures. SUBA and SUBB are the called 
programs that are to be overlaid in core 
storage. 



deckname 



name 



START 
ENTRY 




name 



USING *,15 

STM 14, ri, 12(13) 



User-written program statements 



In using the overlay technique, the 
programmer specifies to the Linkage Editor 
which programs are to overlay each other. 
These programs are processed by the Linkage 
Editor so they can be placed automatically 
in main storage for execution when called 
by the main program. The resulting output 
of the Linkage Editor is called an overlay 
structure. 



LM 2, ri, 28(13) 
MVI 12(13), X'FF* 
BCR 15,14 



I ^ 

I Note ; If registers 13 and/or 14 are used] 
in the called subprogram, their contents 

[should be saved and restored by the 
called subprogram. 

Figure 18. Sample LinJcage Routines Used 

with a Lowest Level Subprogram 



SPECIAL CONSIDERATIONS WHEN USING OVERLAY 
STRUCTURES 



There are three areas of special concern 
to the programmer who decides to rise the 
overlay feature. These problems concern 
the use of the assembler language 
subroutine, proper linkage editing, and job 
control statements. 



Calling and Called Programs 87 



ASSEMBLER LANGUAGE SUBROUTINE FOR 
ACCOMPLISHING OVERLAY 



The CALL statement is used for "direct" 
linkage; that is, the assistance of the 
Supervisor is not required (as it is when 
loading or fetching a phase). There are no 
_ COBOL statemen ts that will generate the 
equivalent of the LOAD or FETCH assembler 
macro instructions^ For this reason, one 
must call an assembler program to effect an 
overlay of a COBOL program. This routine 
must be linkage edited as part of either a 
root phase or permanently resident phase. 

The sample overlay siibroutine shown in 
Figure 19 is governed by the following 
restrictions : 



1. The example is a suggested technique, 
and is not the only technique. 

2. It can be used for assembler overlays 
if the user has a desired entry point 

"in his END card and the first 
statement at that entry point is 'STM 
14,12,12(13)' (90ECD00C). 

3. The subroutine cannot be used for 
entry points other than at the first 
instruction of the Procedtire Division. 
A suggested technique for diverse 
entry points is a table look-up using 
V-type constants. 

Note: Care should be taken with the 
techniques used in statements 0019 and 
0020. Only when the COBOL program is 



STMNT 

0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0020 
0021 
0022 
0023 
0024 
0025 
0026 
0027 
0028 
0029 
0030 
0031 
0032 
0033 
0034 
0035 
0036 
0037 
0038 
0039 
0040 
0041 
0042 



SOURCE STATEMENT 



OVERLAY START 

ENTRY OVRLAY 

* AT ENTRY TIME 

* Rl^POINTER TO ADCON LIST OF USING TEGUMENTS 

* FIRST ARGUMENT IS PHASE OR SUBROUTINE NAME 

* MUST BE 8 BYTES 

* R13=ADDRESS OF SAVE AREA 

* R14=RETURN POINT OF CALLING PROGRAM 

* R15=ENTRY POINT OF OVERLAY PROGRAM 

* AT EXIT 

* R1=P0INTER TO SECOND ARGUMENT OF ADCON LIST 

* OF USING ARGUMENTS 

* R14=RETURN POINT OF CALLING PROGRAM — NOT THIS PROG 

* R15=ENTRY POINT OF PHASE OR SUBPROGRAM 



ENTRY 



SUBIN 



ASUB 
CORSUB 
STMINS 
HWTWC 



USING *,15 
STM 0,1,20(13) 
L 1,0(1) 
CLC 0(8,1), CORSUB 
BE SUBIN 
MVC CORSUB (8), 0(1) 
SR 0,0 

LOAD REQUIRES R0=0 IF LOAD ISN'T SPECIFIED, 
R1=ADDRESS OF PHASE ENTRY 
UPON RETURN 



SAVE REG AND 1 

R1=ADDRESS OF PHASE NAME 

IS IT IN CORE 

YES 

NO,CORSUB=PHASE NAME 

R0=0 



SVC 
SH 
LA 
CLC 
BNE 
ST 
LM 
LA 
L 
BR 
DS 
DC 
-DC 
DC 
END 



1,HWTW0 

1,2(1) 

0(4,1), STMINS 

ENTRY 

1,ASUB 

0,1,20(13) 

1,4(1) 

15, ASUB 

15 

IF 

8X'FF' 

X*90ECD00C' 

H»2« 



LOAD PHASE 

STEP SEARCH POINTER 

IS THIS THE ENTRY POINT 

NO, LOOP BACK 

YES, SAVE IT 

RESTORE REGO AND 1 

STEP PAST PHASE NAME ADCON 

LOAD ENTRY POINT ADDRESS 



Figure 19. Example of an Assembler Language Subroutine for Accomplishing Overlay 



88 



/^ -s 



loaded are altered GO TO statements 
reinitialized, A better technique would be 
to load the called programs each time they 
are required. 



If OVERLAYS were knovm to be in storage, 
the CALL statement would be; 



r 1 

I CALL "OVERLAYS" USING PARlUM-l, PARAM-2. | 



LINKAGE EDITING WITH OVERLAY 



But when using the assembler language 
overlay routine (OVRLAY) , it becomes : 






In a linkage editor job step, the 
programmer specifies the overlay points in 
a program by using PHASE statements. In 
the Working- Storage Section, a level- 77 
constant must be created for each phase to 
be called at execution time. These 
constants have a PICTURE of X(8) and a 
VALUE cla\ise containing the same name as 
that appearing on the PHASE card for that 
segment in the linkage edit run. 



In addition, each argument to be passed 
to the called program must have an entry in 
the Linkage Section. Remember, also, that 
the ENTRY statement should not refer to the 
program- name but rather to the 
paragraph-name in the Proced\ire Division 
where control is to be passed on entering 
the called program, (Use of the 
program-name will result in incorrect 
execution. ) 



When preparing the control cards for the 
Linkage Editor, the programmer should be 
certain to include the assembler language 
subroutine with the main (root) phase. 
Also, to achieve maximxam overlay, the phase 
names for the called programs should be 
different from the names of the called 
programs specified in the PROGRAM-ID 
paragraphs. 

Figure 20 is a flow diagram of the 
overlay logic. The PHASE cards indicate 
the beginning address of each phase. The 
phases OVERLAYC and OVERLAYD will have the 
same beginning address as OVERLAYS, The 
sequence of events is : . 

1, The main progreunft calls the overlay 
routine. 

2, The overlay routine fetches the 
particular COBOL subprogrcim and places 
it in the overlay area, 

3. The overlay routine transfers control 
to the first instruction of the called 
program. 

4. The called program returns to the 
COBOL calling program (not to the 
assembler language overlay routine) . 



CALL "OVRLAY" USING PROCESS-LABEL, 
PARM-1, PARM-2, 



where PROCESS-LABEL contains the 
external-name OVERLAYS of the called 
program. 



However, the ENTRY statement of the 
called program is the same for both cases, 
i,e, , ENTRY "OVERLAYS" USING PARAM-1, 
PARAM-2, whether it is called indirectly by 
the main program through the overlay 
program or called directly by the main 
program. 



Note: An ENTRY which is to be called by 
OVRLAY must precede the first executable 
statement in the called program. 




Figure 20. Flow Diagram of Overlay Logic 



Calling and Called Programs 89 



JOB CONTROL FOR ACCOMPLISHING OVERLAY 



The job control statements required to 
accomplish the overlay illustrated in 
Figure 20 are shown in Figure 21. The 
PHASE statements specify to the Linkage 
Editor that the overlay structure to be 
established is one in which the called 
programs OVERLAYS, OVERLAYC, and OVERLAYD 
overlay each other when called during 
execution. 

Note ; The phase name specified in the 
PHASE card must be the same as the value 
contained in the first argument for CALL 



"OVRLAY", i.e., PROCESS-IABEL, COMPUTE-TAX, 
etc., contain OVERLAYS, OVERLAYC, 
respectively, which are the names given in 
the PHASE card. 



It is the programmer's responsibility to 
write the entire overlay, i.e., the COBOL 
main (or calling) program and an assembler 
language siabroutine (for which a sample 
program is given in this chapter) that 
fetches and overlays the called programs. 
A calling sequence to obtain an overlay 
structure between three COBOL subprograms 
is illustrated in Figure 22. 



V.,.- 



// JOB OVERLAYS 
// OPTION LINK 

PHASE OVERLAY, ROOT 
// EXEC FCOBOL 

{COBOL Source for Main Program OVERLAY} 
/♦ 
// EXEC ASSEMBLY 

Source deck for Assembler Language Routine OVRLAY 
/♦ 

PHASE OVERLAYS,* 
// EXEC FCOBOL 

{COBOL Source for Called Program OVERLAYS} 
/♦ 

PHASE OVERLAYC, OVERLAYS 
// EXEC FCOBOL 

{COBOL Source for Called Program OVERLAYC} 
/* 

PHASE OVERLAYD, OVERLAYC 
{COBOL Source for Called Program OVERLAYD} 
/* 

// EXEC LNKEDT 
// EXEC 
/* 
/g 



Figure 21. Job Control for Accomplishing Overlay 



^. 



90 



r 



COBOL Program Main (Root or Main Program) 

IDENTIFICATION DIVISION. 
PROGRAM- ID. OVERLAY. 



ENVIRONMENT DIVISION. 



DATA DIVISION. 



WORKING-STORAGE SECTION. 

77 PROCESS-LABEL PICTURE IS X(8) VALUE IS "OVERLAYB". 

77 PARAM-1 PICTURE IS X. 

77 PARAM-2 PICTURE IS XX. 

77 COMPUTE-TAX PICTURE IS X(8) VZUiiUE IS "OVERLAYC". 

01 NAMET. 

02 EMPLY-NUMB PICTURE IS 9(5). 

02 SALARY PICTURE IS 9(4)V99. 

02 RATE PICTURE IS 9(3)V99. 

02 HOURS-REG PICTURE IS 9(3)V99. 

02 HOURS-OT PICTURE IS 9(2)V99. 
01 COMPUTE-SALARY PICTURE IS X(8) VALUE IS "OVERLAYD". 
01 NAMES. 

02 RATES PICTURE IS 9(6). 

02 HOURS PICTURE IS 9(3)V99. 

02 SALARYX PICTURE IS 9(2)V99. 



PROCEDURE DIVISION. 



CALL "OVRLAY" USING PROCESS-LABEL, PARAM-1, PARAM-2. 



CALL "OVRLAY" USING COMPUTE-TAX, NAMET. 



CALL "OVRLAY" USING COMPUTE- SALARY, NAMES. 






Figure 22. Calling Sequence to Obtain Overlay Between Three COBOL Subprograms 
(Part 1 of 3) 



Calling and Called Programs 91 



COBOL Sxibprogram S 

IDENTIFICATION DIVISION. 
PROGRAM- ID. OVERLAYl. 



ENVIRONMENT DIVISION. 



V . 



DATA DIVISION. 



LINKAGE SECTION. 

01 PARAM-10 PICTURE X. 
01 PARAM-20 PICTURE XX. 



PROCEDURE DIVISION. 

PARA-NAME. ENTRY "OVERLAYS" USING PARAMrlO, PARAM-20. 



GOBACK. 



COBOL Subprogram Q 

IDENTIFICATION DIVISION. 
PROGRAM- ID. 0VERLAY2. 



ENVIRONMENT DIVISION. 



DATA DIVISION. 



LINKAGE SECTION. 

01 NAMEX. 

02 EMPLY-NUMBX PICTURE IS 9(5). 
02 SALARYX PICTURE IS 9(4) V99. 
02 RATEX PICTURE IS 9(3)V99. 
02 HOURS-REGX PICTURE IS 9(3)V99. 
02 HOURS-OTX PICTURE IS 9(2)V99. 

PROCEDURE DIVISION. 

PARA-NAME. ENTRY "OVERLAYC" USING NAMEX. 



GOBACK. 



Figure 22, Calling Sequence to Obtain Overlay Between Three COBOL Subprograms 
(Part 2 of 3) 



92 



J 



f 



COBOL Siabproqram D 

IDENTIFICATION DIVISION. 
PROGRAM- ID. OVERLAYS. 



ENVIRONMENT DIVISION. 



DATA DIVISION. 



LINKAGE SECTION 
01 NAMES. 

02 RATES PICTURE IS 9(6). 

02 HOURS PICTURE IS 9(3)V99. 

02 SALARYX PICTURE IS 9(2)V99. 

PROCEDURE DIVISION. 

PARA-NAME. ENTRY "OVERLAYD" USING NAMES. 



GOBACK. 



Figure 22. Calling Sequence to Obtain Overlay Between Three COBOL Subprograms 
(Part 3 of 3) 



Calling and Called Progreuns 93 



r 



/-~-^ 



USING THE SORT FEATURE 



In order to use the Systein/360 Disk 
Operating System Sort/Merge program, Sort 
Feature statements are written in the COBOL 
source program. These statements are 
described in the publication IBM Svstem/360 
Disk Operating System; American National 
Standard COBOL . The Sort/Merge program 
itself is described in the publication IBM 
Svstem/360 Disk Operating System t Tape and 
Disk Sort/Merge , Form GC28-6676. "Appendix 
G: Machine Considerations" in this 
publication contains information about 
system requirements when the Sort Feature 
is used. 



ASSGN 

followed by 

VOL 
TPLAB 

or 

VOL 

DLAB 

XTENT 



Additional job control statements must 
be included in the execution step of the 
job to describe the files used by the sort 
program. These statements are described 
below in "Sort Job Control Requirements." 



or 



DLBL 
EXTENT 



or 



Note: The Checkpoint/Restart Feature can 
be activated diiring a sorting operation by 
specifying the RERUN statement. 



TLBL 



The symbolic \anit to which each sort 
input or output file is assigned in the 
source language ASSIGN clause is specified 
in an ASSGN control statement. 



SORT JOB CONTROL REQUIREMENTS 



Three types of files can be defined for 
the sort program in the execution job step: 
input, output, and work. 



SORT INPUT AND OUTPUT CONTROL STATEMENTS 



When the USING and/or GIVING options are 
specified, the compiler generates dummy 
Input and/or Output Procedures. Hence, the 
job control requirements for files named as 
operands of USING and GIVING are the same 
as those for files used as input to or 
output from the sorting operation in these 
procedures . 



The following job control statements are 
required for files used as input to or 
output from the sorting operation: 



Note : ASSGN control statements are 
required only if the input/output devices 
used in an application have not been 
previously assigned the appropriate 
symbolic names. 

If an input file contains standard 
labels, a TLBL or DLBL (or VOL and TPLAB or 
VOL and DLAB) statement (s) is required. 
The symbolic name of the device from which 
the input file is to be read must also be 
included on this statement. 

One EXTENT (XTENT) control statement is 
required to define the limits of each area 
of a mass storage device from which an 
input file will be read. EXTENT (XTENT) 
statements must include the symbolic \init 
name of the device containing the extent. 

If the output file is to use standard 
labels, a TI£L or DLBL (or VOL and TPLAB or 
VOL and DLAB) statement (s) is required. 

One EXTENT (XTENT) control statement 
must be used to define the limits of each 
area of a mass storage device onto which 
the output file is written. The symbolic 
name of the output unit must appear on this 
card. 



Using the Sort Feature 95 



SORT WORK FILE CONTROL STATEMENTS 



The Sort program requires at least one 
mass storage imit or three tape Tonits as an 
intermediate sort work file. The symbolic 
lanits to which this file is assigned must 
be consecutively numbered beginning with 
SYSOOl, Intermediate storage may be 
assigned on the following devices: 

o IBM 21100 Magnetic Tape Units 

• IBM 2311 Disk Storage Drive 

• IBM 2314 Direct- Access Storage Device 

Note: When variable- length or 
redefined-length records are being sorted, 
sort work files must not be assigned to 
7-track tapes. 7-track tape work files can 
only be used to sort records whose keys are 
packed decimal or binary. 

Device types may not be mixed; i.e., 
work units for a particular sort operation 
must all be of the same type. 

If spanned records are being sorted and 
mass storage devices are being used as sort 
work files, it is the user's responsibility 
to assign these work files to devices whose 
track sizes are larger than the logical 
record sizes of the records being sorted, 
A spanned record that is larger than the 
available track size can be sorted by 
assigning the work files to magnetic tape. . 



If a work unit is to use standard 
labels, a TLBL or DLBL (or VOL and TPIiAB or 
VOL and DLAB) control statement (s) is 
required. The filename entry on these 
statements must be SORTWKl through SORTWKn. 
The symbolic unit names assigned to the 
work areas to be allocated (SYSOOl, SYS002, 
etc. ) must appear on these cards. 



One EXTENT (XTENT) control statement 
must be included to define each work area 
on a mass storage device. The total work 
area required may be divided into as many 
as eight extents, which would require eight 
EXTENT (XTENT) control statements. 
Symbolic unit names on these statements 
must be in consecutive order, (SYSOOl, 
SYS002, etc.). 



Amount of Intermediate Storage Required 



When intermediate storage is assigned on 
a mass storage unit, at least twice the 
amount required to hold all input records 
should be assigned. This area may consist 



of from one to eight extents, and the 
extents may be assigned on no more than 
eight devices. 

If tape intermediate storage is used, at 
least the minumum number of units (three) 
must be assigned. The input file can be as 
large as the number of records that can be 
written on one. full reel of tape. 
Assigning more than three intermediate 
storage tape drives does not increase the 
maximum input file size, but does improve 
performance. 



Improving Performance 



Performance increases significantly if 
50K is available for execution of the Sort 
program. At the 10 OK level, the 
performance is very high. If no core is 
available, the Sort/Merge program will 
issue a message: 

7054A "INSUFFICIENT CORE" 



SORT DIAGNOSTIC MESSAGES 



The messages generated by the soirt 
Feature are listed in the publication IBM 
Svstem/360 Disk Operating System; Tape and 
Disk Sort/Merge , Form GC28-6676. 



LINKAGE WITH THE SORT FEATURE 



To initiate a sort operation, the COBOL 
object program includes the object time 
stabroutine ILBDSRTO and transfers control 
to it. 

If the INPUT PROCEDURE option of the 
SORT statement is specified in the source 
program, exit El 5 of the Sort/Merge program 
is used. At this exit, the record released 
by the user is passed to the Sort/Merge 
program. Since a dummy Input Procedure 
will be generated by the compiler when the 
USING option is specified, records in the 
USING file are also passed to the 
Sort/Merge program at exit El 5. 

If the OUTPUT PROCEDURE option of the 
SORT statement is specified, exit E35 of 
the Sort/Merge program is used. At this 
exit, the record returned by the Sort/Merge 
program is passed to the user. Since a 
dtomny Output Procedure is generated by the 
compiler when the GIVING option is 
specified, records are also returned at 
exit E35 and written on this file. 



96 



o 



completion Codes 



The Sort/Merge program retiims a 
completion code upon termination and this 
code is stored in the COBOL special 
register SORT-RETURN, The codes are: 



— Successful completion of 
Sort/Merge 



The user may test the SORT-RETURN 
register for successful termination of the 
sort operation, as shown in the following 
example : 



SORT SALES-RECORDS ON ASCENDING KEY, 
CUSTOMER-NUMBER, DESCENDING KEY DATE, 
USING FN-1, GIVING FN- 2. IF 
SORT-RETURN NOT EQUAL TO ZERO, DISPLAY 
"SORT UNSUCCESSFUL" UPON CONSOLE, STOP 
RUN. 



16 — Unsuccessful completion of 
Sort/Merge 



CHECKPOINT/RESTART DURING A SORT 






Successful Completion ; When a Sort/Merge 
application has been success fially executed, 
a completion code of zero is returned and 
the sort operation terminates. 



Unsuccessful Completion ; If the Sort 
program encounters an error during 
execution that will not allow it to 
complete successfully, it returns a 
completion code of 16 and terminates. (A 
possible error is an uncorrectable 
input/output error. ) The publication IBM 
Svstem/360 Disk Operating System; Tape and 
Disk Sort/Merge , Form GC28-6676 contains a 
detailed description of the conditions 
under which this termination will occur. 



The Checkpoint/Restart Featiare is 
available to the programmer using the COBOL 
SORT statement. The programmer uses the 
RERUN clause to specify that checkpoints 
should be taken during program execution. 
The control statement requirements for 
taking a checkpoint are discussed in the 
phapter "Program Checkout. " 

The system-name specified in the RERUN 
clause as the sort checkpoint device must 
not be the same as any system- name used in 
the source language ASSIGN clause, but 
follows the same rules of formation. 

The RERUN clause is fully described in 
the publication IBM Svstem/360 Disk 
Operating System; American National 
Standard COBOL. 



Using the Sort Feature 97 



USING THE SEGMENTATION FEATURE 



COBOL segmentation is a facility that 
provides a means of accomplishing object 
time overlay as a result of specifications 
made at the source language level. 
Segmentation will allow the programmer to 
divide the Procedure Division of a source 
program into sections. Through the use of 
a system of priority numbers » certain 
sections are designated as permanently 
resident in core storage and other sections 
as overlayable fixed segments and/or 
independent segments. Thus, a large 
program can be executed in a defined area 
of core storage by limiting the number of 
segments in the program that are 
permanently resident in core. 



Assuming that 12K is available for the 
program SAVECORE, Figure 2U shows the 
manner in which core storage would be 
utilized. It is apparent from the 
illustration that SECTION-3, SECTI0N^6, and 
SECTION-7 cannot be in core at the same 
time, nor can SECTION-3, SECTION-5 and 
SECTION-7 be in core simultaneously. 

Sections in the permanent segment 
(SECTION-1, SECTION-2, and SECTION-4) are 
those which must be available for reference 
at all times, or which are referenced 
frequently. They are distinguished here by 
the fact that they have been assigned 
priority numbers less than the segment 
limit. 



If there is a limit on the amount of 
core available, the program SAVECORE co\ald 
be segmented as illustrated in Figure 23. 



IDENTIFICATION DIVISION. 

PROGRAM-ID. SAVECORE. 

• 

ENVIRONMENT DIVISION. 

OBJECT- COMPUTER. IBM- 3 6 0-50 
SEGMENT-LIMIT IS 15. 

DATA DIVISION. 



PROCEDURE DIVISION. 
SECTION-1 SECTION 8. 



SECTION-2 SECTION 8. 



SECTION-3 SECTION 16, 



SECTION- 4 SECTION 8. 



SECTION-5 SECTION 50, 



SECTION-6 SECTION 16, 



SECTION-7 SECTION 50. 



T 



^. 



J 



,y 



Figure 23. Segmenting the Program SAVECORE 



Sections in the overlayable fixed 
segment are sections which are less 
frequently used. They are always made 
available in the state they were in when 
last used. They are distinguishable here 
by the fact that they have been assigned 
priority numbers greater than the segment 
limit but less than 49. 

Sections in the independent segment can 
overlay, and be overlaid by, either an 
overlayable fixed segment or another 
independent segment. Independent segments 
are those assigned priority numbers greater 
than 49 and less than 100, and they are 
always given control in their initial 
state. 



OPERATION 



Execution of tne object program begins 
in the root segment. The first segment in 
the permanent segment is considered the 
root segment. If the program does not 
contain a permanent segment, the compiler 
generates a dummy segment which will 
initiate the execution of the first 
overlayable or independent segment. All 
global tables, literals, and data areas are 
part of the root segment. Called object 
time subroutines are also part' of the root 
segment. When CALL statements appear in a 
segmented program, siibprograms are loaded 
with the fixed portion of the main program 
as if they had a priority of zero. 

Segmented programs must not be called by 
another program (segmented or not 
segmented) • 



Using the Segmentation Featiare 99 



fixed portion 
(12K) 



5K 



r 1 

I data-buffers, global | 
1 table, etc, , (IK) | 
|. ^. 

1 SECTION- 1 (2K) ji 

^ H / 

I SECTION-2 (2K) ]> permanent segment 

\. ^4 (segment limit < 15) 

I SECTION- 4 (2K) |1 

^ .^L 

SECTION- 3 (3K) ^^1 SECTION- 5 (2K) 




SECTION-3 and SECTION-6 SECTION-5 and SECTION-7 are 

are overlayable fixed segments independent segments 

(14 < segment limit < 50) (49 < segment limit < 100) 



Figure 24. Storage Layout for SAVECORE 



OUTPUT FROM A SEGMENTED PROGRAM 



COMPILER OUTPUT 



a. If the program- name is 6, 1, or 8 
characters in length, the 
segment-name will consist of the 
first 6 characters of program-name 
plus the 2-character priority 
number. 



~N 



The output produced by the compiler is 
an overlay structure consisting of multiple 
object modules preceded by linkage editor 
control statements. Segments whose 
priority is greater than the segment limit 
(or 49, if no SEGMENT- LIMIT clause is 
specified) consist of executable 
instructions only. 

The compiler generates each segment as a 
separate object module preceded by a PHASE 
card. The names appearing on these PHASE 
cards (segment-names) conform to the 
following naming conventions: 

1. The name of the root segment is the 
same as the program-name specified in 
the PROGRAM-ID clause. 

2. The name of each overlayable and 
independent segment is a combination 
of the program- name and the priority 
number of the segment. These names 
are formed according to the following 
rules: 



b. If the program-name is less than 6 
characters in length, the 
priority- number is appended after 
the program-name. 



Note: Single digit priority-numbers 
are preceded by a zero. 



The compiler generates an ENTRY card to 
the root segment as the last card input to 
the Linkage Editor, 



Figure 25 is an illustration of the 
compiler output for the skeleton program 
shown in Figure 23. 



100 



PHASE SAVECORE,ROOT 

{object module for the root segment 
(sections with priority- numbers less 
than the segment limit) including any 
programs called by SAVECORE} 



PHASE SAVEC016,* 

{object module for segments with a 
priority of 16 (two sections) } 



PHASE SAVECO50,SAVECO16 

{object module for segments with a 
priority of 50 (two sections) } 



I ENTRY SAVECORE 



J 



Figure 25. Compiler Output for SAVECORE 



Cataloging a Segmented Program 



When the CATAL option is used to catalog 
a segmented program, the following points 
should be observed: 

1. To avoid duplicate names, the user 
must be aware of the naming 
conventions used by the compiler (see 
"Compiler Output") because a 
segment- name may be the same as a 
phase-name already existing in the 
core image library. 

2. Since the PHASE card is generated by 
the compiler, the user must not 
specify a PHASE card for the program. 

To invoke a previously cataloged 
segmented program, the user must use the 
following control statement: 

// EXEC name 

where name is the program-name specified in 
the PROGRAM-ID clause. 



^. 



LINKAGE EDITOR OUTPUT 



Figxire 26 is an illustration of the 
input to the Linkage Editor and the phase 
map produced by the Linkage Editor 
resulting from the compilation and editing 
of the segmented program BIG JOB. The 
following text is an explanation of the 
figure. 



(1) PHASE card generated by the compiler 
for the root segment BIGJOB. 



(2) AUTOLINK card for the Segmentation 
subroutine. 

(3) PHASE cards generated by the compiler 
for segments of priority 10, U7-50, 60, 
62, and 63. 

(4) Control cards generated for the Sort 
Feature. These cards are explained in 
"Sort in a Segmented Progreim". 

(5) ENTRY card generated by the cornpiler 
for the root phase. 

(6) Location of the entry point CURSEGM. 
Item 6 is explained in "Determining the 
Priority of the Last Segment Loaded 
into the Transient Area". 

@ ;Load address of pjiase ILBDDUMO. Item 7 
is explained in "Sort in a Segmented 
Program. " 



Determining the Priority of the Last 
Segment Loaded into the Transient Area 



If a segmented program is abnormally 
terminated during execution, the priority 
of the last segment loaded into the 
transient area can be determined as 
follows : 



1. In the map of main storage generated 
by the Linkage Editor, tander the 
column LABEL, look for the name 
•CURSEGM* .(see item 6 in Figure 26). 



2. Associated with this label, in the 
column LOADED, is an address. 



3. At this location is stored the 

priority (one byte) of the segment 
current in the transient area. If 
this byte is X'OO', no segment has 
been loaded into the transient area. 
This indicates that the error causing 
the dump occurred in the root segment. 



SORT IN A SEGMENTED PROGRAM 



If a segmented program contains a SORT 
statement, the sort program will be loaded 
above the largest overlayable or 
independent segment as shown in Figure 27. 



Using the Segmentation Feature 101 






The compiler accomplishes this by 
providing the following two control 
statements at the end of the overlay 
structure: 



PHASE ILBDDUMO, transient area + L 
INCLUDE ILBDDUMO 



These cards are illustrated in Figure 26, 
item U. The value of "L" in the figure is 
X'2F2» which is the length of the longest 
segment, BIGJ0BU7, rounded to the next 
halfword boundary. Note that Linkage 
Editor relocates the phase ILBDDUMO to the 
next doubleword boundary (see Figure 26, 
item 7) . 



V 



JJOB BIGJ 



DISK LINKAGE EDITOR DIAGNOSTIC OF INPUT 



ACTION TAKEN MAP 

LIST PHASE BIG JOB, ROOT (T) 



LIST 
LIST 



LIST 
LIST 
LIST 
LIST 
LIST 
LIST 
LIST 
LIST 
LIST 
LIST 
LIST 
H 



AUTOLINK 
AUTOLINK 



ILBDSEMO (2) 
ILBDSRTO ^^ 



© 



PHASE BIGJOBIO,* 

PHASE BIGJ0Ba7, BIGJOBIO 

PHASE BIGJOBU8,BIGJOB47 

PHASE BIGJOBa9,BIGJOBU8 

PHASE BIGJOB50,BIGJOB49 

PHASE BIGJOB60,BIGJOB50 

PHASE BIGJOB62,BIGJOB60 

PHASE BIGJOB63, BIGJOB62 

PHASE ILBDDUMO, BIGJOB63+X' 002F2» 

INCLUDE ILBDDUMO 

ENTRY BIGJOB (J\ 



i© 





PHASE 


XFR-AD 


LOCORE 


HICORE 


DSK-AD 


ESD TYPE 


LABEL 


LOADED 


REL-FR 


lOOT BIGJOB 


0030.00 


003000 


0075A3 


64 


04 


1 


CSECT 

• 
• 

CSECT 


BIGJOB 
ILBDSEMO 


003000 
006268 


003000 
006268 ^^ 

© 

006B38 ^-^ 
















♦ ENTRY 


CURSEGM 


00637D 
















CSECT 

• 


ILBDSRTO 


006B38 


BIGJOBIO 


0075A8 


0075A8 


0075E9 


64 


09 


2 


• 

CSECT 


BIGJOBIO 


0075A8 


0075A8 


BIGJ0BU7 


0075A8 


0075A8 


007899 


65 


00 


1 


CSECT 


BIGJOB47 


0075A8 


0075A8 


BIGJOB48 


0075A8 


0075A8 


0075DB 


65 


00 


2 


CSECT 


BIGJOB48 


0075A8 


0075A8 


BIGJOB 4 9 


0075A8 


0075A8 


0075D3 


65 


01 


1 


CSECT 


BIGJOB49 


0075A8 


0075A8 


BIGJOB50 


0075A8 


0075A8 


0075F1 


65 


01 


2 


CSECT 


BIGJOB 50 


0075A8 


0075A8 


BIGJOB60 


0075A8 


0075A8 


0076ED 


65 


02 


1 


CSECT 


BIGJOB60 


0075A8 


0075A8 


BIGJOB 6 2 


0075A8 


0075A8 


0075D1 


65 


02 


2 


CSECT 


BIGJOB 6 2 


0075A8 


0075A8 


BIGJOB63 


0075A8 


0075A8 


007621 


65 


03 


1 


CSECT 


BIGJOB63 


0075A8 


0075A8 _. 
0:07 8 AO ( 7 ) 


ILBDDUMO 


0078A0 


0078A0 


0078A1 


65 


03 


2 


CSECT 


ILBDDUMO 


0078A0 



Figure 26. Linkage Editing a Segmented Program 



102 



L 



j ROOT j Including COBOL subroutines and called programs 

I TRANSIENT j 
L 7 I AREA I Overlayable and independent segments 

I ^ 

I SORT PROGRAM! 
L = length of the largest segment in bytes. 



I 



Figure 27. Location of Sort Program in a Segmentation Structure 






Using the Segmentation Feature 103 



v.. 



PART II 



• PROCESSING COBOL FILES ON MASS STORAGE DEVICES 

• ADVANCED PROCESSING CAPABILITIES 

• RECORD FORMATS 

• PROGRAMMING TECHNIQUES 



c 



Part II 105 



V. 



y 



PROCESSING COBOL FILES ON MASS STORAGE DEVICES 



A mass storage device is one on which 
records can be stored in such a way that 
the location of any one record can be 
determined without extensive searching. 
Records can be accessed directly rather 
than serially. 

The recording surface of a mass storage 
device is divided into many tracks. A 
track is defined as a circumference of the 
recording surface. The number of tracks 
per recording surface and the capacity of a 
track for each device are shown in Table 8. 



Individual records cannot be located 
quickly. Records iisually cannot be deleted 
or added unless the entire file is 
rewritten. This organization is used when 
most of the records in the file are 
processed each time the file is used. 



DIRECT ORGANIZATION 



1^- 



Table 8. Recording Capacities of Mass 
Storage Devices 



r T 

I Device I 

I + 



Capacity 



1 



+ ^ 

1 2311 I 200 tracks per surface; 3625 

bytes per track, 
l- + ^ 

J2314 I 200 tracks per surface; 7294 
bytes per track. 



12321 



+ ^ 



100 tracks per strip; 2000 bytes 
per track. 



I J. J 

Each device has some type of access 
mechanism through which data is transferred 
to and from the device. The mechanisms are 
different for each device, but each 
mechanism contains a number of read/write 
heads that transfer data as the recording 
surfaces rotate past them. Only one head 
can transfer data (either reading or 
writing) at a time. 



A file with direct organization is 
characterized by some predictable 
relationship between the key of a record 
and the address of that record on a mass 
storage device. This relationship is 
established by the user. 



Direct organization is generally used 
for files where the time required to locate 
individual records must be kept to an 
absolute minimum, or for files whose 
characteristics do not permit the use of 
sequential or indexed organization. 

This organization method has 
considerable flexibility. The accompanying 
disadvantage is that although the Disk 
Operating System provides the routines to 
read or write a file of this type, the user 
is largely responsible for the logic and 
programming required to locate the key of a 
record and its address on a mass storage 
device. 



FILE ORGANIZATION 



INDEXED ORGANIZATION 



Records in a file must be logically 
organized so that they can be retrieved 
efficiently for processing. Three methods 
of organization for mass storage devices 
are supported by the Disk Operating System 
American National Standard COBOL compiler: 
sequential, direct, and indexed. 



SEQUENTIAL ORGANIZATION 



In a sequential file, records are 
organized solely on the basis of their 
successive physical location in the file. 
The records are read or updated in the same 
order in which they appear. 



An indexed file is similar to a 
sequential file in that rapid sequential 
processing is possible. The indexes 
associated with an indexed file also allow 
quick retrieval of individual records 
through random access. Moreover, a 
separate area of the file is set aside for 
additions; this eliminates the need to 
rewrite the entire file when adding 
records, a process that would usually be 
necessary with a sequentially organized 
file. Although the added records are not 
physically in key sequence, the indexes are 
constructed in such a way that the added 
records can be quickly retrieved in key 
sequence, thus making rapid sequential 
access possible. 



Processing COBOL Files on Mass Storage Devices 107 



In this method of organization, the Disk 
Operating System has control over the 
location of the individual records. Since 
the characteristics of the file are knovm, 
most of the mechanics of locating a 
particular record are handled by the 
system. 



DATA MANAGEMENT CONCEPTS 



The data management facilities of the 
Disk Operating System are provided by a 
group of routines that are collectively 
referred to as the Input/Output Control 
System (IOCS). A distinction is made 
between two types of routines: 

1. Physical IOCS (PIOCS) — the physical 
input/ output routines included in the 
Supervisor. PIOCS is used by all 
programs run within the system. It 
includes facilities for scheduling 
input/output operations, checking for 
and handling error conditions related 
to input/output devices, and handling 
input/output interruptions to maintain 
maximum input/ output speeds without 
burdening the user's problem program. 

2. Logical IOCS (LIOCS) — the logical 
input/output routines linked with the 
user's problem program. These 
routines provide an interface between 
the user's file processing routines 
and the PIOCS routines. 

LIOCS performs those functions that a 
programmer needs to locate and access 
a logical record for processing. A 
logical record is one unit of 
information in a file of similar 
units, for example, one employee's 
record in a master payroll file, one 
part-number record in an inventory 
file, or one customer account record 
in an account file. One or more 
logical records may be included in one 
physical record. LIOCS refers to the 
routines that perform the following 
functions : 

a. Blocking and deblocking records 

b. Switching between input/output 
areas when two areas are specified 
for a file 



Whenever COBOL imperative-statements 
(READ, WRITE, REWRITE, etc. ) are used in a 
program to control the input/output of 
records in a file, that file must be 
defined by a DTF (Define The File). A DTP 
is created for each file opened in a COBOL 
program from information specified in the 
Environment Division, FD entry, and 
input/output statements in the source 
program. The DTF for each file is part of 
the object module that is generated by the 
compiler. It describes the characteristics 
of the logical file, indicates the type of 
processing to be used for the file, and 
specifies the main storage areas and 
routines used for the file. 



one of the constants in the DTF table is 
the address of a logic module that is to be 
used at execution time to process that 
file. A logic module contains the coding 
necessary to perform data management 
functions required by the file such as 
blocking and deblocking, initiating label 
checking, etc. 



Generally, these logic modules are 
assembled separately and cataloged in the 
relocatable library under a standard name. 
At linkage editing time, the Linkage Editor 
searches the relocatable library using the 
virtual reference to locate the logic 
module. The logic module is then included 
as part of the program phase. Note that 
since the Autolink feature of the Linkage 
Editor is responsible for including the 
logic modules, the COBOL programmer need 
not specify any INCLUDE statements. 



The type of DTF table prepared by the 
compiler depends on the organization of the 
file and the device to which it is 
assigned. The DTF's used for processing 
files assigned to mass storage devices are 
as follows: 



DTFSD — Sequential organization, 
sequential access 

DTFDA — Direct organization, 

sequential or random access 

DTFIS — Indexed organization, 

sequential or random access 



■ J 



c. Handling end-of-file and 
end-of-volume conditions 

d. Checking and writing labels 

A brief description of functions 
performed by LIOCS and their relationship 
to a COBOL program follows. 



The remainder of this chapter provides 
information about preparing programs which 
process files assigned to mass storage 
devices. Included are general descriptions 
of the organization, the COBOL statements 
that must be specified in order to build 
the correct DTF tables, and coding 
examples. 



108 



SEQUENTIAL ORGANIZATION (DTFSD) 



Invalid clauses: 



In a sequential file on a mass storage 
device, records are written one after 
another — track by track, cylinder by 
cylinder — at successively higher 
addresses. 

Records may be fixed- length, spanned, or 
variable-length, blocked or unblocked, or 
undefined. Since the file is always 
accessed sequentially, it is not formatted 
with keys. 

Processing a sequentially organized file 
for selected records is inefficient. If it 
is done infrequently, the time spent in 
locating the records is not significant. 
The slowest way is to read the records 
sequentially until the desired one is 
located. On the average, half of the file 
must be read to locate one record. 

Additions and deletions require a 
complete rewrite of a sequentially 
organized file on a mass storage device. 
Sequential organization is used on mass 
storage devices primarily for tables and 
intermediate storage rather than for master 
files. 

Sequentially organized files formatted 
with keys cannot be created using DTFSD. 
DTFDA may be used to create and access 
(sequentially or randomly) such files. 



ACCESS MODE IS RANDOM 
ACTUAL KEY Clause 
NOMINAL KEY Clause 
RECORD KEY Clause 
TRACK AREA Clause 
MULTIPLE FILE TAPE Clause 
APPLY EXTENDED-SEARCH Clause 
APPLY CYL- OVERFLOW Clause 

(MASTER- INDEX) 
APPLY< > Clause 

icYL- INDEX ) 

APPLY CORE- INDEX Clause 



DTFSD files may be opened as INPUT, 
OUTPUT, or I-O. When creating such a file, 
an INVALID KEY condition occurs when the 
file limit has been reached and an attempt 
is made to place another record on the mass 
storage device. The file limit is 
determined from the XTENT or EXTENT control 
statements. 

When a DTFSD file is opened as OUTPUT, 
each WRITE statement signifies the creation 
of a new record. When opened as I-O, each 
WRITE statement signifies that the record 
just read is to be rewritten. 



DIRECT ORGANIZATION (DTFDA) 



PROCESSING A SEQUENTIALLY ORGANIZED FILE 



To create, retrieve, or update a DTFSD 
file, the following specifications should 
be made in the source program: 



ENVIRONMENT DIVISION 
Required clauses : 

SELECT [OPTIONAL] file- name 



ASSIGN TO SYSnnn- 



Optional clauses : 



UT 



DA 



(2311) 
- <^23iui -S 
I2321J 



RESERVE Clause 
FILE- LIMIT Clause 
ACCESS MODE IS SEQUENTIAL 
PROCESSING MODE IS SEQUENTIAL 
RERUN Clause 
SAME Clause 

APPLY WRITE-ONLY Clause (create only) 
APPLY WRITE- VERIFY Clause (create or 
update only) 



With direct organization, there is a 
definite relationship beteween the key of a 
record and its address. This relationship 
permits rapid access to any record if the 
file is carefully organized. The user 
develops a record address that ranges from 
zero to some maximum by converting a 
particular field in each record to a track 
address. Each byte in the address is a 
binary number. To reference a particular 
record, the user must supply both the track 
address and the identifier that makes each 
record unique on its track. Both the track 
address and the identifier are supplied by 
the user in the ACTUAL KEY clause. This 
will be discussed in detail later in this 
chapter. 

With direct organization, records may be 
fixed length, spanned or undefined. The 
records must be unblocked. RO (record 
zero) of each track is used as 'a capacity 
record. It contains the address of the 
last record written on the track, and is 
used by the system to determine whether a 
new record will fit on the track. The 
capacity records are updated by the system 
as records are added to the file. The 
capacity records do not account for 
deletions: as far as the system is 



Processing COBOL Files on Mass Storage Devices 109 



concerned, once a track is full it remains 
full (even if the user deletes records) 
until the file is reorganized. 



Often, more records are converted to a 
given track address than will actually fit 
on the track. These surplus records are 
known as overflow records and are usually 
written into a separate area known as an 
overflow area. 



As already noted, the user has an 
unlimited choice in deciding where records 
are to be located in a directly organized 
file. The logic and programming are his 
responsibility. 



When creating or making additions to the 
file, . the user must specify the location 
for a record (track address) and the 
identifier that makes each record on the 
track unique. If there is space on the 
track, the system writes the record and 
updates the capacity record- If the 
specified track is full, a standard error 
condition occurs, and the user may specify 
another track address in his USE AFTER 
STT^DARD ERROR declarative routine. 



In the case of one maximum size record 
per track (when spanned records are not 
specified), the data length plus the length 
of the symbolic key cannot exceed the 
following values: 



2311 — 3605 bytes 
23m — 7249 bytes 
2321 — 1984 bytes 



When reading or updating the file, the 
user must supply the track address and the 
unique identifier on the track for the 
specific record being sought. The system 
locates the track and searches that track 
for the record with the specified 
identifier. If the record is not found, 
COBOL indicates this to the user by raising 
an INVALID KEY condition. Only the track 
specified by the user is searched. If, 
however, the APPLY EXTENDED- SEARCH clause 
has been specified for the file, the entire 
cylinder is searched for the desired 
record. In this case, the INVALID KEY 
condition arises only if the record cannot 
be found on the cylinder. To ensure file 
integrity, the upper limit of each extent 
of a file using EXTENDED- SEARCH must be the 
last track of a cylinder. 

Error recovery from a DTFDA file is 
described in detail in the chapter 
"Advanced Processing Capabilities." 



ACCESSING A DIRECTLY ORGANIZED FILE 



A directly organized file (DTFDA) may be 
accessed either sequentially or randomly. 

ACCESSING A DIRECTLY ORGANIZED FILE 
SEQUENTIT^LY ; When reading a direct file 
sequentially, records are retrieved in 
logical sequence; this logical sequence 
corresponds exactly to the physical 
sequence of the records. To retrieve a 
DTFDA file sequentially, the following 
specifications are made in the source 
program: 

ENVIRONMENT DIVISION 

Required clauses ; 

SELECT [OPTIONAL] file-name 



V... '• 



(2311) (A 
ASSIGN TO SYSnnn-DA- < 2321 



, ■}-, 

(2314) (D 



Optional clauses : 



FILE-LIMIT Clause 

ACCESS MODE IS SEQUENTIAL 

PROCESSING MODE IS SEQUENTIAL 

ACTUAL KEY Clause 

RERUN Clause 

SAME Clause 

Invalid clauses ; 

RESERVE Clause 
ACCESS MODE IS RANDOM 
NOMINAL KEY Clause 
RECORD KEY Clause 
TRACK-AREA Clause 
MULTIPLE FILE TAPE Clause 
APPLY WRITE-ONLY Clause 
APPLY CYL-OVERFLOW Clause 
APPLY EXTENDED- SEARCH Clause 
APPLY WRITE-VERIFY Clause 

(MASTER- INDEX 
APPLY< > Clause 

(CYL- INDEX 

APPLY CORE-INDEX Clause 

When DTFDA records are retrieved 
sequentially, the file may be opened only 
as INPUT. The AT END condition occurs when 
the last record has been read and execution 
of another READ is attempted. 

Note that in the ASSIGN clause, an A 
must be specified for files with actual 
track addressing, and a D must be specified 
for files with relative track addressing. 

ACCESSING A DIRECTLY ORGANIZED^ FILE 
RANDOMLY : To create a directly organized 
file randomly, the following 



•^ 



I . 



110 



o 



o 



specifications axe made in the source 
program: 

ENVIRONMENT DIVISION 

Required clauses : 

SELECT file-name 

(2311) (K\ 
ASSIGN TO SYSnnn-DA- <2321>-{ > 

(2314) (d) 

ACCESS MODE IS RANDOM 
ACTUAL KEY Clause 

Optional clauses ; 

FILE- LIMIT Clause 

PROCESSING MODE IS SEQUENTIAL 

RERUN Clause 

SAME Clause 

APPLY WRITE-VERIFY Clause 

Invalid clauses ; 

RESERVE Clause 
ACCESS MODE IS SEQUENTIAL 
NOMINAL KEY Clause 
RECORD KEY Clause 
TRACK- AREA Clause 
MULTIPLE FILE TAPE Clause 
APPLY WRITE-ONLY Clause 
APPLY EXTENDED-SEARCH Clause 
APPLY WRITE-VERIFY Clause 
APPLY CYL-OVERFLOW Clause 

(MASTER-INDEX ) 
APPLY < > Clause 



(CYL-INDEX 



APPLY CORE-INDEX Clause 

Note that in the ASSIGN clause, au A 
must be specified for files with actual 
track addressing, and a D must be specified 
for files with relative track addressing. 

To retrieve or update a directly 
organized file randomly, the following 
specifications must be made in the source 
program. 



ENVIRONMENT DIVISION 



Required clauses ; 






SELECT file-name 








(2311) 


(^ 


ASSIGN TO SYSnnn-DA- 


<^2314> - 


- D 




(2321J 


(w 



ACCESS MODE IS RANDOM 
ACTUAL KEY Clause 



Note that in the ASSIGN clause an A must 
be specified for files with actual track 
addressing, a D must be specified for files 
with relative track addressing, a U must be 
specified for files with actual track 
addressing when the REWRITE statement is 
used, and W must be specified for files 
with relative track addressing when the 
REWRITE statement is used. 

The optional and invalid clauses are the 
same as those specified previously for 
creating a directly organized file. 

Exception ; APPLY EXTENDED- SEARCH is 
optional when retrieving or updating a 
directly organized file randomly. 



ACTUAL KEY CLAUSE 



Note that the ACTUAL KEY clause is 
required for DTFDA files when ACCESS IS 
RANDOM, is optional for DTFDA files when 
ACCESS IS SEQUENTIAL, and is not used for 
DTFSD files. 

The actual key consists of two 
components. One component expresses the 
track address at which the record is to be 
placed for an output operation, or at which 
the search is to begin for an input 
operation. The track address Ccin be 
expressed either as an actual address or as 
a relative address, depending upon the 
addressing scheme chosen when the file was 
created. The other component is associated 
with the record itself and serves as its 
unique identifier. The structTires of both 
acttial keys are shown in Figure 28. 



r 1 

I Actual Key | 

|. ^ 4 

1 Actual Track | Record Identifier! 
I Address | | 

L J. J 

Byte 1 8 9 263 

r n 

I Actual Key I 

i. ^ ^ 

I Relative | Record Identifier) 
i Track Address! \ 

L J J 

Byte 1 4 5 258 



• Figure 28. Structures of the Actual Key 

The format of the ACTUAL KEY clause is: 
ACTUAL KEY IS data-name 



Processing COBOL Files on Mass Storage Devices 111 




Pack 

M 



Cell 

— T 



■T 

I 

4— 
I c 



Cylinder 

T 



Head 
— T 



Record 



I 3 



5 I 



0-221 



I 0-199 I 



I 0-9 



0-255 



0-221 







j 0-199 I 



I 0-19 



0-255 



0-221 jo 10-9 1 0-19 j 0-9 | 0-U | 0-19 | 0-255 
X ± J. JL J. J. J J. 

Permissible Specifications for the First Eight Bytes of the Actual Key 



Figure 29. 



When actual track addressing is used, 
data- name may be any fixed item from 9 
through 263 bytes in length. It must be 
defined in the Working- Storage, File,, or 
Linkage Section. The first eight bytes are 
used to specify the actual track address. 
The structure of these bytes and 
permissible specifications for the 2311, 
2314, and 2321 mass storage devices are 
shown in Figur.e 29. The user may select 
from 1 to 255 bytes for the record 
identifier portion of the actual key field. 

When relative track addressing is used, 
data-name may be any fixed item from 5 
through 258 bytes in length. It must be 
defined in the File Section, the Working- 
Storage Section, or the Linkage Section. 
The first four bytes of data-name are the 
track identifier. Tho identifier is used 
to specify the relative track address for 
the record and must be defined as an 
8- integer binary data item whose maximum 
value does not exceed 16, 777, 215. The 
remainder of data-name, which is 1 through 
254 bytes in length, is the record 
identifier. It represents the symbolic 
portion of the key field used to identify a 
particular recora on a track. 

For a complete discussion of the ACTUAL 
KEY clause, see the publication IBM 
Svstem/360 -Disk -Operating'. system; - -American 
National Standard COBOL. 



Randomizing Techniques 



One method of determining the value of 
the track address portion of the field 
defined in the ACTUAL KEY clause is 
referred to as indirect addressing . 
Indirect addressing generally is used when 
the range of keys for a file includes a 
high percentage of unused values. For 
example, employee numbers may range from 
000001 to 009999, but only 3000 of the 
possible 9999 numbers are currently 



assigned. Indirect addressing is also used 
for nonnumeric keys. Key, in this 
discussion, refers to that field of the 
record being written that will be converted 
to the track address portion. 



Indirect addressing signifies that the 
key is converted to a value for the actual 
track address by using some algorithm 
intended to limit the range of addresses. 
Such an algorithm is called a randomizing 
technique . Randomizing techniques need not 
produce a unique address for every record 
and, in fact, such techniques usually 
produce synonyms . Synonyms are records 
whose keys randomize to the same address. 



Two objectives must be considered in 
selecting a randomizing technique: 

1. Every possible key in the file must 
randomize to an address within the 
designated range, 

2. The addresses should be distributed 
evenly across the range so that there 
are as few synonyms as possxole. 

Note that one way to minimize synonyms 
is to allocate more space for the file than 
is actually required to contain all the 
records. For example, the percentage of 
locations that are actually used might be 
80% to 8555 of the allocated space. 

When actual track addressing is used, 
the first eight bytes of the ACTUAL KEY 
field can be thought of as a "discontinuous 
binary address. " This is significant to 
the programmer because .he must keep two 
considerations in mind. First, the 
cylinder and head number must be in binary 
notation, so the results of the randomizing 
formula must be in binary format. Second, 
the address is "discontinuous" since a 
mathematical overflow from one element 
(e.g., head ntimber) does not increment the 
adjacent element (e. g. , cylinder number) . 



"^..y 



I 



112 



DIVISION/REMAINDER METHOD ; One of the 
simplest ways to indirectly address a 
directly organized file is by using the 
division/remainder method. (For a 
discussion of other randomizing techniques, 
see the publication Introduction to IBM 
Svstem/360 Direct Access Storage Devices 
cind Organization Methods , Form GC20-1649, ) 

1. Determine the amount of locations 
required to contain the data file. 
Include a packing factor for 
additioncil space to eliminate 
synonyms. The packing factor should 
be approximately 20% of the total 
space cillocated to contain the data 
file. 

2. Select, from the prime number table, 
the nearest prime number that is less 
than the total of step 1. A prime 
number is a number divisible only by 
itself and the integer 1. Table 9 is 
a pairtial list of prime numbers. 

3. Clear any zones from the first eight 
bytes of the actual key field. This 
can be accomplished by moving the key 
to a field described as COMPUTATIONAL. 

U. Divide the key by the prime number 
selected. 

5. Ignore the qiiotient; utilise the 
remainder as the relative location 
within the data file. 

I 6. (For actual track addressing only) 
I Locate the beginning of the space 

available and manipulate the relative 
address, to the actual device address 
if necessary. 

For example, ass\ame that a company is 
planning to create an inventory file on a 
2311 disk storage device. There are 8000 
different inventory parts, each identified 
by an 8-character part number. Using a 20% 
packing factor, 10, 000 record positions are 
allocated to store the data file. 

Method A ; The closest prime number to 
10,000, but under 10,000, is 9973. Using 
one inventory part number as an example, in 
this case #25DF351U, and clearing the zones 
we have 25463514. Dividing by 9973 we get 
a quotient of 2553 and a remainder of 2445. 
2445 is the relative location of the record 
within the data file corresponding to part 
ntamber 25DF3514. The record address can be 
determined from the relative location as 
follows : 

I 1. (For actxial track addressing only) 

Determine the beginning point for the 



data file (e.g., cylinder 100, track 
0). 

2. Determine the niimber of records that 
can be stored on a track (e.g., twelve 
per track on a 2311 disk pack, 
assuming each inventory record is 200 
bytes long) • 

Because each data record contains 
non-data components, such as a count 
area and interrecord gaps, track . 
capacity for data storage will vary 
with record length. As the number of 
separate records on a track increases, 
interrecord gaps occupy additional 
byte positions so that data capacity 
is reduced. Track capacity formulas 
provide the mecins to determine total 
byte requirements for records of 
various sizes on a track. These 
formulas can be found in the 
publications IBM Svstem/360 Component 
Descriptions , Forms GA26-5988 and 
GA26-3599. 

3. Divide the relative number (2445) by 
the number of records to be stored on 
each track. 

I 4. (For actual track addressing only) 
The result, quotient = 203, is now 
divided into cylinder and head 
designation, Since the 2311 disk pack 
has ten heads, the quotient of 203 is 
divided by 10 to show: 

Cylinder or CC = 20 
Head or HH = 03 (high-order zero 
added) 

4B, (For relative track addressing only) 
The result, quotient = 203, now 
becomes the track identifier of the 
actual key. 

Method B ; Utilizing the same example, 
another approach will also provide the 
relative track address: 

1. The number of records that may be 
contained on one track is twelve. 
Therefore, if 10,000 record locations 
are to be provided, 834 tracks must be 
reserved. 

2. The prime number nearest, but less 
than 834, is 829. 

3. Divide the zone- stripped key by the 
prime value. (In the example, 
25463514 divided by 829 provides a 
quotient of 30715 and a remainder of 
779. The remainder is the relative 
address. ) 



Processing COBOL Files on Mass Storage Devices 113 



Table 9. Partial List of Prime Numbers 
(Part 1 of 2) 



Table 9. Partial List of Prime Numbers 
(Part 2 of 2) 



1 


T 




A 


B 


1 


(Number) 


(Nearest Prime Number 
Less Than A) 


r 








500 


499 




600 


599 




700 


691 




800 


797 




900 


887 




1000 


997 




1100 


1097 




1200 


1193 




1300 


1297 




1400 


1399 




1500 


1499 




1600 


1597 




1700 


1699 




1800 


1789 




1900 


1889 




2000 


1999 




2100 


2099 




2200 


2179 




2300 


2297 




2400 


2399 




2500 


2477 




2600 


2593 




2700 


2699 




2800 


2797 




2900 


2897 




3000 


2999 




3100 


3089 




3200 


3191 




3300 


3299 




3400 


3391 




3500 


3499 




3600 


3593 




3700 


3697 




3800 


3797 




3900 


3889 




4000 


3989 




4100 


4099 




4200 


4177 




4300 


4297 




4400 


4397 




4500 


4493 




4600 


4597 




4700 


4691 




4800 


4799 




4900 


4889 




5000 


4999 




5100 


5099 




5200 


4197 '^^ 




5300 


5297 




5400 


4399 "^^ 




5500 


5483 



1 T 


1 ^ 


B 


1 (Number) 


(Nearest Prime Number 


L — J 


Less Than A) 

I — — 


r 1 


r 


1 5600 


5591 


1 5700 


5693 


1 5800 


5791 


1 5900 


5897 


1 6000 


5987 


1 6100 


6091 


1 6200 


6199 


1 6300 


6299 


1 6400 


6397 


1 6500 


6491 


1 6600 


6599 


1 6700 


6691 


1 6800 


6793 


1 6900 


6899 


1 7000 


6997 


1 7100 


7079 


1 7200 


7193 


I 7300 


7297 


1 7400 


7393 


1 7500 


7499 


1 7600 


7591 


1 7700 


7699 


1 7800 


7793 


1 7900 


7883 


1 8000 


7993 


1 8100 


8093 


1 8200 


8191 


1 8300 


8297 


1 8400 


8389 


1 8500 


8467 


1 8600 


8599 


1 8700 


8699 


1 8800 


8793 


1 8900 


8899 


1 9000 


8899 


1 9100 


9091 


1 9200 


9199 


1 9300 


9293 


1 9400 


9397 


1 9500 


9497 


1 9600 


9587 


1 9700 


9697 


1 9800 


9791 


1 9900 


9887 


1 10,000 


9973 


1 10,100 


10,099 


1 10,200 


10,193 


1 10,300 


10,289 


1 10,400 


10,399 


1 10,500 


10,499 


1 10,600 


10,597 



^-- 



L J J 



J J 



114 



I u. 



(For actual track addressing only) To 
convert the relative address to an 
actual device address, divide the 
relative address by the niimber of 
tracks in a cylinder. The quotient 
will provide the cylinder nxamber and 
the remainder will be the track 
number. For example, the 2311 disk 
pack would utilize 779 as: 



(D 



Cylinder or CC = 77 
Track or HH = 9 



\ 



Figure 30 is a sample COBOL program 
which creates a direct file with actual 
track addressing using Method B and 
provides for the possibility of synonym 
overflow. Synonym overflow will occur if 
record randomizes to a track that is 
already full. The following description 
highlights the feattires of the example. 
Circled numbers on the program listing 
correspond to the numbers in the text. 



® 



.-^ 



The value 10 is added to TRACK- 1 to 
ensure that the user program does not 
write on cylinder 0. Cylinder must 
be reserved for the Vol\ame Table of 
Contents . 

• Since the prime number used as a 
divisor is 829, the largest possible 
remainder will be 828. Adding 10 to 
TRACK-1 adjusts the largest possible 
remainder to 838. 



If synonym overflow occurs, control is 
given to the error procedure 
declarative specified in the first 
section of the Procedure Division. 
The declarative provides that: 



Any record which cannot fit on a 
track (i.e., tracks through 8 of 
any cylinder) will be written in the 
first available position on the 
following track(s). 

Any record which cannot fit within a 
single cylinder will be written on 



© 



® 



® 



cylinder 8U (i.e., the cylinder 
overflow area) . 



• If a record cannot fit on either 
cylinders 1 through 83, or on 
cylinder 84, the job is terminated. 

The standard error condition "no room 
found" is tested before control is 
given to the synonym routine. Other 
standard error conditions as well as 
invalid key conditions result in job 
termination. 

ERROR-COND is the identifier which 
specifies the error condition that 
caused control to be given to the 
error declarative. ERROR-COND is 
printed on SYSLST whenever the error 
declarative section is entered. 
TRACK-ID and C-REC are also printed on 
SYSLST. They are printed before the 
execution of each WRITE statement- 
This output has been provided in order 
to facilitate an understanding of the 
logic involved in the creation of 
D-FILE. 



The first twelve records which 
randomize to cylinder 002 track 8 are 
actually written on track 8. 



The next twelve records which 
randomize to cylinder 002 track 8 are 
adjusted by the SYNONYM- ROUTINE and 
written on cylinder 002 track 9. 



The next twelve records which 
randomize to cylinder 002 track 8 are 
adjusted by the SYNONYM- ROUTINE and 
written on cylinder 84 track (i.e., 
the overflow cylinder) . 



The last two records which randomize 
to cylinder 002 track 8 are adjusted 
by the SYNONYM-ROUTINE and written on 
cylinder 84 track 1 (i.e., the 
overflow cylinder) . 



Processing COBOL Files on Mass Storage Devices 115 



•// JOB METHODB 

// OPTION NODECK, LINK, LIST, LISTXtSYM, ERRS 

// EXEC FCOBOL 



IDENTIFICATION DIVISION. 
PROGRAM-ID. METHOD-B. 
ENVIRONMENT DIVISION. 
CONFIGURATION SECTION. 
SOURCE-COMPUTER. IEM-360. 
OBJECT-COMPUTER. IBM-360. 
INPUT-OUTPUT SECTION. 
FILE-CONTR-OL. 

SELECT O-FJLE ASSIGN SYS0i5-DA-23ll-A-MASTER 

ACCESS IS RANDOM 

ACTUAL KEY IS ACT-KEY. 

SELECT C-FILE ASSIGN TO SYS0G7-UR-2540R-S. 
DATA DIVISION. 
FILE SECTION. 
FD D-FILE i 

LABEL RECORDS ARE STANDARD. 
01 D-REC. 

02 PART-NUM FIC X(8,). 

02 NUM-ON-HAND PIC 9(4J. 

02 PRICE PIC 9{5JV99. 

02 FILLER PIC X(181J. 
FD C-FILE 

LABEL RECORDS ARE OMITTED. 
01 C-REC. 

02 PART-NUM PIC X(8). 

02 NUM-ON-HAND PIC 9(4J . 

02 PRICE PIC S(5JV99. /— ,. 

WORKING-STORAGE SECTION. ( ' 

77 HD PIC 9 VALUE ZERO. V y 

77 SAVE PIC S9(8) COMP SYNC. 
77 QUOTIENT PIC S9(5,) COMP SYNC. 
01 ERROR-COND. 

02 FILLER PIC 99 VALUE ZERO. 

02 ERR PIC 9 VALUE ZERO. 

02 FILLER PIC 9(5J VALUE ZERO. 
01 TRACK-1 PiC 9999. 
01 TRACK-ID REDEFINES TRACK-1. 

02 CYL PIC 999. 

02 HEAD PIC 9. 
01 KEY-1. 

C2 M PIC S999 COMP SYNC VALUE ZEROES. 

02 BB PIC S9 COMP SYNC VALUE ZERO. 

02 CC PIC S999 COMP SYNC. 

02 HH PIC 59 COMP SYNC. 

02 R PIC X VALUE LOW-VALUE. 

C2 REC-ID PIC X{8i. 
01 KEY-2 REDEFINES KEY-1. 

02 FILLER PIC X. 

02 ACT-KEY PIC X( 16,J . 



Figure 30. Creating a Direct File Using Method B (Part 1 of H) 



116 



v^. 



ELSE 
REC-ID 



DISPLAY •OVERFLCW AREA FULL' 



PROCEDURE DIVISION. 

DECLARATIVES. 

ERRQR-PRQCEDURE SECTION. USE AFTER STANDARD ERROR PROCEDURE 

ON D-FILE GIVING ERROR-CONO. 
ERROR-ROUTINE. 

EXHIBIT NAMED ERROR-COND. 

IF ERR = 1 GO TG SYNONYM-ROUTINE 
DISPLAY 'CTHER STANDARD ERROR 
GQ TO EOJ. 
SYNONYM-ROUTINE. 

IF CC = 84 AND HD = 9 
GO TO EOJ. 

IF CC = 84 ADD I TO HD GO TO AOJUST-HD. 

IF HH = 9 GO TO END-CYLINOER . 

ADD 1 TO HH. 

GO TO WRITES. 
ENC-CYLINDER. 

MOVE 84 TO CC. 
ADJUST-HD. 

MOVE HD TO HH. 

GO TO WRITES. 
END DECLARATIVES. 
FILE-CREATIGN SECTION. 

OPEN INPUT C-FILE 
OUTPUT D-FILE. 
READS. 

READ C-FILE AT END GO TO EOJ. 

MOVE CORRESPONDING C-RtC TO D-REC. 

MOVE PART-NUM OF C-REC TO REC-ID SAVE. 

DIVIDE SAVE BY 829 GIVING QUOTIENT REMAINDER TRACK-1 

ADD 10 TO TRACK-1. 

MOVE CYL TO CC. 

MOVE HEAD TO HH. 
WR ITES 

EXHIBIT NAMED TRACK-ID C-REC CC HH. 

WRITE D-REC INVALID KEY GO TO INVALlD-KEY. 

GO TO READS. 
INVALID-KEY. 

DISPLAY 'INVALID KEY ,' REC-ID. 
EOJ. 

CLOSE C-FILE D-FILE. 

STOP RUN. 



•® 



® 



® 



// LBLTYP NSD(OH 
// EXEC LNKEDT 



Figure 30. Creating a Direct File Using Method B (Part 2 of 



U) 



o 



Processing COBOL Files on Mass Storage Devices 117 



// ASSGN SYSCCT.X'OOC 

// ^SSGN SYS015,X'192' 

// DLBL MASTER, ,50/CCl, DA 

// EXTENT SYS015, mill, 1,0, 10,840 

'/ EXEC 



TRACK-ID = 


0010 C-REC 


= 


e29CCCCC 


TRACK-ID = 


0011 C-REC 


= 


8290C001 


TRACK-ID = 


0011 C-REC 


= 


82900001X 


TRACK-ID = 


0028 C-REC 


= 


8290CC18C1 


TRACK-ID = 


0028 C-REC 


= 


8290C018C2 


TRACK- ID = 


0028 C-REC 


= 


8290CCieC3 


TRACK-ID = 


0028 C-REC 


= 


8290001804 


TRACK-ID = 


0028 C-REC 


= 


8290CC18C5 


TRACK-ID = 


0028 C-REC 


= 


8290C018C6 


TRACK-ID = 


0028 C-REC 


= 


829CCCieC7 


TRACK-IC = 


0028 C-REC 


= 


8290CC18C8 


TRACK- ID = 


0028 C-REC 


= 


8290001809 


TRACK-IC = 


0028 C-REc 


= 


8290CC1810 


TRACK-ID = 


0028 C-REC 


= 


8290CC1811 


TRACK-IC = 


0028 C-REC 


= 


8290CC1E12 


TRACK-ID = 


0028 C-REC 


= 


829CCC1813 


ERROR-COND 


= COIOOOOO 






TRACK-ID = 


0028 C-REC 


= 


8290CC1813 


TRACK-ID = 


0028 C-REC 


= 


8290CC1814 


ERROP-CGND 


= CCICCCCO 






TRACK-ID = 


C028 C-REC 


= 


8290CCiei4 


TRACK-IC = 


0028 C-REC 


= 


8290001815 


ERRQR-CONC 


= COICOOOO 






TRACK-ID = 


0028 C-REC 


= 


8290CC1815 


TRACK-ID = 


0028 C-REC 


= 


8290001816 


ERROR-COND 


= COICCCCO 






TRACK-ID = 


0028 C-REC 


= 


82900C1816 


TRACK-ID = 


0C28 C-REC 


= 


8290001817 


ERROR-COND 


= CCICCCCO 






TRACK-IC = 


0028 C-REC 


= 


8290001817 


TRACK-ID = 


0028 C-REC 


= 


8290CC18ie 


ERROR-COND 


= OOIOOCCO 






TRACK-ID = 


0028 C-REC 


= 


8290CCiei8 


TRACK-ID = 


0C28 C-REC 


= 


8290CC181<; 


EPRCR-COND 


= 00100000 






TRACK-ID = 


0028 C-REC 


= 


8290CC181C 


TRACK- ID = 


0028 C-REC 


= 


82900C182C 


ERROR-COND 


= COICOOOO 






TRACK-ID = 


0028 C-REC 


= 


8290CC182C 


TRACK- ID = 


CC28 C-REC 


= 


8290001821 


ERROR-COND 


= CCICOCCO 






TRACK-ID = 


0028 C-REC 


= 


8290001821 


TRACK-ID = 


CC2e C-REC 


= 


8290CC1822 


ERRCP-CGND 


= COIOOOOO 






TRACK-ID = 


CC28 C-REC 


= 


8290001822 


TRACK-ID = 


0028 C-REC 


= 


82900C1823 


ERRCR-CCND 


= COICOOOO 






TRACK-ID = 


CC2e C-REC 


= 


8290C01823 


TRACK-IC = 


0028 C-REC 


= 


8290CC1824 


ERROR-CCNO 


= COICCCCO 






TRACK-ID = 


0028 C-REC 


= 


8290CC1824 



CC 


= 


001 


HH 


= 





CC 


= 


001 


HH 


= 


1 


CC 


= 


001 


HH 


= 


1 


CC 


= 


002 


HH 


= 


8 


CC 


s= 


002 


y^H 


= 


8 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


=. 


8 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


8 


CC 


= 


CC2 


HH 


= 


8 


CC 


= 


002 


HH 


= 


8 


CC 


= 


C02 


HH 


= 


8 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


- 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


9 


zc 


= 


002 


HH 


= 


8 


CC 


- 


CC2 


HH 


= 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


— 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


CC2 


HH 


= 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


CC2 


HH 


= 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


002 


HH 


= 


9 


CC 


= 


C02 


HH 


= 


8 


CC 


= 


002 


HH 


= 


9 


CC 


= 


002 


HH 


= 


8 


CC 


= 


C02 


HH 


= 


9 



© 



v.. 



© 



Figure 30. Creating a Dijrect File Using Method B (Part 3 of U) 



118 



c 



c 



TRACK- 


ID = 


0028 


C-REC 


= 


a290CC1825 


CC = 


002 


HH 


= 


8^ 


ERRCR- 


COND 


= 00100000 
















TRACK- 


ID = 


0028 


C-REC 


= 


82900C1825 


CC = 


002 


HH 


= 


9 


ERRCR- 


CONO 


= COIOOCCO 
















TRACK- 


ID = 


C028 


C-PEC 


= 


8290001825 


CC = 


C84 


HH 


= 





TRACK- 


•10 = 


0028 


C-REC 


= 


8290CCie2£ 


CC = 


002 


HH 


= 


8 


ERROR- 


■COND 


= 00100000 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290001826 


CC = 


002 


HH 


= 


9 


ERRCR- 


•CCND 


= 00100000 
















TRACK- 


•ID = 


CC28 


C-REC 


= 


8290C01826 


CC = 


084 


HH 


= 





TRACK- 


■ID = 


0028 


C-REC 


= 


8290C01827 


CC = 


002 


HH 


= 


8 


ERRCR- 


■COND 


= OOICCCCO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290001827 


CC = 


002 


HH 


= 


9 


ERRCR- 


-CCND 


= COICOOOO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290CC1827 


CC = 


084 


HH 


= 





TRACK- 


■ID = 


0028 


C-REC 


= 


8290C01828 


CC = 


C02 


HH 


= 


8 


ERRCR- 


•COND 


= COICCCCC 
















TRACK- 


-ID = 


0028 


C-REC 


= 


8290001826 


CC = 


002 


HH 


= 


9 


ERRCR- 


•CCND 


= COICOCOO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290001828 


CC = 


084 


HH 


= 





TRACK- 


-ID = 


0028 


C-REC 


= 


8290001829 


CC = 


002 


HH 


= 


8 


EFPCF- 


•COND 


= COIOOOCO 
















TRACK- 


-ID = 


02 8 


C-REC 


= 


8290001829 


CC = 


002 


HH 


= 


9 


ERRCR- 


-COND 


= OOICCCCO 
















TRACK- 


-ID = 


0028 


C-REC 


= 


829000182S 


CC = 


084 


HH 


= 





TPACK- 


-IC = 


0028 


C-REC 


= 


8290CC1830 


CC = 


002 


HH 


= 


8 


ERRCR- 


-COND 


= CCICCCCC 
















TRACK- 


-IC = 


0028 


C-REC 


= 


8290001830 


CC = 


C02 


HH 


= 


9 


ERRCR- 


-CONE 


= COICOOCO 
















TRACK- 


-ID = 


0028 


C-REC 


= 


829CCC183C 


CC = 


084 


HH 


= 





TRACK- 


•ID = 


0028 


C-REC 


= 


8290C01831 


CC = 


002 


HH 


= 


8 


ERRCP- 


-CCND 


= COIOOOOO 
















TRACK- 


-ID = 


CC28 


C-REC 


= 


8290001831 


CC = 


002 


HH 


= 


9 


EPRCP- 


-CCNC 


= 00100000 
















TRACK- 


-ID = 


CC28 


C-PEC 


= 


8290C01831 


CC = 


084 


HH 


= 





TRACK- 


-IC = 


0028 


C-REC 


= 


8290001832 


CC = 


C02 


HH 


= 


8 


ERRCR- 


-CCND 


= CCICCOOO 
















TRACK- 


-IC = 


0028 


C-PEC 


= 


8290001832 


CC = 


002 


HH 


= 


9 


ERRCR- 


■CCND 


= COICOOOO 
















TRACK- 


-IC = 


0028 


C-REC 


= 


829CC01632 


CC = 


084 


HH 


= 





TRACK- 


-JC = 


CC26 


C-REC 


= 


8290001833 


Cf = 


002 


HH 


= 


8 


ERRCR- 


-CCND 


= CCICCCCO 
















TRACK- 


-ID = 


0028 


C-REC 


= 


8290CC1633 


CC = 


002 


HH 


= 


9 


ERRCR- 


-CCND 


= COIOOOOO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290001833 


CC = 


084 


HH 


= 





TRACK- 


•ID = 


CC28 


C-REC 


= 


8290001834 


CC = 


002 


HH 


= 


8 


ERRCR- 


•COND 


= OOICOOCO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290001834 


CC = 


002 


HH 


= 


9 


ERRCR- 


•COND 


= CCICCCCC 
















TPACK- 


-IC = 


0028 


C-REC 


= 


8290C01834 


CC = 


084 


HH 


= 





TRACK- 


•IC = 


0028 


C-REC 


= 


8290CC1835 


CC = 


CC2 


HH 


= 


8 


ERRCR- 


•CONC 


= CCICCCCO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290001835 


CC = 


002 


HH 


= 


9 


ERRCR- 


•CCNC 


= 00100000 
















TRACK- 


•ID = 


CC28 


C-REC 


= 


82900C1835 


CC = 


084 


HH 


= 





TRACK- 


-ID = 


CC28 


C-REC 


= 


8290001836 


CC = 


002 


HH 


= 


8 


EPFCP- 


-CCND 


= COIOOOOO 
















TRACK- 


•ID = 


CC28 


C-REC 


= 


8290001836 


CC = 


002 


HH 


= 


9 


ERRCR- 


-CONC 


= OOICOOCO 
















TRACK- 


-ID = 


0028 


C-REC 


= 


8290001836 


CC = 


084 


HH 


= 





TRACK- 


-JD = 


0028 


C-REC 


_ 


8290001837 


CC = 


002 


HH 


_ 


8 


ERROR- 


•COND 


= COIOOOOO 
















TRACK- 


•ID = 


0028 


C-PEC 


= 


8290C01837 


CC = 


002 


HH 


= 


9 


ERROR- 


•COND 


= COICOOCO 
















TRACK- 


•ID = 


CC28 


C-REC 


= 


8290001837 


CC = 


084 


HH 


= 





ERRQR- 


•COND 


= CCICCOOO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290001837 


CC = 


084 


HH 


= 


1 


TRACK- 


•ID = 


0028 


C-REC 


= 


8290001838 


CC = 


002 


HH 


= 


8 


ERROR- 


•COND 


= COICOOOO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290CC1838 


CC = 


002 


HH 


= 


9 


ERROR- 


•COND 


= COIOOCCO 
















TRACK- 


•ID = 


0028 


C-REC 


= 


8290CC183P 


CC = 


C8a 


HH 


= 


1 



® 



® 



Figure 30. Creating a Direct File Using Method B (Part 4 of 



4) 



Processing COBOL Files on Mass Storage Devices 119 



Figure 31 is a sample COBOL program 
which creates a direct file with relative 
track addressing using Method B. The 
sample program provides for the possibility 
of synonym overflow. Synonym overflow will 
occur if a record randomizes to a track 
which is already full. The following 
discussion highlights some basic features. 
Circled numbers on the program listing 
correspond to numbers in the text. 



® 



(D 



® 



Since the prime ntimber used as a 
divisor is 829, the largest possible 
remainder will be 828. 



If synonym overflow occurs, control is 
given to the USE AFTER STANDARD ERROR 
declarative specified in the first 
section of the Procedure Division. 
The declarative provides that any 
record that cannot fit on the track to 
which it randomizes will be written on 
the first subsequent track available. 



The standard error condition "no room 
found" is tested before control is 
given to the SYNONYM-ROUTINE. Other 
standard error conditions as well as 
invalid key conditions result in job 
termination (EOJ). 

ERROR-COND is the identifier which 
specifies the error condition that 



® 



(D 



® 



caused control to be given to the 
error declarative. ERROR-COND is 
printed on SYSLST whenever the error 
declarative section is entered. 
TRACK-ID and C-REC are also printed on 
SYSLST before execution of each WRITE 
statement. This output has been 
provided in order to facilitate an 
understanding of the logic involved in 
the creation of D-FILE. 



The first twelve records which 
randomize to relative track 18 are 
actually written on relative track 18. 



The next twelve records which 
randomize to relative track 18 are 
adjusted by the SYNONYM-ROUTINE and 
are actually written on relative track 
19. 



The next twelve records which 
randomize to relative track 18 are 
adjusted by the SYNONYM-ROUTINE and 
are actually written on relative track 
20. 



The last two records whi .h randomize 
to relative track 18 are adjusted by 
the SYNONYM-ROUTINE and are actually 
written on relative track 21. 



V- 






120 



// JOB METHODS 

// OPTION NDDECK, LINK, LIST, LISTX,SYM, ERRS 

// EXEC FCOBOL 



CBL QUOTE 
00001 
00002 
00003 
00004 
00005 
00005 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
OOOU 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 



IDENTIFICATION DIVISION. 
PROGRMl-ID. aETlODB. 
ENVIRONMENT DIVISION. 
CONFIGURATION SECTION. 
SOUaCE-ZDMPUTER. IBM-360. 
OBJECT-COaPUTER. IBII-360. 
INPUT-OUTPUT SECTION. 
FILE-CONTROL. 

SELECT D-FILE ASSI3N TO SYSOl 5 -DA-23 1 1 -D-MA3T ER 

ACCESS IS RANDOM 

ACTUAL KEY IS ACT- KEY. 

SELECT C-FILE ASSIGN TO SYS007-UR- 2540R- S . 
DATA DIVISION. 
FILE SECTION. 
FD 



ARE STANDARD. 



01 



FD 



01 



D-FILE 

LABEL RECORDS 

D-REC. 

05 PART-NJM PIC X (8) . 

05 NUH-ON-HAND PIC 9(4). 

05 PRICE PIC 9 (5) V99. 

05 FILLER PEC X (1 81 ) . 

C-FILE 

LABEL RECORDS ARE OMITTED. 

C-REC. 

05 PART-NUM PIC X (8) . 

05 NUa-ON-HAND PIC 9(4). 

05 PRICE PIC 9 (5) V99. 

05 FILLER PIC X ( 6 1) . 
WORKING- ST0RA3E SECTION. 
77 SAVE PIC S9(8) COMP SYNC. 

QUOTIENT PIC S9 (8) COMP SYNC. 

ACT-KEY. 

02 TRACK-ID PIC S9 (8) COMP SYNC. 

02 REC-ID PIC X(8) . 

ERROR-COND . 

02 FILLER PIC 99 VALUE ZERO. 

02 ERR PIC 9 VALUE ZERO. 

02 FILLER PIC 9(5) VALUE ZERO. 



77 

01 



01 



• Figiare 31. Creating a Direct File with Relative Track Addressing Using Method B 
(Part 1 of U) 



Processing COBOL Files on Mass Storage Devices 121 



© )® 



D0039 PROCEDURE DIVISION. 

OOOUO DECLARATIVES. 

00041 ERROR-PHOCEDUSE SECTION. USE AFTER STANDARD ERROR PROCEDJRE 

000a2 ON D-FILE GIVING ERROR-COHD. 

00043 ERROR-ROUTINE. 

00044 EXHIBIT NAMED ERROR-COND. 

00045 IF ERR = 1 30 TO SYNONYM-ROUTINE ELSE 

00046 DISPLAY "OTHER STANDARD ERROR " RE3-ID 

00047 GO TO EOJ. 

00048 SYNONYM-ROUTINE. 

00049 IF TRACK-ID IS LESS THAN 834, ADD 1 TO PRACK-ID. GO TO 

00050 WRITES. 

00051 END DECLARATIVES. 

00052 OPEN INPUT C-FILE 

00053 OUTPUT D-FILE. 

00054 READS. 

00055 READ C-FILE AT END 30 TO EOJ. 

00056 MOVE CORRESPONDING C-REC TO D-REC. 

00057 MOVE PART-NUM OF C-REC TO REC-ID, SAVE. 

00058 DIVIDE SAVE BY 829 GIVING QUOTIENT REMAINDER TRACK-ID. \ ^^ 

00059 WRITES. / \ly 

00060 EXHIBIT NAMED TRACK-ID C-REC. 

00061 WRITE D-REC INVALID KEY GO TO INVALID-KEY. 

00062 GO TO BEADS. 

00063 INVALID-KEY. 

00064 DISPLAY "IN7ALID KEY " REC-ID. 

00065 EOJ. 

00066 CLOSE C-FILE D-FILE. 
0067 STOP RUN. 



// LBLTYP NSD{01) r ^^ 

// EXEC LNKEDT < ' 



\._ -^ 



• Figure 31. Creating a Direct File with Relative Track Addressing Using Method B 
(Part 2 of 4) 



122 



// ASSGN SYS007,X'00C' 

// ASSGN SYS015,X'192' 

// DLBL MASTER, ,70/365, DA 

// EXTENT SYS025,11 1111, 1,0, 10,850 

// EXEC 



TRACK- 
TRACK- 
TRACK- 
TRACK- 
TRACK- 
TRACK' 
TRACK 
TRACK- 
TRACK- 
GRACK- 
TRACK- 
TRACK- 
TRACK- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK- 
ERROR- 
TRACK- 
TRACK' 
ERROR 
TRACK 



ID 
ID 
ID 
ID 
ID 
ID 
ID 

ID = 
•ID = 
•ID = 
•ID = 
•ID = 
•ID = 
•ID = 
■ID = 
•COND 
-ID = 
■ID = 
-COND 
-ID = 
-ID = 
-COND 
-ID = 
-ID = 
-COND 
-ID = 
-ID = 
-COND 
-ID = 
-ID = 
-COND 
-ID = 
-ID = 
-COND 
-ID = 
-ID = 
-COND 
-ID = 
-ID = 
-COND 
-ID = 
-ID = 
COND 
ID = 
ID = 
COND 
ID = 
•ID = 
•COND 
•ID = 



00000000 

00000001 

00000018 

00000018 

00000018 

00000018 

00000018 

00000018 

00000018 

00000018 

00000018 

00000018 

00000018 

00000018 

00000018 

= 00100000 

00000019 C- 

00000018 C- 
= 00100000 

00000019 C- 

00000018 C- 
= 00100000 

00000019 C- 

00000018 C- 
= 00100000 

00000019 C- 

00000018 C- 
= 00100000 

00000019 C- 

00000018 C- 
= 00100000 

00000019 C- 

00000018 C- 
= 00100000 

00000019 C- 

00000018 C- 
= 00100000 

00000019 C- 

00000018 C- 
= 00100000 

00000019 O 

00000018 C 
= 00100000 

00000019 C 

00000018 C 
= 00100000 

00000019 C 

00000018 C 
= 00100000 

00000019 C 



REC = 
REC = 
REC = 
REC = 
REC = 
REC = 
•REC = 
•REC ■■ 
•REC ■■ 
•REC ■■ 
-REC ■' 
-REC ■■ 
•REC 
-REC 
-REC 

-REC 
■REC 

-REC 
-REC 

-REC 
-REC 

-REC 
-REC 

-REC 
-REC 

-REC 
-REC 

-REC 
-REC 

-REC 
-REC 

-REC 
-REC 

-REC 
-REC 

-REC 
-REC 



82900000 

82900001 

8290001801 

8290001802 

8290001803 

8290001804 

8290001805 

8290001806 

8290001807 

8290001808 

8290001809 

8290001810 

8290001811 

8290001812 

8290001813 

8290001813 
8290001814 

8290001814 
8290001815 

8290001815 
8290001816 

8290001816 
8290001817 

8290001817 
8290001818 

8290001818 
8290001819 

■■ 8290001819 
: 8290001820 

: 8290001820 
: 8290001821 

: 8290001821 
: 8290001822 

: 8290001822 
= 8290001823 

= 8290001823 
= 8290001824 



© 



© 



-REC = 8290001824 



• Figure 31. Creating a Direct File with Relative Track Addressing Using Method B 
(Part 3 of 4) 



Processing COBOL Files on Mass Storage Devices 123 



TRACK-ID = 


00000018 C- 


REC = 


8290001825 


ERROR-COND 


= 00100000 




\ 


TRACK-ID = 


00000019 C- 


REC = 


8290001825 \ 


ERROR-COND 


= 00100000 






TRACK- ID = 


00000020 C- 


REC = 


8290001825 


TRACK-ID = 


000000 18 C- 


-REC = 


8290001826 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


REC = 


8290001826 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000020 C- 


REC = 


8290001826 


TRACK-ID = 


00000018 C- 


-REC = 


8290001827 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


■REC = 


8290001827 t 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000020 C- 


-REC = 


8290001827 i 


TRACK- ID = 


00000018 C- 


REC = 


8290001828 1 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


REC = 


8290001828 M 


ERROR-COND 


= 0,0100000 






TRACK-ID = 


00000020 C- 


REC = 


8290001828 M 


TRACK-ID = 


00000018 C- 


-REC = 


8290001829 W 


ERROR-COND 


= Q0100000 






TRACK-ID = 


00000019 C- 


-REC = 


8290001829 W 


ERROR-COND 


= 00100000 






TRACK-ID = 


0.0000020 C- 


-REC = 


8290001829 1 


TRACK-ID = 


00000018 C- 


REC = 


8290001830 1 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


REC = 


8290001830 \ 


ERROR-COND 


= 00100000 






TRACK-ID = 


Q0000020 C- 


REC = 


8290001830 \ 


TRACK-ID = 


00000018 C- 


-REC = 


8290001831 \ 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


-REC = 


8290001831 / 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000020 C- 


-REC = 


8290001831 / 


TRACK- ID = 


Q000 0018 C- 


REC = 


8290001832 1 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


REC = 


8290001832 1 


ERROR-COND 


= 00100000 






TRACK- ID = 


00000020 C- 


REC = 


8290001832 B 


TRACK-ID = 


00000018 C- 


-REC = 


8290001833 M 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


-REC = 


8290001833' M 


ERROS-COND 


= 00100000 






TRACK-ID = 


00000020 C- 


•REC = 


8290001833 M 


TRACK-ID = 


00000018 C- 


REC = 


8290001834 M 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


REC = 


8290001834 1 


ERROR-COND 


= 00100000 






TRACK-ID = 


OOQ00020 C- 


REC = 


8290001834 


TRACK-ID = 


00000018 C- 


-REC = 


8290001835 


ERROR-COND 


= 00100000 






TRACK-ID = 


00000019 C- 


REC = 


8290001835 


ERROR-COND 


= OOIOOOOO 






TRACK- ID = 


00000020 C- 


REC = 


8290001 835 


TRACK-ID = 


00000018 C- 


-REC = 


8290001836 


ERROR-COND 


= 0,0100000 






TRACK-ID = 


00000019 C- 


REC = 


8290001836 


ERROR-COND 


= 0,0100000 






TRACK-ID = 


00000020 C- 


REC = 


8290001836 / 


TRACK-ID = 


00000018 C- 


-REC = 


8290001837 \ 


ERROR-COND 


= OOIOOOOO 




TRACK-ID = 


00000019 C- 


REC = 


8290001837 


ERROR-COND 


= OOIOOOOO 






TRACK-ID = 


00000020 C- 


REC = 


8290001837 


ERROR-COND 


= OOIOOOOO 






TRACK-ID = 


00000021 C- 


REC = 


8290001837 \ 


TRACK-ID = 


00000013 C- 


-REC = 


829000 1838 / 


ERROR-COND 


= OOIOOOOO 






TRACK-ID = 


00000019 C- 


-REC = 


8290001838 


ERROR-COND 


= OOIOOOOO 






TRACK-ID = 


00000020 C- 


-REC = 


8290001838 


ERROR-COND 


= OOIOOOOO 






TRACK-ID = 


00000021 C- 


-REC = 


8290001838 



® 



V, y 



® 



• Figure 31. Creating a Direct File with Relative Track Addressing Using Method B 
(Part 4 of H) 



124 



ACTUAL TRACK ADDRESSING CONSIDERATIONS FOR 
SPECIFIC DEVICES 



Randomizing for the 2311 Disk Drive 



When randomizing for the 2311 Disk 
Drive, it is possible to circ\imvent the 
discontinous binary address by coding the 
randomizing fommula in decimal arithmetic 
and then converting the results to binary. 
This can be done by setting aside a decimal 
field with the low-order byte reserved for 
the head number, and the high- order bytes 
reserved for the cylinder number. A 
mathematical overflow from the head number 
will now increment the cylinder niimber and 
produce a valid address. The low-order 
byte should then be converted to binary and 
stored in the HH field, and the high-order 
bytes converted to binary and stored in the 
CC field of the actual key field. 



Randomizing to the 2311 Disk Drive 
should present no significant problems if 
the programmer using direct organization is 
completely aware that the cylinder and head 
nximber give him a unique track ntimber. To 
illustrate, the 2311 could be thought of as 
consisting of tracks numbered as follows : 



Track 
Numbers 



Cylinder Cylinder 1 Cylinder 2 
— 1 — 1 — V 



— ^ 

—\ 
—\ 

— ^ 



— ^ 

-H 

--^ 
~^ 

-H 

— ^ 



10 



19 



—^ 
—I 
— ^ 



20 



The programmer can make another use of 
this decimal track address. He may wish to 
reserve the last track of each cylinder for 
synonyms. If this is the case, he is in 
effect redefining the cylinder to consist 
of nine tracks rather than ten tracks. The 
2311 cylinder could then be thought of as 
consisting of track numbers, as follows: 



Cylinder Cylinder 1 Cylinder 2 



Track 
Numbers 



— 1 

— ^ 
— ^ 

— ^ 



-H 

— ^ 
— ^ 

-H 
-H 



18 



— ^ 



119 



— ^ 



I 20 



17 



— ^ 

I 
—I 

I 
— ^ 

I 
— i 

I 
— ^ 



26 



If the progra^nmer randomizes to relative 
track number 20, he can access it by 
dividing the track address by the number of 
tracks (9) in a cylinder. The quotient now 
becomes the cylinder number, and the 
remainder becomes the head number. 



2 = cylinder number 



9y~0020 
18 



2 = head number 



29 



o 



If the randomizing formula resulted in 
an address of cylinder 001, head 9: 

Cylinder | Head 
Number j Number 
+ 

001 I 9 

this would be a reference to track 19. 
This fact allows the programmer to ignore 
the discontinuous cylinder and head number. 
If his formula resulted in an address of 
0020, this would result in accessing 
cylinder 2, head 0, the location of track 
20. 



To simplify randomizing, an algorithm 
must be developed to generate a decimal 
track address. This track address can then 
be converted to a binary cylinder number 
and head number. In addition, tracks can 
be reserved by dividing the track address 
by the number of tracks in a cylinder. The 
same concepts will hold true for devices 
such as the 2314. For example, an 
algorithm can be developed using 20 tracks 
per cylinder and dividing by the closest 
prime number less than 20. 



Processing COBOL Files on Mass Storage Devices 125 



Randomizing for the 2321 Data Cell 



The track reference field for the 2321 
Data Cell is composed of the following 
discontinuous binary address: 

sub 
cell cell strip cyl. head record 



r T T 

1 


1 


-T- 
1 




1 


-T 

1 


-T- 




1 1 1 
1 M 1 B j B 


1 

1 c 
_i 


1 

1 

_J._ 


c 


1 
1 H 


1 

1 H 
_J. 


1 

1 

_J._ 


R 



0-9 0-19 0-9 0-H 0-19 



At first glance, this presents an almost 
impossible randomizing task; but since each 
strip includes 100 tracks that are 
accessible through cylinder and head 
number, the 2321 Data Cell can be 
considered to consist of consecutively 
numbered tracks. 



Tracks 



I Strip 
■+ 




•-99 



•►199 



•►999 



1099 



•"1999 



•"10099 



•►19999 



•-199999 





1 

9 

10 

19 

100 

199 

1999 



results in a quotient and remainder of 
zero. 

This relationship holds true through a 
relative track number of 19999, which is 
the ntmiber of tracks that can be contained 
on one cell of a data cell array. By 
applying the foregoing rules, an address of 
subcell 19, strip 9, cylinder H, head 19 is 
derived. 

Thus, by randomizing to a 5-digit 
decimal track number, the programmer will 
be able to access the 20,000 tracks 
(40,000,000 characters) contained in a 
cell. 

The thousands digits would represent the 
subcell number, the hundreds digit the 
strip number, and the quotient and 
remainder of the two low- order digits 
divided by 20 would represent the cylinder 
and head number. Each one of these 
resulting decimal digits would then be 
converted to binary and placed in the 
appropriate location in the track reference 
field. 

There is a total of 200,000 tracks per 
data cell array. To derive valid addresses 
that cross cell boundaries, the user should 
randomize to a 6-digit decimal track 
address. The highest address possible 
should be 199, 999. To convert this to a 
data cell address, similar rules apply. In 
this case, the user must divide the three 
high-order digits by 20: 



9 = cell 



20 7l99 
180 



It can be seen that relative track 20 is 
located on cylinder 1, head of some 
particular strip. Its address can be 
calculated by dividing by 20. 



1 = cylinder number 



/': 



20/ 20 
20 

= head number 

Thus, relative track number 120 will be 
located on strip 1, cylinder 1, head of 
some subcell. Note that the strip number 
is given by the hundreds digit, and the 
cylinder and head number are derived by 
dividing the two low-order digits by 20. 

The same relationship holds true for 
relative track number 900- It is located 
on strip 9, cylinder 0, track 0. Again, 
the hundreds digit gives the strip number, 
and dividing the two low-order digits by 20 



19 = subcell 



The quotient becomes the cell number and 
the remainder becomes the subcell number. 
The hundreds digit is still the strip 
number, and the cylinder and head number 
can be derived as previously illustrated. 
The resulting address is 0091994190 and 
woTild appear in the first eight bytes of 
the actual key field as follows: 

sub 
cell cell strip cyl. head 

r T T T T T T T 1 

I M I B I B I C I C I H I H I R I 

I + + 4 + + 4 4 H 

I I I 9 i 19 I 9 \ i\ I 19 I I 
I x_ X J X X X J J 



Randomizing to the data cell can be 
accomplished by developing an algorithm to 
generate decimal track addresses. The use 
of the foregoing rules makes it possible to 



126 



convert these generated track addresses to 
the appropriate discontinuous binary 
address.' 



INDEXED ORGANIZATION (DTFIS) 



PRIME AREA 



When the file is first created, or when 
it is subsequently reorganized, records are 
written in the prime area. Until the prime 
area is full, additions to the file may 
also be written there. The prime area may 
span multiple volumes. 



An indexed file is a sequential file 
with indexes that permit rapid access to 
individual records as well as rapid 
sequential processing. Error recovery from 
a DTFIS file is described in detail in the 
chapter "Advanced Processing Capabilities. " 
An indexed file has three distinct areas: 
a prime area, indexes, and an overflow 
area. Each area is described in detail 
below. 



The records in the prime area must be 
formatted with keys, and must be positioned 
in key sequence. The records may be 
blocked or unblocked. If records are 
blocked, each logical record within the 
block contains its key, and the key area 
for the block contains the key of the 
highest record in the block. The Disk 
Operating System permits fixed-length 
records only. Figure 32 shows the formats 
of blocked and unblocked records on a 
track. 



Unblocked Records 



I KEY NUMBER I 
L X- 

A 



"T T T T- 

I COUNT I KEY I DATA | 
-X X X X. 

A A 



"T r T r- 

I COUNT 1 KEY I DATA | 
-X X X X. 



L — Logical record (key embedded) 



»• — Key of logical record 



L — Highest key on track 



Blocked Records 



I KEY NUMBER 
L X 



X X X 



T T T T r T- 

COUNT I KEY I DATA j, DATA | DATA j j 
X X : X X. 



—Logical records with embedded keys 



' — Key of last logical record in block 



c 



1 



•• — Highest key on track 



J 



Figure 32. Formats of Blocked and Unblocked Records 



Processing COBOL Files on Mass Storage Devices 127 



INDEXES 



There are three possible levels of 
indexes for a file with indexed 
organization: a track index, a cylinder 
index, and a master index. They are 
created and written by the system when the 
file is created or reorganized. 



Track Index 



This is the lowest level of index and is 
always present. There is one track index 
for each cylinder in the prime area. It is 
always written on the first track of the 
cylinder that it indexes. 

The track index contains a pair of 
entries for each prime data track in the 
cylinder: a normal entry and an overflow 
entry. The normal entry contains the home 
address of the prime track and the key of 
the highest record on the track. The 
overflow entry contains the highest key 
associated with that track and the address 
of the lowest record in the overflow area. 
If no overflow entry has yet been made, the 
address of the lowest record in the 
overflow area is the dummy entry X"FF*. 



clause must be specified in the source 
program. When this clause is specified, 
the cylinder index is placed on the same 
device as the master index. 



OVERFLOW AREA 



There are two types of overflow areas : 
a cylinder overflow area and an independent 
overflow area. Either or both may be 
specified for an indexed file. Records are 
written in the overflow area(s) as 
additions are made to the file. 



Cylinder Overflow Area 



A certain number of whole tracks are 
reserved in each cylinder for overflow 
records from the prime tracks in that 
cylinder. The user may specify the number 
of tracks to be reserved by means of the 
APPLY CYL-OVERFLOW clause. If he specifies 
as the number of tracks in this clause, 
no cylinder overflow area is reserved. If 
the clause is omitted, 20% of each cylinder 
is reserved for overflow. 



Independent Overflow Area 



J 



Cylinder Index 



The cylinder index is a higher level of 
index and is always present. Its entries 
point to track indexes. There is one 
cylinder index for the file. It is written 
on the device specified in the APPLY 
CYL-INDEX clause. If this clause is not 
specified, the cylinder index is written on 
the same device as the prime area. 



Master Index 



The master index is the highest level 
index and is optional. It is used when the 
cylinder index is so long that searching it 
is very time consuming. It is suggested 
that a master index be requested when the 
cylinder index occupies more than four 
tracks. (A master index consists of one 
entry for each track of the cylinder 
index. ) 

The Disk Operating System permits one 
level of master index for the file and 
requires that it be written immediately 
before the cylinder index. If a master 
index is desired, the APPLY MASTER-INDEX 



Overflow records from anywhere in the 
prime area are placed in a certain number 
of cylinders reserved soley for this 
purpose. The size and location of the 
independent overflow area can be specified 
if the user includes the proper job control 
XTENT (or EXTENT) cards. The area must, 
however, be on the same mass storage device 
type as the prime area. 

A suggested approach is to have cylinder 
overflow areas large enough to contain the 
average number of overflow records caused 
by additions and an independent overflow 
area to be used as the cylinder overflow 
areas are filled. 



Adding Records to ah Indexed File 



A new record added to an indexed file is 
placed into a location on a track in the 
prime area determined by the value of its 
key field. If records in the file were 
placed in precise physical sequence, the 
addition of a new record would require the 
shifting of all records with keys higher 
than that of the one inserted. However, 
indexed organization allows a record to be 
inserted into its proper position on a 
track, with the shifting of only the 



c 



128 



PRIME DATA AREA 



Track No. 



0001 1 00001] 1 000031 
L J L J 



|00009| JOOOIOI |00011| 

L J L J L J 

A A 



New record J 

Original record moved up — 



J 



0002 1 000161 1 00017) 

L J L J 



000251 
J 



|00027| 

L J 



OVERFLOW AREA 



r n 

1000141 
L J 



^ 



•- Record removed from Track 0001 

Figure 33. Adding a Record to a Prime Track 



J 



records on that track. Any records for 
which there is no space on that track are 
then placed in an overflow area, and become 
overflow records. Overflow records are 
always fixed-length, unblocked records, 
foirmatted with keys. 

As records are added to the overflow 
area, they are no longer in key sequence. 
The system ensures, however, that they are 
always in logical sequence. 

Figure 33 illustrates the addition of a 
record to a prime track. 

The new record (00010) is written in its 
proper sequential location on the prime 
track. The rest of its prime records are 
moved up one location. The bumped record 
(OOOIU) is written in the first available 
location in the overflow area. The record 
is placed in the cylinder overflow area for 
that cylinder, if a cylinder overflow area 
exists and if there is space in it; 
otherwise, the record is placed in the 
independent overflow area. The first 
addition to a track is always handled in 
this manner. Any record that is higher 
than the original highest record on the 
preceding track, but lower than the 
original highest record on this track, is 
written on the prime track. Record 00015, 



for example, would be written as the first 
record on track 0002, and record 00027 
would be bumped into the overflow area. 



Subsequent additions are written either 
on the prime track where they belong or as 
part of the overflow chain from that track. 
If the addition belongs between the last 
prime record on a track and a previous 
overflow from that track (as is the case 
with record 00013), it is written in the 
first available location in the overflow 
area on an empty track, or on a track whose 
first record has a numerically lower key. 



If the addition belongs on a prime track 
(as would be the case with record 00005) , 
it is written in its proper sequential 
location on the prime track. The bumped 
record (record 00011) is written in the 
overflow area. 



A record with a key higher than the 
current highest key in the file is placed 
on the last prime track containing data 
records. If that track is full, the record 
is placed in the overflow area. 



Processing COBOL Files on Mass Storage Devices 129 



ACCESSING AN INDEXED FILE (DTFIS) 



An indexed file may be accessed both 
sequentially and randomly. 



ACCESSING AN INDEXED FILE SEQUENTIALLY ; An 
indexed file may only be created 
sequentially. It can also be read and 
updated in the sequential access mode. The 
following specifications may be made in the 
source program. 



ENVIRONMENT DIVISION 

Required clauses ; 

SELECT [OPTIONAL] file- name 

(2311) 
ASSIGN TO SYSnnn-DA-<2314>- I 

I2321) 
RECORD KEY Clause 

NOMINAL KEY Clause (when reading, if the 
START statement is used) 



Optional clauses ; 

FILE- LIMIT Clause 

ACCESS MODE IS SEQUENTIAL 

PROCESSING MODE IS SEQUENTIAL 

RERUN Clause 

SAME Clause 

APPLY WRITE- VERIFY Clause (create and 

update) 
APPLY CYL-OVERFLOW Clause (create) 



ACCESSING AN INDEXED FILE RANDOMLY : A 
randomly-accessed indexed file may be read, 
updated, or added to. The following 
specifications may be made in the source 
program: 

ENVIRONMENT DIVISION 

Required clauses ; 

SELECT [OPTIONAL] file-name 

(2311) 
ASSIGN TO SYSnnn-DA- < 231U > -I 

(2321) 
ACCESS IS RANDOM 
NOMINAL KEY Clause 
RECORD KEY Clause 



Optional clauses ; 

FILE LIMIT Clause 

PROCESSING MODE IS SEQUENTIAL 

TRACK-AREA Clause 

RERUN Clause 

SAME Clause 

APPLY WRITE VERIFY Clause 

APPLY CYL-OVERFLOW Clause 

APPLY CORE-INDEX Clause 



APPLY 



/ MASTER-INDEX 
) CYL- INDEX 



Clause 



c 



Invalid clauses : 

RESERVE Clause 
ACCESS MODE IS SEQUENTIAL 
ACTUAL KEY Clause 
MULTIPLE FILE TAPE Clause 
APPLY EXTENDED-SEARCH Clause 



( MASTER- INDEX) 

APPLY < Vclause 

( CYL- INDEX ) 



Key Clauses 



Invalid clauses : 

ACCESS MODE IS RANDOM 
ACTUAL KEY Clause 
TRACK- AREA Clause 
MULTIPLE FILE TAPE Clause 
APPLY WRITE-ONLY Clause 
APPLY EXTENDED-SEARCH Clause 
APPLY CORE- INDEX Clause 
RESERVE Clause 



When creating an indexed file, the only 
key clause required is the RECORD KEY 
clause. The data-name specified in this 
clause is the name of the field within the 
record that contains the key. Keys must be 
in ascending niomerical order when creating 
an indexed file. 



If a START statement is used when 
retrieving an indexed file sequentially, 
the NOMINAL KEY clause is required. 



130 



When accessing an indexed file randomly, 
both the NOMINAL KEY and RECORD KEY clauses 
ar« required. When reading the file, the 
data-name specified in the NOMlNi^L KEY 
clause is the key of the record which is 
being retrieved. The data-name specified 
in the RECORD KEY clause is the name of the 
field within the record that contains this 
key. 

When adding records to an indexed file, 
the data-name specified in the NOMINAL KEY 
clause is the key for the record being 
written and is used to determine its 
physical location. The data-name specified 
in the RECORD KEY clause specifies the 
field in the record that contains the key. 



Improving Efficiency 



When processing an indexed file, the 
following source language Environment 
Division clauses may be used to improve 
efficiency: 



TRACK-AREA Clause 
APPLY CORE-INDEX Clause 



For additional details, see the 
publication IBM System/360 Disk Operating 
System; American National Standard COBOL . 






Processing COBOL Files on Mass Storage Devices 131 



/- 



ADVANCED PROCESSING CAPABILITIES 



The following topics are discussed 
within this chapter: 

DTP Tables 

Error Recovery 

Voliime and File Label Handling 



DTFSD Mass storage device — 
organization and access 
sequential 



DTFDA Mass storage device — 

organization direct, access 
sequential or random 



DTF TABLES 



Whenever COBOL imperative- statements 
(READ, WRITE, REWRITE, etc. ) are used in a 
program to control the input and/or output 
of records in a file, that file must be 
defined by a DTF. A DTF is created by the 
compiler for each file opened in a COBOL 
program from information specified in the 
Environment Division, FD entry, and 
input/output statements in the source 
program. The DTF for each file is part of 
the object module that is generated by the 
compiler. It describes the characteristics 
of the logical file, indicates the type of 
processing to be used for the file, and 
specifies the main storage areas and 
routines used for the file. 



The DTF* s generated for the permissible 
combinations of device type and COBOL file 
processing technique are as follows: 



DTFCD Card reader, punch — 

organization and access 
sequential 



DTFPR Printer — organization and 
access sequential 



DTFMT Tape — organization and access 
sequential 



DTFIS Mass storage device — 

organization indexed, access 
sequential or random 



Because of their limited interest for 
the COBOL programmer, the contents and 
location of the fields of each of the DTF 
types are not discussed in this 
publication. However, there are certain 
fields which immediately precede the 
storage area allocated for the DTF which 
are pertinent and which are described 
below. 

For magnetic tape files (DTFMT) or 
sequentially organized files on mass 
storage devices (DTFSD), a 2U-byte Pre-DTF 
is reserved in front of the DTF. The 
fields of the Pre-DTF are shown in Table 
10. If any option is not specified, the 
field will contain binary zeros. 

When actual track addressing is used for 
files with direct organization and random 
access (DTFDA) , a variable-length Pre-DTF 
is reserved. The fields of the Pre-DTF are 
shown in Table 11. If any option is not 
specified, the field will contain binary 
zeros. 

When relative track addressing is used 
for files with direct organization and 
random access (DTFDA) , a variable-length 
Pre-DTF is reserved. The fields of the 
Pre-DTF are shown in Table 12. If any 
option is not specified, the field will 
contain binary zeros. 



Advanced Processing Capabilities 133 



• Table 10. Fields Preceding DTFMT and DTFSD 



jl byte I Number of reels (as specified in the ASSIGN clause) when file is opened^ 



byte 



Number of reels remaining (i.e., file not completely read)^ 



bytes 



Maximum record length if records are variable, blocked and APPLY WRITE-ONLY is 
not specified. 



bytes 



Address of label declarative with BEGINNING 



REEL" 
UNIT 



option 



4 bytes 



Address of label declarative with ENDING 



REEL' 
UNIT 



option 



bytes 



Address of label declarative with ENDING FILE option 



bytes 



Address of label declarative with BEGINNING FILE option 



byte 

+- 

bytes I 

L. 



Switch — FF if closed WITH LOCK; otherwise, the switch is used as shown in 
Table 16 

Address of USE AFTER STANDARD ERROR declarative 



DTFMT/DTFSD 



i^For INPUT files with nonstandard labels only. 

L 



-^ (' 



• Table 11. Fields Preceding DTFDA - ACCESS IS RANDOM - Actual Track Addressing 



r T- 

19-263 I 
I bytes I 



ACTUAL KEY^ 
SEEK Address 2 



I 8 bytes I 

I +- 

1 2 bytes I 



Error bytes ^ 

Address of file extent information 



|U bytes I 
I +. 

1 4 bytes I 

I- +■ 



Address of label declarative with ENDING FILE option 
Address of label declarative with BEGINNING FILE option 



I 4 bytes I 

I +- 

|1 byte I 

I i 
I- +- 

1 3 bytes I 
(. ±. 



Switch — FF if closed WITH LOCK; otherwise the switch is used as shown in 
Table 16 

Address of USE AFTER STANDARD ERROR declarative 



DTFDA 



j ^ACTUAL KEY specified in last executed WRITE statement 

l^in the form MBBCCHHR 

j^This area is reserved by the Supervisor and assigned the name ERRBYTE. For a 

I complete discussion, refer to the publication IBM Svstem/360 Disk Operating 

I System; Supervisor and Input/Output Macros , Form GC24-5037. 

L 



13U 



Table 12, Fields Preceding DTFDA - ACCESS IS RANDOM - Relative Track Addressing 

■T 



5-258 

bytes i ACTUAL KEY^ 



4 bytes i SEEK address^ 



3 bytes I Last extent used^ 
I + 

1 byte I Not used 



2 bytes | Error bytes'* 
I + 

1 byte I Index to last extent used in the Disk Extent Table 



3 bytes I Address of Disk Extent Table in the DTP 

I + 

4 bytes | Address of label declarative with ENDING FILE option 



4 bytes I Address of label declarative with BEGINNING FILE option 
I + 

1 byte I Switch — FF if closed WITH LOCK; otherwise the switch is used as shown in 
I Table 16 



3 bytes I Address of USE AFTER STANDARD ERROR declarative 

JL 



DTFDA 



^ACTUAL KEY specified in the last executed WRITE statement 

2 In the form TTTR 

3 In the form TTT 

**This area is reserved by the DOS Supervisor and assigned the name ERRBYTE. For a 

complete discussion, refer to the publication IBM Svstem/360 Disk Operating 

System; Supervisor and Input/Output Macros . 



Advanced Processing Capabilities 135 



When actual track addressing is used for 
files with direct organization and 
sequential, access (DTFDA), a 31- byte 
Pre-DTF is reserved. The fields of the 
Pre-DTF are shovm in Table 13. If any 
option is not specified, the field vdLll 
contain binary zeros. 

When relative track addressing is . used 
for files with direct organization and 



sequential access (DTFDA) , a 31-byte 
Pre-DTF is reserved. The fields of the 
Pre-DTF are shown in Table 14, If any 
option is not specified, the field will 
contain binary zeros. 



For files whose organization is indexed, 
only four bytes are reserved preceding the 
DTF, as shown in Table 15. 



• Table 13. Fields Preceding DTFDA - ACCESS IS SEQUENTIAL - Actiial Track Addressing 

r T 

I 8 bytes I SEEK address^ 

I 4 



j5 bytes|IDL0C2 



I 2 bytes | Error bytes ^ 

I + 

I U bytes | Address of file extent information 

I'- 



ll bytes I Address of label declarative with ENDING FILE option 

I 1 

lU bytes I Address of label declarative with BEGINNING FILE option 



jl byte j Switch — FF if closed WITH LOCK; otherwise the switch is used as shown in 
I I Table 16 



|3 bytes I Address of USE AFTER STANDARD ERROR declarative 
y J. 



DTFDA 



I 

l^ln the form MBBCCHHR 

I ^Address (returned by the system) of next record in the form CCHHR 

I^This area is reserved by the DOS Supervisor and assigned the name ERRBYTE. For a 

I complete discussion, refer to the publication IBM System/360 Disk Operating 

I System: Supervisor and Input/Output Macros . 

L 



y 



136 



• Table 14. Fields Preceding DTFDA - ACCESS IS SEQUENTIAL - Relative Track Addressing 

"\ r T 

J I 4 bytes I SEEK address^ 

I + 

1 3 bytes I Last extent used^ 

^ + 

II byte I Not used 

I j^ 

1 4 bytes|IDL0C3 

|. 4. 

11 byte I Not used 

I + 

12 bytes I Error bytes** 
I- -h 



jl byte j Index to the last extent used in the Disk Extent Table 
I + 

13 bytes I Address of Disk Extent Table in the DTF 

\ +- 



J4 bytes j Address of label declarative with ENDING FILE option 

I + 

14 bytes I Address of label declarative with BEGINNING FILE option 

jl byte I Switch — FF if closed with LOCK; otherwise the switch is used as shown in 
I I Table 16 



J3 bytes j Address of USE AFTER STANDARD ERROR declarative 
I J. 



DTFDA 

I 

I^In the form TTTR 

I ^in the form TTT 

I^Address (returned by the system) of the next record in the form TTTR 

('♦This area is reserved by the DOS Supervisor and assigned the name ERRBYTE, For a 

I complete discussion, refer to the publication IBM Svstem/360 Disk Operating 

I System Supervisor and Input/Output Macros . 



Table 15. Fields Preceding DTFIS 

II byte I Switch — FF if closed WITH LOCK; otherwise the switch is used as shown in I 
I I Table 16 I 

I + ^ 

1 3 bytes j Address of USE AFTER STANDARD ERROR declarative j 

DTFIS 



Advanced Processing Capabilities 137 



Some files can be opened several 
different ways in one COBOL program. 

For DTFCD and DTFPR, only one DTF will 
be generated for each file. 

For DTFMT, a maximum of three DTF's may 
be needed — one each for OPEN INPUT, OPEN 
INPUT REVERSED, and OPEN OUTPUT. 

For DTFSD, a maximiim of three DTF'S may 
be needed — one each for OPEN INPUT, OPEN 
OUTPUT, and OPEN I-O statements. 

For DTFIS, a maximum of two DTF* g may be 
needed. If access is sequential, one DTF 
for "load" and one for "retrieve" may be 
heeded. If access is random, only one DTF 
need be generated at a time. 

For DTFDA, only one DTF is needed. 



Pre-DTF Switch 



When used, this switch provides 
communication between the executing program 
and its input/output subroutines at 
execution time. The entire byte may be set 
to X'FF' :to indicate that the file was 
closed WITH LOCK and cannot be reopened. 
Otherwise the switch is used as shown in 
Table 16. 



ERROR RECOVERY 



COBOL allows the user to handle 
input/output errors through 1) the INVALID 
KEY clause for certain source language 
statements, and 2) the USE AFTER STANDARD 
ERROR declarative sentence. 

Input/output errors caused by the 
program can be recovered from directly by 



the procedure specified in the INVALID KEY 
clause. That is, when the system 
determines that an invalid key condition 
exists, control is returned to the user at 
the imperative-statement specified in the 
INVALID KEY clause. An invalid key 
condition can occur on files with direct or 
indexed organization and on sequentially 
organized disk files. The errors that 
cause an invalid key condition are shown in 
Table 17. 

• Table 16. Meaning of Pre-DTF Switch 

r T ^ 

I Bit I Meaning, if ON | 



Turned ON the first time a DTFSD 
output file is opened. The entire 
DTF is saved for subsequent OPEN 
OUTPUT statements. 



h- 



h- 



Turned ON when DTFDA or DTFSD files 
are opened I-O. 



This bit is ON to indicate 
beginning of volume user label 
processing. The bit is set OFF 
when a file is opened to indicate 
to the user label processing 
subroutine (ILBDUSLO) that 
beginning-of-file user labels are 
to be processed. That sxabroutine 
sets the bit ON after beginning- 
of-file processing to indicate that 
all subsequent calls for this 
subroutine are for beginning-of- 
volume user label processing. 



For output files with variable- 
length blocked records, this bit is 
turned OFF when a file is opened 
and ON for all WRITE' s after the 
first. 



H 



Turned ON for spanned record 
processing on a DTFDA file. 



5-7 j Not used. 
± 



138 



""V. 



Table 17. Errors Causing an Invalid Key Condition 



T T 

I-O Verb 



Organization 



ACCESS 



OPEN 



Condition 



h- 



Sequential 



[SEQUENTIAL] 



OUTPUT 



WRITE 



End of extents reached. 

Track address outside file extents. 



Direct 



[SEQUENTIAL] 
RANDOM 



OUTPUT 



WRITE 



Direct 



H- 



INPUT 



READ 



OUTPUT 



WRITE 



I-O 



READ 
REWRITE 



No record found. 

Track address outside file extents. 

Track address outside file extents. 



Indexed 



[SEQUENTIAL] 



INPUT 
I-O 



START 



No record found. 



OUTPUT 



WRITE 



RANDOM 



INPUT 

I-O 
J. 



READ 

+ ^ 

REWRITE 



Duplicate record; sequence check. 
No record found. 



I-O 



WRITE 



Duplicate record. 



C) 



Other input/output errors cause the job 
to be cancelled \inless the user has 
specified a USE AFTER STANDARD ERROR 
declarative. Control is transferred to 
this declarative section if the system 
determines that a "standard" error has 
occurred during input/output processing. 
In this declarative section, the user may 



interrogate the COBOL error bytes if he has 
specified the GIVING option of the USE 
AFTER STANDARD ERROR declarative sentence. 
The meaning of these bytes for a specified 
combination of device type and file 
processing technique is shown in Table 18. 



Advanced Processing Capabilities 139 



Table 18. Meaning of Error Bytes for GIVING Option of Error Declarative (Part 1 of 2) 

r T T T T T T T 1 






I 

Tape 



Device 



Unxt 
record 



+-- 



Organization 



Sequential 



ACCESS 



[SEQUENTIAL] 



OPEN 



I/O 
Verb 



Condition 



Input/output 
error 



Byte 



Result 



File must be closed 
and job must be 
terminated. 



Sequential 



[SEQUENTIAL] 



INPUT 



READ 



Wrong length 
record 



S]dLp block if 

return is made to 

non-declarative 

portion. 



Parity error 



Skip block if 

return is made to 

non-declarative 

portion. 



OUTPUT 



WRITE 



All exceptional conditions are handled 
by the system. 



DASD 



Sequential 



[SEQUENTIAL] 



INPUT 
I-O 



READ 



Wrong length 
record 



j. 

OUTPUT 
1-0 



I 

Parity error 






WRITE 



Parity error 



Wrong length 
record 



Skip block if 

return is made to 

non-declarative 

portion. 

1 I Bad block written. 



Skip block if 

return is made to 

non-declarative 

portion. 



Bad block written. 



DASD 



Direct 



[SEQUENTIiy^] 



INPUT 



READ 



Wrong length 
record 



Return to statement 
ctfter READ. 



Data check in 
count area 



Return to statement 
after READ. 



Data check for 
key and/or 
data 



Return to statement 
after READ. 



I 

DASD 



Direct 



RANDOM 



INPUT 
1-0 



READ 



Same as ACCESS SEQUENTIAL (above). 



OUTPUT 



WRITE 



Wrong length 
record 



Data check in 
count area 



I 

Data check for 
key and/or 
, data 



No room found 



Return to next 
statement; bad 
block written. 



Return to next 
statement ; bad 
block written. 



Return to next 
statement; bad 
block written. 



Ret\irn to next 
statement. 



Note: If no USE AFTER STANDARD ERROR routine is specified and one of the above 



conditions occurs, the user is notified of the condition and the job is cancelled. 



mo 



Table 18. Meaning of Error Bytes for GIVING Option of Error Declarative (Part 2 of 2) 



Device 



Organization 



ACCESS 



OPEN 



I/O 
Verb 



Condition 



Byte 



Result 



DASD 



Direct 



RANDOM 



I/O 



REWRITE 



Wrong length 
record 



Return to next 
s ta t ement ; bad 
block written. 



Data check in 
count area 



Return to next 
statement ; bad 
block written. 



Data check in 
key and /or 
data 



Return to next 
statement ; bad 
block written. 



DASD 



Indexed 



[SEQUENTIAL] 



INPUT 
I-O 



READ 
REWRITE 



DASD error 



Wrong length 
record 



Return to next 
statement; bad 
block read or 
written. 



START 



DASD error 



-+- 



Continued pro- 
cessing of file 
permitted. 



OUTPUT 



WRITE 



DASD error 



Wrong length 
record 



Return to next 
statement; bad 
block written. 



Prime data 
area full 



File must be 
closed. 



Cylinder index 
full 



File must be 
closed. 



Master index 
full 



File must be 
closed. 



h" 



4 



DASD 



Indexed 



RANDOM 



INPUT 
1-0 



READ 
REWRITE 



DASD error 



I 

Wrong length 
record 



Return to next 
statement; bad 
block read or 
written. 



1-0 



WRITE 



DASD error 



Wrong length 
record 



Ret\rrn to next 
statement; bad 
block written. 



Overflow area 
full 



Files must be 
closed. 



1-- 



Note: If no USE AFTER STANDARD ERROR routine is specified and one of the above 



conditions occurs, the user is notified of the condition and the job is cancelled. 



If the user includes a USE AFTER 
STANDARD ERROR routine without specifying 
the GIVING option, he must call an 
assembler language routine within the 
declarative if he wishes to interrogate the 
error bits — set either in the DTF (DTFMT, 
DTFSD, or DTFIS) or in the fields preceding 
the DTF (DTFDA). 



Interrogation of these error bits should 
be made to the locations shown in Tables 
19, 20, 21, and 22. 



Note: The byte and bit displacement in 
Tables 19, 20, 21, and 22 is relative to 
zero. 



Advanced Processing Capabilities 141 



Table 19. Location and Meaning df Error Bits for DTFMT 



OPEN 



I 

I INPUT 



Verb 



condition 



j Byte^ 



Bit 



READ 



Wrong length record 



Parity error 



OUTPUT 



WRITE 



j. _J.-. 

I ♦Within the DTF. 



Wrong length record 
Parity error 



Table 20. Location and Meaning of Error Bits for DTFSD 

I OPEN I Verb I condition j Byte* 



I + 

I INPUT, I-O I 



j. 4--. 

I OUTPUT, 1-0 I 
|. X— . 

|*Within the DTF. 

L .; 



READ i Wrong length record 
|. 

I Parity error 



Bit 

1 



WRITE 



j Parity error 

.X 



Table 21. Location and Meaning of Error Bits for DTFDA 

r T T T 

I ACCESS I OPEN I verb | Condition 



T T 

Byte* 



Bit 



I SEQUENTIAL] 



INPUT 



READ 



Wrong length record 



Data check in count area 



Data check in key or data 



No record found 



2 or 4 



RANDOM 



INPUT, 1-0 



READ 



Same as sequential 



OUTPUT 



WRITE 



Wrong length record 



No room foiind 



Data check in count area 






Data check in key or data 



1-0 



REWRITE 



Wrong length record 



Data check in count area 



Data check in key or data 



No record found 



2 or U 



♦Within error bytes preceding DTF. See the section "DTF Tables" for the location of 
these bytes. 



142 



Table 22. Location and Meaning of Error Bits for DTFIS 

I T T T 

ACCESS OPEN 1 Verb I Condition 



h- 



T T 

Byte* 



Bit, 



[SEQUENTIAL] 



H- 



INPUT, I-O 



OUTPUT 



READ 



DASD error 



Wrong length record 



WRITE 



DASD error 



Wrong length record 



Prime data area full 



Cylinder index full 



Master index full 



30 



30 



30 



30 



30 
30 
30 
30 



RANDOM 



INPUT, 1-0 



READ 
REWRITE 



DASD error 



Wrong length record 



1-0 



WRITE 



DASD error 



Wrong length record 



Overflow area full 



30 
30 
30 
30 



j*Within the DTF. 

L 



The following should be considered when 
processing tape input files: 



1. Two types of errors are returned to 
the user: wrong length record and 
parity check. The COBOL error bytes, 
if requested, are set to reflect the 
error condition and control is 
transferred to the USE AFTER STANDARD 
ERROR declarative sentence. The error 
block is made available at data-name- 2 
of the GIVING option, if specified. 



If a parity error is detected when a 
block of records is read, the tape is 
backspaced and reread 100 times before 
control is rettirned to the user. If 
the error persists, the block is 
considered an error block and is added 
to the block count found in the DTF 
table. 



2. Normal return (to the non-declarative 
portion) from a USE AFTER STANDARD ' 
ERROR declarative section is through 
the invoked IOCS subroutine. Thus, 
the next sequential block is brought 
into main storage permitting continued 
processing of the file. (The error 
block is bypassed. ) A retiirn through 
the use of a GO TO statement does not 
bring the next block into main 
storage; therefore, it is impossible 
to continue processing the file. 

The processing of a sequential disk file 
opened as input is the same as the previous 
discussion of tape files, except that the 
disk block is reread ten times before being 
considered an error block. 

COBOL cannot handle nested errors on 
sequential files. If errors occur within 
an error declarative, results are 
unpredictable. 



Advanced Processing Capabilities 143 



VOLUME AND FILE LABEL HANDLING 



TAPE LABELS 



Among the several types of tape labels 
allowed under the Disk Operating System 
are: volume labels, standard file labels, 
I user standard labels, and nonstandard 
labels. Unlabeled files are also 
permitted. The description of each type of 
label follows. 



the Disk Operating System. The contents of 
the fields of a standard file label are 
described in "Appendix B: Standard Tape 
File Labels." The relationship between the 
TPLAB statement and a standard file label 
is shown in Figure 34. The relationship 
between the TLBL statement and a standard 
file label is shown in Figures 35 and 36, 



User Labels 



z^- 



Volume Labels 



A volume label is used whenever standard 
file labels are used. Logical IOCS 
requires a volume label with VOLl as its 
first four characters on every standard or 
user labeled file. VOL2-VOL8 are also 
allowed, but must be written and checked by 
the user. 



Standard File Labels 



A user standard label is an 80-character 
label having UHL (user header label) or UTL 
(user trailer label) in the first three 
positions. The fourth position contains a 
number 1 through 8 which represents the 
relative position of the user label within 
a group of user labels. The contents of 
the remaining 76 positions are entirely up 
to the user. User labels, if present, 
follow HDR, EOV, or EOF standard labels. 
On multi volume files, they may also appear 
at beginning- of -volume. User header labels 
are resequenced starting with one (UHLl) at 
the beginning of a new volvime. Figure 37 
shows the positioning of user labels on a 
file. 



A standard file label is an 80-character 
label created when an output file is opened 
or closed, in part by IOCS using the VOL 
and TPLAB or TLBL control statements. The 
first three characters are HDR (header), 
EOV ( end-of- volume ) , or EOF (end-of-file) . 
The fourth character is a 1, indicating the 
first of a possible eight labels. The 
remainder of the label is formatted into 
fields describing the file. Labels 2 
through 8 in this field are bypassed on 
input, and are not created on output under 



Nonstandard Labels 



A nonstandard label may be any length. 
The contents of a nonstandard label is 
entirely user- dependent. It is the COBOL 
user's responsibility either to process or 
bypass nonstandard labels on input and to 
create them on output. Figure 38 shows the 
positioning of nonstandard labels on a 
file. 



lUU 



Standard Tape File Label 



3 
O 
(D 
pi 

h 
O 
O 

n> 

(0 

en 
o 

(u 

tr 

H- 
H 
H' 
ft 
H- 
(D 

cn 





- Label Identifier 

r- File Label Number 










1- 


Version Number 
of Generation 




r- File Security 






® < 


i 


File identifier 


File Serial 
Number 


(?) 

Volume 
Sequence 
Number 


File 
Sequence 
Number 


Si 

c E 

oz 


® 


Creation Date 
b y y d d d 


b y y d d d 


System G>de 




( Resert^ed 
for A. S. A.) 


-II" 


■>«• 


"M 1 1 1 1 1 1 l~ 


si 1 1 1 Ift 


sill" 


toj 1 jo 


si 1 Ift 


sb 


5?l 1 1 1 |5J 


51 1 1 1 IS 


^ 


!8| II 1 Is 


5i I 1 1 1 1 1 i 1 1 r iR 


Rl 1 1 1 1 IS 



iHD Rili 
|EOFl ; 
I E O V! ! 




(InHDRI) 



DOS/TOS/360bbibbbbbbb>*i 



Supplied 
by IOCS 

Job Control TPLAB Card(s) (May be punched with fields 1 - 10 or 1 - 13) 



Supplied by IOCS on output 

if TPLAB specifies fields 1 - 10 only 






System 

Code 

(Cortt'd) 

00000000000000000000000 
I : 3 4 s t ) I 1 10 II 12 II 14 ISM 17 It li » :i a zi» 
t < 1 1 1 1 1 1 I < < 1 I 1 



10 j,; g' "'0000000000000000000000000000000000000000000 

J4 SVmtin' '*""' 'j|Ji40 4l4I43444}4«47 4»4IS0 5U2aS4HK«S»Hi0HB«MKI»«Jlin«ll7J71I4n»nn»» 



Opera- 
tion 

00000 

4 S i 7 • 

11111 

22222 
33333 
44444 

55555 
66666 
77777 
6SS88 



99S999 



File Identifier 
00000000000000000 

II 12 I) 14 IS H 17 II II X 21 22 » M 2S » 27 

II I I 1 1 1 U 1 1111111 
2 2 2 2 2 2 2V1 2 2 2 2 2 2 2 2 
33333333333333333 
44444444444444444 
55SSS55S555555S55 



File 

Serial 

No. 

000000 

il 21 « 3t )2 i) 

1 1 1JL1 1 



S666666C666666666666666 



77777777777777777 
88888888888888888 



H 9 U 9 9 9 9 9 9 9 9 9 S 9 S 9 9 9 9 9 S 9 

II 12 13 14 IS 11 17 II II 21 21 a 23 24 2S 3( 27 






2 2 2^/2 
333333 
444444 

555555 



777777 
888888 



Vol. 
Seq. 
No. 

0000 

M3S3I37 

3333 
4444 

5555 
6666 
7777 
8888 

9999 



» h 1 i I 1 1 1 1 1 I 1 I I I 1 1 1 1 1 1 H I 1 1 1 1 1 1 1 1 1 H I 1 1 1 1 1 11 1 ij 11111111111 

222222222222 



File 
Seq. 
No. 

0000 

31 31 40 41 

2Vr2 

3333 
4444 
5555 

6666 
7777 
8888 

9999 



12 4] 44 43 « 47 U |H so ^1 S2 S] 34*33 SC f 7 SI H 



2Vf2 

3333 
4444 
5555 
6666 
7777 
8888 
99S9 

34 33 31 37ba 31 41 41 U 4) 41 4S 



Gener- 
ation 
No. 

0000 



IJJI 



00 



Creation Expiration 



Date 

-I — I 

b'Yr.iDay 

o;oolooo 



Date 



lilUl 1 1 



0,®;,® 



. . - , . I mo) m) 02) 

l,2\/2 2l2'2 Vz brilWl 2 



3I3 3<3 3 3 
I I 

4'4 4H4 4 
' I 

5!5 5>S5 5 
■ I 

6i8 6|6 6 6 
I ' 

7'7 7l7 7 7 



8>8 8«8 8 

I I 

9;9 9|9 9 9 
II (IS SI ^1 an 



b'Yr.lDay 

oioo|ooo 



Block 
Count 



System 
Code 

00000 

n I 13 13 M tS Kk7 II H 70 71 



100000 



MU.11 



3;3 3|3 3 3 

4I4 4J4 4 4 
I ' 

5;5 5jS5b 

6'6 6)6 6 6 

7l7 7i7 7 7 
I I 

8*8 80 8 8 

: ' 

9i9 9!9 3 9 

S4>Si^lSIJI 



3 133333 

4 144444 

5 15 555 5 

6 166668 

7 177777 
188888 

9 I99SS9 

» I 12 13 M 13 Hk7 W n 70 71 



1 1 11 1 

2>^n 

33333 
44444 

55555 
66666 
77777 
88888 

99999 



)0000000 

12 3 74 IS 7« 77 71 71 H 
111111111 

? !222222? 

3 S3333333 
14444444 
)5555555 
36666666 

mimi 

:86K8888 



19999939 

3 74 73 7« 7) 71 73 M 



//|tplab|' 

»- Blank -I 1-8- 



333333333333 
444444444444 
5555SS5S5553 
6668S6666S66 
777777777777 
888888888888 
99999S9999S3 

ISn I' 72 >3 14 >S7i )l f. 1310 



Continuation card 
(required if fields 
1-13 are used) 



8-5 punch 



t J 

•-Blank—* 



The circled numbers on the TPLAB cards correspond to the 
numbered fields of the tape label above. 



oooooo 



Any character 



__ Quote (8-5 punch) if only Fields 1-10 ore used 
Security code if Fields 1-13 are used 



4= 



Figure 3M,. Standard Tape File Label and TPLAB Cards 



Standard Tape File Label 



[ 



Label Identifier 

File Label Number 



Version Number 
of Generation 




Supplied 
by IOCS 



Job Control TLBL Card 



Supplied by IOCS __ 
on output 



Oper- 
ation 

0000 

4 5(7 

I 1 11 

2222 
3333 



44444 



5555 
6666 
777? 
S888 

ft •> ij 



File Name 



E 

E 



ooooooc 

S It II 12 I) 14 IS 

1111111 

222222 

333333 

444444 

555555 

666666 

7 7.7 77 77 

6868888 

sgqssss 

J 10 II 12 13 14 I! 



File-ID 



100 

11*20 

I 1 1 

122 
133 
U4 
i55 
366 

m 

i38 



&3E3S 

17 |l II 20 



oooooooooooooi 

2l22 2)2423<!«272l2i30 3l»U) 
1111111111111 

2222222222222 
333333333^333 
4444444444444 

5555555555555 
6666666666666 
7777777777777 
8833888888888 
9 9 9 9 9 9 9 9 3 3 9 S 9 S 

2I222]242)4272I]|]0)I32U 



Date 



00000 

■ |7 M M 40 41 42 

1 M 1 1 11 

2 222222 

3 133333 
4144444 

5 )55555 

6 166666 

7 777777 

8 388888 
3B99999 

■ |7 31 H 40 41 



File 

Serial 

No. 

000000 

M 4S 41 47 40 4) 
111111 

222222 
333333 
444444 
555555 
668666 
777777 
888888 



00000 



Vol. 

Seq. 

,^ No. 



[1000 

90KlUS3Mb9 i(»M 



9999999 

M 43 4( 47 a 40 



File 
Seq. 
^No. 





11111 

22222 

33333 

4444 

55555 
6S666 
77777 
88888 
9B999 

90klS2UMiubs7Sia|l0 



nil 

2222 
33333 
41444 

5b555 
616666 
77777 
89888 
9I9399 



Gener- 
ation 
No. 

0000 

(I (31) 04 
1111 

2222 
3333 
4444 

5555 
6666 
7777 
8888 
9999 

(l(2U(4 



10 
U (07 

in 1 
222 

3 13 
414 

5 )5 

6 S6 
777 



9B 
hUn 



0000000000000 

iO (S 70 71 7} 73 74 7S 70 77 71 70 00 
1111111111111 

2222222222222 
3333333333333 
4444444444444 

5555555555555 
6666666666666 
7777777777777 
3883838888888 
99999399£93g3 

H to 70 71 73 73 74 7S 7t 77 71 70 BO 



//ATLBLJ 
L Blank -I 



DTF 

Name 4_ 



8-5 punch- 



Date - yy/d or yy/dd or yy/ddd (on Input or Output) 
Retention Period - d-dddd (on Output only) 



Notes: 

1 Maximum size TLBL fields 
are shown, 

• Any field (except kJent, 
Operation, and Date) 
may be from 1 position to 
the maximum shown. IOCS 
fills in the remaining 
positions of the label field. 

• Ident and Operation must 
be as shown. 

• Date may be 4- 6 positions; 
Retention period, 1 - 4. 

2 If a field is omitted, shift the 
following comma arxl fields 
to the left. 

IOCS supplies a default value 
for the label field on output. 

3 No comma follows the last 
field used. 



Figure 35. Standard Tape File Label and TLBL Card (Showing Maximum Specifications) 



File-ID 



V y 



o 



^ 






'■/ 



Standard Tape File Label 



r 



Label Identifier 

File Label Number 



L 



® dXD 



File 
Sequence 
N umber 



* 



Version Number 
of Generation 



w 



w 



File Security 



File Identifier 



© 



File Serial 
Number 



Volume 
Sequence 
N umber 



Creation Dote 
b y y d d d 



Expiration 

Date 

b y y d d d 



Block Count 



® 







System Code 



(Reserved 
for A. S. A.) 



—I Iro ^ in 



,H Ril 
jE OF! 
• E OV! 



DTF Name 



bbbbbbbbbb 



Volume 
Serial 
Number 



10 1 



10 1 



Today's Date 



Today's Date lO 



00000 0;DOS/TOS/36 Ob b 
(InHDRI) I 



Supplied 
by IOCS 



Job Control TLBL Card 



b b b b b b b 



Default values ^ 
supplied by IOCS >^— 
for an output file.) 

On input, no values 
are supplied and no 
checking is performed. 



3 
O 
(t> 
pj 

H3 
H 
O 
O 

n> 

CO 

w 

o 

tr 

H 
H' 
(+ 
H' 
O 
W 



Oper- 
ation 



0000 

4 9 17 

I 1 11 



Z222 

3333 

4444 

5 5 5S5 

66666 

7 7777 

8888 

99999 

3 4 5(7 



919999999 

a i 10 11 I2l)l4:t5~ 



File Name 
100000000000000000000000000000000000000000000000000000000000€GOOOOOOOOOC 

9 10 II i: 1] 14 t5 16 )> II 13 20 21 22 21 24 2^ 2e :7 a 29 » II 32 jj 3< JS X 37 M 39 « 41 42 43 44 4S 4S 47 43 <3 so SI U S3 S4 U U S> St U U (I (2 t3 M U M 17 II n 70 71 72 73 74 TS 71 77 n 79 n 
111111111111111111111111111111111111111111111111111111111111111111111111 

b22222222222222222222222222222222222222222222222222222222222222222222222 
1333333333333333333333333333333333333333333333333333333333333333333333333 ± 

o 

144444444444444444444444444444444444444444444444444444 44 44444444444444444= 
I55555555S5S55555S555555555555555S555555555555555555555555555555S55555555 
S66666666666666666666666666666666666666666666666666666666866666666666666 
17 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 
88888888888888888888888888888888888888888888888888888888888888888 
99999999999999999999999999999999999999999999990999999999999999999 

1117 11 19 20 21 22 23 24 23 2(27212930 31 323334353(37 313040 41 424344 4S« 47 a4SS0MS2S]MSS5l 57 MSini1l2aMeBt7tinn7l737374797tn7t7SH 



// 



tT L B L I 
-BlankJ 



DTF 
Name 






Figure 36. Standard Tape File Label and TLBL Card (Showing Minimiom Requirements) 



LABEL PROCESSING CONSIDERATIONS 



The labels which may appear on tape are 
shown in Figures 37 and 38. The compiler 
allows the user to work with all the 
previously mentioned labels as well as with 
unlabeled files. 



If user labels are to be created or 
checked in the COBOL program, the USE AFTER 
BEGINNING/ENDING LABELS declarative 
sentence and the LABEL RECORDS clause with 
the data-name option must be specified. 



Load Point Marker 



R N 



N R N 



N P 



P R 



R R N 



N P 



P R R N 



N P 



P R 



r-T T-T-T-T-T-T-T-T-T-T-T-T-T T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T 

M |V|V|-|V|H|H|-|H|U|-IU| I I |E1E|-|E|U|-|U| 1 H| H| - | Hj U | - | U | | 

I |0|0|-|0|D|D|-|D|H|-|H|T| | T| 0|0| - |0| T| - | T| T] D| Dj- | D| H| - |H | T| 

I iL|Ll-|L|R|R|-IR|L|-|L|M| FILE #1 |M| F |F |- |F | L| - JL JMlR IRJ- |R |L| - JL |M| FILE #2 

I |1|2|-|8|1|2|-|8|1|-|8| I I |1|2|-|8|1|-|8| | 1| 2|- | 8 | 1 | - | 8 | | 

L i_J._J._±_J._JL_JL_J._X_X_J._JL_i L_X_X_X_J._J._J._J._J._J I L_X_X-.X_X_X_ J 



End of Tape Marker 



,, RRN NP PRR 

T-T-T-T-T-T-T-T-T-T-T-T" 

M |E|E|-|E|U|-|U| I I 

FILE #2 |T|0I0|-|0|T|-|T|T|T| 
|M|V|V|-|V|L|-|L|MJM| 
I |1|2I-|8|11-18| I I 
x_x_x_x_x_x_x_x_x_x_x. 



Notes ; R = Required, processed by IOCS. 

N = Permitted, but not written or checked, by IOCS and not available to user. 
P = Processed by IOCS and available to user. 



Figure 37. Standard, User, and Volume Labels 



Load Point Marker 



O 



r-T- 
I— ' 



-T-T-T-T-T 
|L| |L| 
|A| |A| 
|B|-|B|T 
JEJ JEJM 
|L|-|L| 
|S| |S| 



T-T-T-T-T-T 

I |L| |L| 
I |A| |A| 
I T I B I - I B I T 
FILE #l|MfE| |E|M 
I |L|-|L| 
I |SI |S| 



J_X_X_X_X x_x_x_x_x_x 



Notes ; R = Required, processed by IOCS. 
O = Optional. 
C = Written by COBOL compiler. 



Figure 38. Nonstandard Labels 



r'^) 

V^'^ 



1U8 



Header labels are written or read when 
the file is opened or when a volrune switch 
occurs. Trailer labels are written when 
the physical end of the reel is reached, or 
when a CLOSE REEL or CLOSE file-name is 
issued. Trailer labels are read on each 
reel except the last when a tapemark is 
reached. For the last reel (i.e., EOF 
labels) , trailer labels are not read until 
the file is closed. 



The mass storage labels always include 
one volume label for each volume and one or 
more file labels for each logical file on 
the volume. There may also be user header 
labels and user trailer labels. 



Volume Labels 



For multivolume input files with 
nonstandard labels, the user must specify 
the inteqer-1 option of the source language 
ASSIGN clause, where integer-1 is the 
number of reels in the file. This number 
can be overridden at execution time by 
storing a nonzero integer in the special 
register NSTD-REELS before opening the 
file. Therefore, the number of reels is 
available to the programmer while the file 
is opened both in the special register 
NSTD-REELS and in the field reserved for 
this purpose which precedes the DTF table 
for DTFMT (see "DTF Tables" in this 
chapter) . In addition, the n\amber of reels 
remaining after each volume switch can also 
be found in the field reserved for this 
purpose which precedes the DTF table for 
DTFMT. 



When processing a multivolume file with 
nonstandard labels (i.e., when the 
data-name option of the LABEL RECORDS 
clause is specified) , if the user wishes to 
stop reading or writing before the physical 
end of a reel is reached, he must set a 
switch in the appropriate declarative 
section. In the Proced\ire Division, he can 
either CLOSE REEL or CLOSE FILE depending 
on the switch setting. Volxime switching is 
done by LIOCS when CLOSE REEL is executed. 



The volxjme label is an 80-byte data 
field preceded by a U-byte key field. Both 
the key field and the first four bytes of 
the data field contain the label identifier 
VOLl. IOCS creates a standard volume label 
for every volume processed by the Disk 
Operating System. It is always the third 
record on cylinder 0, track 0. The format 
and contents of a standard volume label can 
be found in the publication IBM System/360 
Disk Operating System; Data Management 
Concepts. 



Standard File Labels 



A standard file label identifies a 
particular logical file, gives its 
location (s) on the mass storage device, and 
contains information to prevent premature 
destruction of current files. A standard 
file label for a file located on a mass 
storage device is a 140-character label 
created (OPEN/CLOSE OUTPUT) in part by IOCS 
using the VOL and DLAB, or DLBL control 
statements. The fields contained within 
the label follow three standard formats. 



1. Format 1 is used for all logical 

files. The contents of the fields of 
a Format 1 label is discussed in 
"Appendix C: Standard Mass Storage 
Device Labels." 



MASS STORAGE FILE LABELS 



The IBM System/360 Disk Operating System 
provides postive identification and 
protection of all files on mass storage 
devices by recording labels on each volume. 
These labels ensure that the correct voliame 
is used for input, and that no current 
information is destroyed on output.. 



2. Format 2 is required for indexed 

files. The contents of the fields of 
a Format 2 label can be found in the 
publication IBM System/360 Disk 
Operating System; Data Management 
Concepts . 



3. Format 3 is required if a logical file 
uses more than three extents of any 
volume. The contents of the fields of 
a Format 3 label can be found in the 
DOS Data Management Concepts 
pTiblication cited previously. 



Advanced Processing Capabilities 149 



User Labels 



The user can include additional labels 
to further define his file. The labels are 
I referred to as user standard labels. They 
cannot be specified for indexed files. A 
user label is an 80-character label 
containing UHL (user header label) or DTL 
(user trailer label) in the first three 
character positions. The fourth position 
contains a number 1 through 8 which 
represents the relative position of the 
user label with a group of user labels. 
The contents of the remaining 76 positions 
is entirely up to the user. User header 
and trailer labels are written on the first 
track of the first extent of each volume 
allocated by the user for the file. User 
header labels are resequenced starting with 
one (UHLl) at the beginning of each new 
volume. 



LABEL PROCESSING CONSIDERATIONS 



Division. The user's label 
routine then performs any 
processing required. 

b. If user trailer labels are 

indicated on a sequential file, 
they are read after reaching the 
end of the last extent on each 
volume when the file is closed, 
provided end-of-file has been 
reached. Trailer labels are 
processed by the user's label 
routine if the appropriate USE 
AFTER STANDARD LABEL PROCEDURE 
declarative is specified in the 
source program. The LABEL RECORDS 
clause with the data-name option 
must be specified in the Data 
Division. 



Files on Mass Storage Devices Opened as 
Output 



1. Standard labels created 



Files on Mass Storage Device opened as 
Input 



1. Standard labels checked 

a. The volume serial numbers in the 
volume labels are compared to the 
file serial numbers in the EXTENT 
(or XTENT) cards. 

b. Fields 1 through 3 in Format 1 
label are compared to the 
corresponding fields in the DLBL 
(or DLAB) card. Fields U through 
6 are then checked against their 
EBCDIC equivalents in the DLAB 
continuation card. 

c. Each of the extent definitions in 
the Format 1 and Format 3 labels 
is checked against the limit 
fields supplied in the EXTENT 

(or XTENT) cards. 

2. User labels checked 



a. The volume serial numbers in the 
volume labels are compared to the 
file serial numbers in the EXTENT 
(or XTENT) cards. 

b. The extent definitions in all 
current labels on the volume are 
checked to determine whether any 
extend into those defined in the 
EXTENT (or XTENT) cards. If any 
overlap, the expiration date is 
checked against the current date 
in the Communication Region of the 
Supervisor. If the expiration 
date has passed, the old labels 
are deleted. If not, the operator 
is notified of the condition. 

c. The new Format 1 label is written 
with information supplied in the 
DLBL card (or the DLAB card and 
the DLAB continuation card) . If 
an indexed file is being 
processed, the DTFIS routine 
supplies information for the 
Format 2 label. 



a. If user header labels are 
indicated for directly or 
sequentially organized files, they 
are read as each volume of the 
file is opened. After reading 
each label, the OPEN routine 
branches to the user' s label 
routine if the appropriate USE 
AFTER STANDARD LABEL PROCEDURE 
declarative is specified in the 
source program. The LABEL RECORDS 
clause with the data-name option 
must be specified in the Data 



d. The information in the EXTENT 

(or XTENT) cards is placed in the 
Format 1 labels and, if necessary, 
in the additional Format 3 labels. 

2. User header labels created 

a. If user header labels are 

indicated by the presence of the 
appropriate USE AFTER STANDARD 
LABEL PROCEDURE declarative and 
the LABEL RECORDS clause with the 
data- name option, the user's label 



"■^ 



150 



routine is entered to furnish the 
labels as each voliime of the file 
is opened. This can be done for 
as many as eight user header 
labels per volume. As each label 
is presented, IOCS writes it out 
on the first track of the first 
extent of the vol\ime. 



UNLABELED FILES 



When a multivolume tape file is opened 
as INPUT and integer as specified in the 
ASSIGN clause is greater than 1, the 
compiler will generate the following 
message to the operator: 



b. If user trailer labels are 

indicated by the presence of the 
appropriate USE AFTER STANDARD 
LABEL PROCEDURE declarative and 
the LABEL RECORDS clause with the 
data-name option, the user's label 
routine is entered to furnish the 
labels when the end of the last 
extent on each volume is reached. 
This can be done for as many as 
eight user trailer labels. The 
CLOSE statement must be issued to 
create trailer labels for the last 
volume of a sequential file or for 
a direct file. 



C126D IS IT EOF? 



The operator must respond either with N if 
it is not the last reel, or with Y if it is 
the last reel. If it is end-of-file, 
control passes to the imperative-statement 
specified in the AT END phrase of the READ 
statement; if it is not end-of-file, 
processing of the next vol\ime is initiated. 



If the integer specified in the ASSIGN 
clause is not greater than 1, control 
always passes at end- of -vol time' to the 
imperative- statement specified in the AT 
END phrase of the READ statement. 



u 



Advanced Processing Capabilities 151 



*v .> 



c 



( 



RECORD FORMATS 



( 



Logical records may be in one of four 
formats: fixed-length (format F) , 
variable-length (format V), undefined 
(format U), or spanned (format S) . F-mode 
files must contain records of equal 
lengths. Files containing records of 
\inequal lengths must be V-mode, S-mode, or 
U-mode. Files containing logical records 
that are longer than physical records must 
be S-mode. 

The record format is specified in the 
RECORDING MODE clause in the Data Division. 
If this clause is omitted, the compiler 
determines the record format from the 
record descriptions associated with the 
file. If the file is to be blocked, the 
BLOCK CONTAINS clause must be specified in 
the Data Division. 

The prime consideration in the selection 
of a record format is the nature of the 
file itself. The programmer knows the type 
of input his program will receive and the 
type of output it will produce. The 
selection of a record format is based on 
this knowledge as well as an understanding 
of the type of input/output devices on 
which the file is written and of the access 
method used to read or write the file. 



FIXED-LENGTH (FORMAT F) RECORDS 



Format F records are fixed-length 
records. The programmer specifies format F 
records by including RECORDING MODE IS F in 
the file description entry in the Data 
Division. If the clause is omitted and 
both of the following are true: 

• All records in the file are the same 
size 

• BLOCK CONTAINS [integer-1 TO] 
integer-2... does not specify 
integer- 2 less than the length of the 
maximum level- 01 record 

the compiler determines the recording mode 
to be F. All records in the file are the 
same size if there is only one record 
description associated with the file and it 
contains no OCCURS clause with the 
DEPENDING ON option, or if multiple record 
descriptions are all the same length. 

The number of logical records within a 
block (blocking factor) is normally 
constant for every block in the file. When 



fixed-length records are blocked, the 
programmer specifies the BLOCK CONTAINS 
clause in the file description entry in the 
Data Division. 

In unblocked format F, the logical 
record constitutes the block. The BLOCK 
CONTAINS clause is unnecessary for 
\anblocked records. 

Format F records are shown in Figure 39. 
The optional control character, represented 
by C in Figure 39, is used for stacker 
selection and carriage control. When 
carriage control or stacker selection is 
desired, the WRITE statement with the 
ADVANCING or POSITIONING option is used to 
write records on the output file. In this 
case one character position must be 
included as the first character of the 
record. This position will be 
automatically filled in with the carriage 
control or stacker select character. The 
carriage control character never appears 
when the file is written on the printer or 
punched on the card punch. 





Logical Record 






1 T 

1 c 1 

L J. - 


uata 


— ^ 

1 
_ J 




r- 


Blocked Records 
r ■ r 




— 1 



i Logical 
Record 



Logical 
Record 



Logical 
Record 



-Fixed Length- 



Unblocked Record 
Logical Record 



< Fixed Length > 

Figure 39. Fixed-Length (Format F) Records 

UNDEFINED (FORMAT U) RECORDS 



Format U is provided to permit the 
processing of any blocks that do not 
conform to F or V formats. Format U 
records are shown in Figure UO. The 
optional control character C, as discussed 



Record Formats 153 



under "Fixed- Length (Foarmat F) Records," 
may be used in each logical record. 

The programmer specifies format D 
records by including RECORDING MODE IS U in 
the file description entiry in the Data 
Division. U-mode records may be specified 
only for directly organized or standard 
sequential files. 

If the RECORDING MODE clause is omitted, 
and BLOCK CONTAINS [integer-1 TO] 
integer-2,,. does not specify integer-2 
less than the maximxim level- 01 record, the 
compiler determines the recording mode to 
be U if the file is directly organized and 
one of the following conditions exist: 

• The FD entry contains two or more 
level- 01 descriptions of different 
lengths . 

• A record description contains an OCCURS 
clause with the DEPENDING ON option. 

• A RECORD CONTAINS clause specifies a 
range of record lengths. 

Each block on the external storage media 
is treated as a logical record. There are 
no record-length or block- length fields. 

Note: When a READ INTO statement is used 
for a U-mode file, the size of the longest 
record for that file is used in the MOVE 
statement. All other rules of the MOVE 
statement apply. 



r T- 

I C I 

L J.- 



Logical Record 
Data 



Format U Record 
Logical Record 



Figure 40. Undefined (Format U) Records 



VARIABLE-LENGTH (FORMAT V) RECORDS 



The programmer specifies foarmat V 
records by including RECORDING MODE IS V in 
the file description entry in the Data 
Division. V-mode records may only be 
specified for standard sequential files. 
If the RECORDING MODE clause is omitted and 



BLOCK CONTAINS [integer-1] TO integer-2... 
does not specify integer-2 less than the 
maximum level- 01 record, the compiler 
determines the recording mode to be V if 
the file is standard sequential and one of 
the following conditions exists: 

• The FD entry contains two or more level 
01 descriptions of different lengths. 

• A record description contains an OCCURS 
clause with the DEPENDING ON option. 

• A RECORD CONTAINS clause specifies a 
range of record lengths. 

V-mode records, tinlike U-mode or F-mode 
records, are preceded by fields containing 
control information. These control fields 
are illustrated in Figures 41 and U2. 

The first four bytes of each block 
contain control information (CO : 

LL — represents two bytes designating 

the length of the block (including 
the 'CC field). 

BB — represents two bytes reserved for 
system use. 

The first four bytes of each logical 
record contain control information (cc) : 

11 — represents two bytes designating 
the logical record length 
(including the 'cc': field). 

bb — represents two bytes reserved for 
system use. 

For unblocked V mode records (see Figure 
37) the data portion + CC + cc constitute 
the block. 



4 4 variable 
|< — bytes->< — bytes — >< bytes— 

r T T T T 

I LL I BB I 11 I bb I Data 

I X X X X 




Figure 41. Unblocked V-Mode Records 



For blocked V-mode records (see Figure 
42) the data portion of each record + the 
cc of each record + CC constitute the 
block. 



V-„/ 



154 



C) 



1st 
Logical Record 



2nd 
Logical Record 



3rd 
Logical Record 



r T T T T 

I LL I BB I 11 I bb I DATA-1 
L J. JL J. X 



I 11 I bb I DATA-2 | 11 | bb | DATA-3 | 
-JL X I I L X J 



•cc» 

(block control 

bytes ) 



•cc' 

(record control 

bytes) 



J 



Figure 42. Blocked V-Mode Records 



The control bytes are automatically 
provided when the file is written and are 
not communicated to the user when the file 
is read. Although they do not appear in 
the description of the logical record 
provided by the user, the compiler will 
allocate input and output buffers which are 
large enough to accomodate them. When 
variable-length records are written on unit 
record devices, control bytes are neither 
printed nor punched. They appear, however, 
on other external storage devices as well 
as in buffer areas of core storage. V-mode 
records moved from an input bxiffer to a 
working- storage area will be moved without 
the control bytes. 



Note: When a READ INTO statement is used 
for a V-mode file, the size of the longest 
record for that file is used in the MOVE 
statement. All other rules of the MOVE 
statement apply. 

Example 1 ; 

Consider the following standard 
sequential file consisting of unblocked 
V-mode records: 

FD VARIABLE-FILE-1 

RECORDING MODE IS V 

BLOCK CONTAINS 35 TO 80 CHARACTERS 
RECORD CONTAINS 27 TO 72 CHARACTERS 
DATA RECORD IS VARIABLE-RECORD- 1 
LABEL RECORDS ARE STANDARD. 

01 VARIABLE-RECORD-1. 

05 FIELD-A PIC X(20). 

05 FIELD-B PIC 99. 

05 FIELD-C OCCURS 1 TO 10 TIMES 

DEPENDING ON 

FIELD-B PIC 9(5). 

The LABEL RECORDS clause is always 
required. The DATA RECORD (S) clause is 



never required. If the RECORDING MODE 
clause is omitted, the compiler determines 
the mode as V since the record associated 
with VARl/mLE-FILE-l varies in length 
depending on the contents of FIELD-B. The 
RECORD CONTAINS clause is never required. 
The compiler determines record sizes from 
the record description entries. The BLOCK 
CONTAINS clause is also unnecessary, since 
the compiler assumes unblocked records if 
the clause is omitted. Record length 
calculations are affected by the following: 



When the BLOCK CONTAINS clause with the 
RECORDS option is used, the compiler 
adds four bytes to the logical record 
length and four more bytes to the block 
length. 



When the BLOCK CONTAINS clause with the 
CHARACTERS option is used, the user 
must include each cc + CC in the length 
calculation (see Figure 42). In the 
definition of VARIABLE-FILE-1, the 
BLOCK CONTAINS clause specifies 8 more 
bytes than does the record contains 
clause. Four of these bytes are the 
logical record control bytes and the 
other four are the block control bytes. 



Assumming that FIELD-B contains the 
value 02 for the first record of a file and 
FIELD-B contains the value 03 for the 
second record of the file, the first two 
records will appear on an external storage 
device and in biiffer areas of core storage 
as shown in Figure 43, 



If the file described in Example 1 had a 
blocking factor of 2, the firsit two records 
would appear on an external storage medium 
as shown in Figure 44. 



Record Formats 155 



1st Block 



2nd Block 



r T T T T T T T T T T T T T T T T 1 

I OOHO I BE I 0036 1 bb j FIELD-A| 02 | FIELD-C j FIELD-C j OOUS j BB | OOUl | bb j FIELD-A j 03 j FIELD-C | FIELD-C | FIELD-C | 
L X J J X L J. J. X a J X J. J. J. X X J 



V 



Note ; Lengths appear in decimal notation for illustrative purposes. 



L J 



Figure U3. Fields in Unblocked V-Mode Records 



1st Record 



2nd Record 



r T T T T T T T T T T T T T T 1 

I 0081 1 BB I 0036 I bb j FIELD-AJ 02 j FIELD-C j FIELD-C j 0041 j bb j FIELD-A | 03 \ FIELD-C | FIELD-C j FIELD-C | 
L X J. J. J. J. J. J. X J X J J. J. J J 

Note: Lengths appear in decimal notation for illustrative purposes. 

L^ j 

Figure 4U. Fields in Blocked V-Mode Records 



Example 2 ; 

If VARIABLE- FILE- 2 is blocked, with 
space allocated for three records of 
maximum size per block, the following FD 
entry could be used when the file is 
created: 



space for three records of maximum size 
plus additional space for the required 
control bytes. Hence, 316 character 
positions are reserved by the compiler for 
each output bxiffer. If this size is othnr 
than that required, the BLOCK CONTAINS 
clause with the CHARACTERS option should be 
specified. 



FD VARIABLE-FILE- 2 

RECORDING MODE IS V 

BLOCK CONTAINS 3 RECORDS 

RECORD CONTAINS 20 TO 100 CHARACTERS 

DATA RECORDS ARE VARI ABLE-RECORD- 1, 

VARIABLE-RECORD- 2 

LABEL RECORDS ARE STANDARD. 



Ass\aming that the first six records 
written are five 100-character records 
followed by one 20 -character record, the 
first two blocks of VARIABLE-FILE- 2 will 
appear on the external storage device as 
shown in Figure 45. 



01 VARIABLE-RECORD- 1. 

05 FIELD-A PIC X(20), 
05 FIELD-B PIC X(80). 



01 VARIABLE-RECORD- 2. 

05 FIELD-X PIC X(20). 



As mentioned previously, the RECORDING 
MODE, RECORD CONTAINS, and DATA RECORDS 
clauses are unnecessary. By specifying 
that each block contains three records, the 
programmer allows the compiler to provide 



The buffer for the second block is 
truncated after the sixth WRITE statement 
is executed since there is not enough space 
left for a maximum size record. Hence, 
even if the seventh WRITE to 
VARI ABLE- FILE- 2 is a 20-character record, 
it will appear as the first record in the 
third block. This situation can be avoided 
by using the APPLY WRITE-ONLY claiase when 
creating files of variable-length blocked 
records. 



156 



1st Block 



2nd Block 



r T T T T T T T T T T 1— -^-^ y y y T y T 1 

|316|BB|104|bb|Data|10U|bb|Datall0t*ibb|Dataj I 236 IBBJIOU | bbJData| 104] bbjDatal 2U |bb| Data| 

L J. X JL X J X X X X X X_«-^J X X J J J J J 

Note ; Lengths appear in decimal notation for illustrative purposes. 

L J 

Figure 45. First Two Blocks of VARIABLE-FILE- 2 



APPLY WRITE-ONLY Clause 



The APPLY WRITE-ONLY clause is used to 
make optimum use of buffer space when 
creating a standard sequential file with 
blocked V-mode records. 



Note : When using the APPLY WRITE-ONLY 
clause, records must not be constructed in 
buffer areas. An intermediate work area 
must be used with a WRITE FROM statement. 



Suppose VARIABLE- FILE- 2 is being created 
with the following FD entry: 



SPANNED (FORMAT S) RECORDS 



c 



FD VARIABLE- FILE- 2 

RECORDING MODE IS V 

BLOCK CONTAINS 316 CHARACTERS 

RECORD CONTAINS 20 TO 100 CHARACTERS 

DATA RECORDS ARE VARI ABLE-RECORD- 1, 

VARIABLE-RECORD- 2 

LABEL RECORDS ARE STANDARD. 

01 VARIABLE- RECORD- 1. 

05 FIELD-A PIC X(20). 
05 FIELD-B PIC X(80). 

01 VARIABLE- RECORD- 2. 

05 FIELD-X PIC X(20). 



The first three WRITE statements to the 
file create one 20-character record 
followed by two 100-character records. 
Without the APPLY WRITE-ONLY clause, the 
buffer is truncated after the third WRITE 
statement is executed, since the maximum 
size record no longer fits. The block is 
written as shown below: 



|236Ibb|2U|bb|Data|104|bb|Data|104|bb|Data| 

L X X X X ± X X X X X J 

using the APPLY WRITE-ONLY clause will 
cause a buffer to be truncated only when 
the next record does not fit in the buffer. 
That is, if the next three WRITE statements 
to. the file specify VARIABLE-RECORD- 2, the 
block will be created containing six 
logical records, as shown below: 



I 308 1 bb| 241 bb|Data 1 104 | bb | Data 1 104 | bb | Data? 
I X X X J X X X X X X J 

y ^ ^ p y y y y ^ 

7 24 1 bb I Data | 24*| bb | Data j 24 j bb j Data j 
< X X X X X X X X J 



A spanned record is a logical record 
that may be contained in one or more 
physical blocks. Format S records may be 
specified for direct files and for standard 
sequential files assigned to magnetic tape 
or to mass storage devices. 

When creating files with S-mode records, 
if a record is larger than the remaining 
space in a block, a segment of the record 
is written to fill the block. The 
remainder of the record is stored in the 
next block or blocks, as required. 

When retrieving a file with S-mode 
records, only complete records are made 
available to the user. 

Spanned records are preceded by fields 
containing control information. Figure 46 
illustrates the control fields. 



BDF (Block Descriptor Field) : 

LL — represents 2 bytes designating the 
length of the physical block 
(including the block descriptor 
field itself). 

BB — represents 2 bytes reserved for 
system use. 



SDF (Segment Descriptor Field) : 

11 — represents 2 bytes designating the 
length of the record segment 
(including the segment descriptor 
field itself) . 

bb — represents 2 bytes reserved for 
system use. 



Record Formats 157 



Note ; There is only one block descriptor 
field at the beginning of each physical 
block. There is, however, one segment 
descriptor field for each record segment 
within the block. 



Each segment of a record in a block, 
even if it is the entire record, is 
preceded by a segment descriptor field. 
The segment descriptor field also indicates 
whether the segment is the first, the last, 
or an intermediate segment. Each block 
includes a block descriptor field. These 
fields are not described in the Data 
Division; provision is automatically made 
for them. These fields are not available 
to the user. 



A spanned blocked file may be described 
as a file composed of physical blocks of 
fixed length established by the programmer. 
The logical records may be either fixed or 
variable in length and that size may be 
smaller, equal to, or larger than the 
physical block size. There are no required 
relationships between logical records and 
physical block sizes. 



A spanned unblocked file may be 
described as a file composed of physical 
blocks each containing one logical record 
or one segment of a logical record. The 
logical records may be either fixed or 
variable in length. When the physical 
block contains one logical record, the 
length of the block is determined by the 
logical record size. When a logical record 
has to be segmented, the system always 
writes the largest physical block possible. 
The system segments the logical record when 
the entire logical record cannot fit on the 
track. 



Figure 47 is an illustration of blocked 
spanned records of SFILE. SFILE is 
described in the Data Division with the 
following file description entry: 



FD SFILE 

RECORD CONTAINS 250 CHARACTERS 
BLOCK CONTAINS 100 CHARACTERS 



Figure 47 also illustrates the concept 
of record segments. Note that the third 
block contains the last 50 bytes of REC-1 
and the first 50 bytes of REC-2. Such 
portions of logical records are called 
record segments. It is therefore correct 
to say that the third block contains the 
last segment of REC-1 and the first segment 
of REC-2. The first block contains the 
first segment of REC-1 and the second block 
contains an intermediate segment of REC-1. 



S-MODE CAPABILITIES 



Formatting a file in the S-mode allows 
the user to make the most efficient use of 
external storage while organizing data 
files with logical record lengths most 
suited to his needs. 

1. Physical record lengths can be 
designated in such a manner as to make 
the most efficient use of track 
capacities on mass storage devices. 

2. The user is not required to adjust 
logical record lengths to maximum 
physical record lengths and their 
device- dependent variants when 
designing his data files. 

3. The user has greater flexibility in 
transferring logical records across 
DASD types. 

Spanned record processing will support 
the 2400 tape series, the 2311 and 2314 
disk storage devices, and the 2321 data 
cell drive. 



r 1 

> 




Data Record or Segment 



J 



BDF 



SDF 



J 



•Figure 46. Control Fields of an S-Mode Record 



158 



■100 bytes- 

REC-1 
1st Block 



< 

r 

I 

L 



G 
J L. 



•100 bytes 

REC-1 
2nd Block 



J 



> <-50 bytes-> <-50 bytes-> 

1 I r 1 

I G I REC-1 I REC-2 | 



J. J 

3rd Block 



J 



•Figure 47. One Logical Record Spanning Physical Blocks 



SEQUENTIALLY ORGANIZED S-MODE FILES ON TAPE 
OR MASS STORAGE DEVICES 



When the spanned format is used for 
DTFMT or DTFSD files, the logical records 
may be either fixed or variable in length 
and are completely independent of physical 
record length. A logical record may span 
physical records. A logical record may 
span physical records. A physical record 
may contain one or more logical records 
and/ or segments of logical records. 



Source Language Considerations 



The user specifies S-mode by describing 
the file with the following clauses in the 
file description (FD) entry of his COBOL 
program: 

• BLOCK CONTAINS integer- 2 CHARACTERS 

• RECORD CONTAINS [ integer- 1 TO] 
integer- 2 CHARACTERS 

• RECORDING MODE IS S 

The size of the physical record must be 
specified using the BLOCK CONTAINS clause 
with the CHARACTERS option. Any block size 
may be specified. Block size is 
independent of logical record size. 

The size of the logical record may be 
specified by the RECORD CONTAINS clause. 
If this clause is omitted, the compiler 
will determine the maximum record size from 
the record descriptions under the FD. 

Format S may be specified by the 
RECORDING MODE IS S clause. If this clause 
is omitted, the compiler will set the 
recording mode to S if the BLOCK CONTAINS 
integer- 2 CHARACTERS clause was specified 
and either: 

1. integer-2 is less than the largest 
fixed-length level-01 FD entry 

2. integer-2 is less than the maximum 
length of a variable level-01 FD entry 
(i.e., an entry containing one or more 



OCCURS clauses with the DEPENDING ON 
option) . 

When the spanned recording mode is being 
used, each logical record is processed in a 
work area, not in the buffer. Logical 
records are always aligned on a double-word 
boundary. Therefore, the user is not 
required to add inter-record slack bytes 
for alignment purposes. 

Except for the APPLY WRITE-ONLY clause, 
all the options for a variable file apply 
to a spanned file. 



Processing Sequentially Organized S-Mode 
Files 



Suppose a file has the following file 
description entry: 

FD SPAN-FILE 

BLOCK CONTAINS 100 CHARACTERS 
LABEL RECORDS ARE STANDARD 
DATA RECORD IS DATAREC. 



01 DATAREC. 

05 FIELD-A PIC X(IOO). 
05 FIELD-B PIC X(50). 

Figure 48 illustrates the first four 
blocks of SPAN-FILE as they would appear on 
external storage devices (i.e., tape or 
mass storage) or in buffer areas of core 
storage. 

Note: 

1. The RECORDING MODE clause is not 
specified. The compiler determines 
the recording mode to be S since the 
block size is less than the record 
size. 

2. The length of each physical block is 
100 bytes, as specified in the BLOCK 
CONTAINS clause. All required control 
fields, as well as data, m\ist be 
contained within these 100 bytes. 

3. No provision is made for the control 
fields within the level-01 entry 
DATAREC. 



Record Formats 159 



92 



58 



30 



r 

I 



<-bytes-><-bytes->< bytes > <-bytes-><-bytes->< bytes ><-bytes->< — bytes > 

I ILL |BB 111 I bb I DATAREC (1) |11 | bb |DATAREC (2) | 
J L X X X J X J X J 



1 T T T T 




ILL |BB 111 1 bb 1 


DATAREC (1) 


L X X X X _. 





1st Block 



2nd Block 



H H 92 4 4 28 4 60 
<-bytes-><-bytes->< bytes > <-bytes-><-bytes->< — bytes ><-bytes->< bytes > 

"I I T T 7 ^ 1 T T 1 

ILL JBB 111 I bb I DATAREC (2) jll | bb j DATAREC (3) | 



1 T- T T T 




ILL |BB 111 1 bb 1 


DATAREC (2) 


L X X X X 





3rd Block 



4th Block 



^_ 



• Figure 48. First Four Blocks of SPAN- FILE 



RECORDING MODE IS V 



RECORDING MODE IS S 



|. + 



I 150 I 150 I G I 150 I 100 I G I 150 | 

L X J L X J L J 



I 150 I 150 I 50 I G I 100 I 100 | 150 | 

L J ± J L X J J 



Rl 



R2 



R3 



RH 



R5 



Rl 



R2 



R3 



R4 



R5 



|. X ^ 

[Note: The enclosed diagrams are for illustrative purposes only. Neither takes into 
account the space required for control fields. 

L J 

• Figure U9. Advantage of S-Mode Records Over V-Mode Records 



The preceding discussion dealt with 
S-mode records which were larger than the 
physical blocks that contained them. It is 
also possible to have S-mode records which 
are equal to or smaller than the physical 
blocks that contain them. In such cases, 
the RECORDING MODE clause must specify S 
(if so desired) since the compiler cannot 
determine this by comparing block size and 
record size. 



One advantage of S-mode records over 
V-mode records is illustrated by a file 
with the following characteristics: 

1. RECORD CONTAINS 50 TO 150 CHARACTERS 

2. BLOCK CONTAINS 350 CHARACTERS 

3. The first five records written are 
150, 150, 150, 100, and 150 characters 
in length. 



For V-mode records, buffers are 
truncated if the next logical record is too 
large to be completely contained in the 
block (s6e Figure 49) w This results in 
more physical blocks and more inter-record 
gaps on the external storage device. 



Note: For V-mode records, buffer 
truncation occurs: 

1. when the maximum level- 01 record is 
too large 

2. if APPLY WRITE-ONLY or SAME RECORD 
AREA is specified and the actual 
logical record is too large 

For S-mode records, all blocks are 350 
bytes long and records that are too large 
to fit entirely into a block will be . 
segmented. This results in more efficient 
use of external storage devices since the 



160 



() 



number of inter-record gaps are minimized 
(Figure 49). 



With the exception of the last block, 
the actual physical block size will always 
fall between the limits of specified block 
size and four bytes less than the specified 
block size, depending on whether or not the 
residual space of an incomplete block in 
the buffer is sufficient to add a segment 
length field and at least one byte of data. 
That is, specified block size - U < actual 
block size < specified block size. 



The last block may be short when an 
incomplete block remains in the buffer at 
CLOSE time. 

A second advantage of S-mode processing 
over that of V-mode is that the user is no 
longer limited to a record length that does 
not exceed the track capacity of the mass 
storage device selected. Records may span 
track, cylinders, and extents, but not 
volumes . 

DTFMT and DTFSD spanned records differ 
from other formats because of an allocation 
of an area of core know as the "logical 
record area." If logical records span 
physical blocks, COBOL will use this 
logical record area to assemble complete 
logical records. If logical records do not 
span blocks (i.e., they are contained 
within a single physical block) the logical 
record area is not used. Regardless, it is 
complete logical records that are made 
available to the user. Both READ and WRITE 
statements should be thought of as 
manipulating complete logical records and 
not record segments. 



DIRECTLY ORGANIZED S-MODE FILES 



When S-mode is used for a directly 
organized file, only unblocked records are 
permitted. Logical records may be either 
fixed or variable in length. A logical 
record will span physical records if, and 
only if, it spans tracks. A physical 
record will contain only one logical record 
or a segment of a logical record, or 
segments of two logical records and/or 
whole logical records. Records may span 
tracks, cylinders, and extents, but not 
volumes. 



Source Language Considerations 



The user specifies S-mode by describing 
the file with the following clatises in the 
file description (FD) entry of his COBOL 
program: 

• BLOCK CONTAINS integer-2 CHARACTERS 

• RECORD CONTAINS [integer-1 TO] integer-2 

CHARACTERS 

• RECORDING MODE IS S 

The size of a logical record may be 
specified by the RECORD CONTAINS clause. 
If this clause is omitted, the compiler 
will determine the maximum record size from 
the record descriptions under the FD. 

The spanned format may be specified by 
the RECORDING MODE IS S Clause. If this 
clause is omitted, the compiler will set 
the recording mode to S if the BLOCK 



Sequential File 



Direct File 



r T T- 

I Rl I R2 I 

L X X. 



T r 1 r n r 

R3 j ...1st track... | Rl | G | R2 | G | R3 

J L J L J J 



r 

I R3 



1 T- 

I • • • 2nd tra ck. • . | 

J L. 



R3 



T 



R3 



R4 



-^ r- 

I ... 3rd track. • . | 

.J L- 



R3 



-^ r 

I G i R4 

.J I 



...4th track... | R4 | 
L J 

I J 

• Figure 50. Direct and Sequential Spanned Files on a Mass Storage Device 



Record Formats 161 



CONTAINS integer- 2 CHAEIACTERS clause was 
specified and integer- 2 is less than the 
greatest logical record size. This is the 
only use of the BLOCK CONTAINS clause. It 
is otherwise treated as comments. 

The physical block size is determined by 
either : 

1. the logical record length 

2, the track capacity of the device being 
used 

If, for example, the track capacity of a 
mass storage device is 3,625 characters, 
any record smaller than 3, 625 characters 
may be written as a single physical block. 
If a logical record is greater than 3,625 
characters, the record is segmented. The 
first segment may be contained in a 
physical block of up to 3,625 bytes, and 
the remaining segments must be contained in 
succeeding blocks. In other words, a 
logical record will span physical blocks 
if, any only if, it spans tracks. 

Figure 50 illustrates four 
variable-length records (Rl, R2, R3, and 
RU) as they would appear in direct and 
sequential files on a mass storage device. 
In both cases, control fields have been 
omitted for illustrative purposes. For 
both files, assume: 

1. BLOCK CONTAINS 3625 CHARACTERS (track 
capacity = 3, 625) 

2. RECORD CONTAINS 500 TO 5000 CHARACTERS 

In the sequential file, each physical 
block is 3, 625 bytes in length and is 
completely filled with logical records. 
The file consists of three physical blocks, 
occupies three tracks, and contains no 
inter-record gaps. 

In the direct file, the physical blocks 
vary in length. Each block contains only 
one logical record or one record segment. 
Logical record R3 spans physical blocks 
only because it spans tracks. The file 
consists of seven physical blocks, occupies 
more than three tracks, and contains three 
inter- record gaps. 



Processing Directly Organized S-Mode Files 



When processing directly organized 
files, there are two advantages spanned 
format has over the other record formats: 

1. Logical record lengths may exceed the 
length restriction of the track 
capacity of the mass storage device. 



If, for example, the track capacity of 
a mass storage device is 2,000 bytes, 
the length of each logical record for 
formats other than spanned is, by 
necessity, restricted to the track 
capacity. 

Note: Even when the spanned format is 
used, the COBOL restriction on the 
length of logical records (i.e., a 
maximum length of 32,767 characters) 
must be adhered to. 

2. For formats other than spanned, only 
complete logical records can be 
written on any single track. This 
means that if a track has only 1,000 
unoccupied bytes and the user attempts 
to' add a record of 1,100 bytes to this 
track, an INVALID KEY condition will 
occur. When the spanned format is 
used, a 1,000 byte segment will be 
written on the specified track, and 
the remainder will be written on the 
next track. The segmenting is 
transparent to the user. 



OCCURS CLAUSE WITH THE DEPENDING ON OPTION 



If a record description contains an 
OCCURS clause with the DEPENDING ON option, 
the record length is variable. This is 
true for records described in an FD as well 
as in the Working- Storage section. The 
previous sections discussed four different 
record formats. Three of them, V-mode, 
U-mode, and S-mode, may contain one or more 
OCCURS clauses with the DEPENDING ON 
option. 

This section discusses some factors that 
affect the manipulation of records 
containing OCCURS clauses with the 
DEPENDING ON option. The text indicates 
whether the factors apply to the File or 
Working- Storage sections, or both. 

The compiler calculates the length of 
V-mode records containing the OCCURS clause 
with the DEPENDING ON option at two 
different times, as follows (the first 
applies to FD entries only; the second to 
both FD and working- storage entries) : 

1. When a file is read and the object of 
the DEPENDING ON option is within the 
record. 

2. When the object of the DEPENDING ON 
option is changed as a result of a 
move to it or any item within its 
group, (The length is not calculated 
when a move is made to an item which 
redefines or renames it. ) 



c 



J 



162 



(') 



consider the following example: 
WORKING- STORAGE SECTION. 



77 CONTROL- 1 
77 WORK ARE A- 1 



PIC 99. 

PIC 9(6)V99. 



An item described as USAGE 
COMPUTATIONAL- 3 must contain internal 
decimal data. 



An item described as USAGE 
COMPUTATIONAL must contain binary data. 



01 SALARY- HI STORY. 

05 SALARY OCCURS TO 10 TIMES 
DEPENDING ON 
CONTROL-1 PIC 9(6)V99. 

The Procedure Division statement MOVE 5 
TO CONTROL-1 will cause a recalculation of 
the length of SALARY- HISTORY. MOVE 
SZy^ARY (5) TO WORKAREA-1 will not cause the 
length to be recalculated. 

The compiler permits the occ\irrence of 
more than one level- 01 record, containing 
the OCCURS clause with the DEPENDING ON 
option, in the same FD entry (see Figure 
51). If the BLOCK CONTAINS clause is 
omitted, the buffer size is calculated from 
the longest level-01 record description 
entry. In Figure 51, the buffer size is 
determined by the description of RECORD- 1 
( RECORD- 1 need not be the first record 
description under the FD) . 

, During the execution of a READ 
( \. statement, the length of each 1.gv^-0± 
\__,y record description entry in the FD will be 
calculated (see Fig\ire 51). The length of 
the variable portion of each record will be 
the product of the numeric value contained 
in the object of the DEPENDING ON option 
and the length of the subject of the OCCURS 
clause. In Figure 51, the length of 
FIELD-1 is calculated by multiplying the 
contents of CONTROL-1 by the length of 
FIELD-1; the length of FIELD-2, by the 
product of the contents of CONTROL- 2 and 
the length of FIELD-2; the length of 
FIELD- 3 by the contents of CONTROL- 3 and 
the length of FIELD- 3. 

Since the execution of a READ statement 
makes available only one record type (i.e., 
RECORD- 1 type, RECORD- 2 type, or RECORD- 3 
type) , two of the three record descriptions 
in Figiire 51 will be inappropriate. In 
such cases, if the contents of the object 
of the DEPENDING ON Option does not conform 
to its picture, the length of the 
corresponding record will not be 
calculated. For the contents of an item to 
conform to its picture: 

• 2\n item described as USAGE DISPLAY must 
contain decimal data. 



The following example illustrates the 
length calculations made by the system when 
a READ statement is executed: 



FD 



01 



RECORD- 1. 
05 A PIC 99. 
05 B PIC 99. 

05 C PIC 99 OCCURS 5 TIMES 
DEPENDING ON A. 



01 



RECORD- 2. 




05 D PIC 


XX. 


05 E PIC 


99. 


05 F PIC 


99. 


05 G PIC 


99 OCCURS 5 TIMES 



DEPENDING ON F. 



WORKING- STORAGE SECTION. 



01 TABLE- 3. 

05 H OCCURS 10 TIMES DEPENDING ON B. 

01 TABLE- 4. 

05 I OCCURS 10 TIMES DEPENDING ON E. 



When a record is read, lengths are 
determined as follows: 

1. The length of RECORD-1 is calculated 
using the contents of field A. 

2. The length of RECORD- 2 is calculated 
using the contents of field F. 

3. The length of TABLE- 3 is calculated 
using the contents of field B. 

4. The length of TABLE- 4 is calculated 
using the contents of field E. 

The user should be aware of several 
characteristics of the previously cited 
length calculations. The following example 
illustrates a group item (i.e., REC-1) 
whose subordinate items contain an OCCURS 
clause with the DEPENDING ON option and the 
object of that DEPENDING ON option. 



Record Formats 163 



FD INPUT-FILE 

DATA RECORDS ARE RECORD-1 RECORD- 2 RECORD-3, 

01 RECORD-1. 

05 CONTROL-1 PIC 99. 

05 FIELD-1 OCCURS TO 10 TIMES DEPENDING ON CONTROL-1 PIC 9(5). 

01 RECORD- 2. 

05 CONTROL-2 PIC 99. 

05 FIELD-2 OCCURS 1 TO 5 TIMES DEPENDING ON CONTROL-2 PIC 9(4). 

01 RECORD- 3. 

05 FILLER PIC XX. 

05 CONTROL- 3 PIC 99. 

05 FIELD-3 OCCURS TO 10 TIMES DEPENDING ON CONTROL-3 PIC X(4). 

Figure 51. Calculating Record Lengths When Using the OCCURS Clause with the DEPENDING ON 
Option 



N-- 



WORKING- STORAGE SECTION. 
01 REC-1. 

05 FIELD-1 PIC 9. 

05 FIELD-2 OCCURS 5 
FIELD-1 



TIMES DEPENDING ON 
PIC X(5). 



01 REC-2. 

05 REC-2-DATA PIC X(50). 

The results of executing a MOVE to the 
group item REC-1 will be affected by the 
following: 

• The length of REC-1 may have been 
calculated at some time prior to the 
execution of this MOVE statement. 

• The length of REC-1 may never have been 
calciilated at all. 

• After the move, since the contents of 
FIELD-1 have been changed, an attempt 
will be made to recalculate the length 
of REC-1. This recalculation, however, 
will only be made if the new contents 
of FIELD-1 conform to its picture 
(i.e., USAGE DISPLAY must contain an 
external decimal item, USAGE 
COMPUTATIONAL- 3 must contain an 
internal decimal item and USAGE 
COMPUTATIONAL must contain a binary 
item) . In the preceding example, if 
FIELD-1 does not contain an external 
decimal item, the length of REC-1 will 
not be calculated. 

Note: According to the COBOL description, 
FIELD-2 can occur a maximum of five times. 
If, however, FIELD-l contains an external 
decimal item whose value exceeds five, the 
length of REC-1 will still be calculated. 



One possible consequence of this invalid 
calculation will be encountered if the user 
attempts to initialize REC-1 by moving 
zeros or spaces to it. This initialization 
would inadvertently delete part of the 
adjacent data stored in REC-2. 



The following discussion applies to 
updating a record containing an OCCURS 
clause with the DEPENDING ON option and at 
least one other subsequent entry. In this 
case, the stabsequent entry is another 
OCCURS clause with the DEPENDING ON option. 

WORKING-STORAGE SECTION. 
01 . VARIABLE-REC. 

05 FIELD-A PIC X(10). 

05 CONTROL-1 PIC 99. 

05 CONTROL-2 PIC 99. 

05 VARY- FIELD-1 OCCURS 10 TIMES 

DEPENDING ON CONTROL-1 PIC X(5) . 
05 VARY-FIELD-2 OCCURS 10 TIMES 

DEPENDING ON CONTROL-2 PIC X(9). 

01 STORE-VARY-FIELD-2. 

05 VARY-FLD-2 OCCURS 10 TIMES 

DEPENDING ON CONTROL-2 PIC X(9). 

Assume that CONTROL-1 contains the value 
5 and VARY-FIELD-l contains 5 entries. 

In order to add a sixth field to 
VARY-FIELD-l the following steps are 
required : 

MOVE VARY-FIELD-2 TO STORE-VARY-FIELD-2. 

ADD 1 TO CONTROL-1. 

MOVE 'additional field* TO VARY-FIELD-l 

(CONTROL-1). 
MOVE STORE-VARY-FIELD-2 TO VARY-FIELD-2. 



v_._>' 



c 



l6^ 



PROGRAMMING TECHNIQUES 



This chapter describes several 
techniques for increasing the efficiency of 
a COBOL program. It is divided into six 
parts. The first four parts deal with the 
divisions of a COBOL program. The fifth is 
concerned with the Report Writer Feature, 
and the sixth with Table Handling Feature. 



DATA DIVISION 



OVERALL CONSIDERATIONS 



GENERAL CONSIDERATIONS 



Spacing the Source Program Listing 



There are four statements that can be 
coded in any or all of the four divisions 
of a source program: SKIPl, SKIP 2, SKIP3, 
and EJECT. These statements provide the 
user with the ability to control the 
spacing of a so\irce listing and thereby 
improve its readability. 



Prefixes 



Assign a prefix to each level-01 item in 
a program, and use this prefix on every 
subordinate item (except FILLER) to 
associate a file with its records and work 
areas. For example, MASTER is the prefix 
used here: 



FILE SECTION. 

FD MASTER-INPUT-FILE 



01 MASTER-INPUT-RECORD. 



ENVIRONMENT DIVISION 



SELECT Sentence 



WORKING- STORAGE SECTION. 
01 MASTER- WORK- AREA. 

05 MASTER-PAYROLL PICTURE 9(3) 

06 MASTER-SSNO PICTURE 9(9). 



X~~ 



SELECT sentences for the most active 
files should appear first, since the COBOL 
compiler assigns registers to files until 
it runs out of registers and then reuses 
the last registers for all subsequent 
files. 



APPLY WRITE- ONLY Clause 



To make optimiim use of buffer space 
allocated when creating a standard 
sequential file with blocked V-mode 
records, the programmer should use the 
APPLY WRITE-ONLY clause for the file. 
Using this clause causes a buffer to be 
truncated only when the next record does 
not fit in the buffer. (If APPLY 
WRITE-ONLY is not specified, the buffer is 
truncated when the maximum size record will 
not fit in the space remaining in the 
buffer. ) 



If files or work areas have the same 
fields, use the prefix to distinguish 
between them. For example, if three files 
all have a date field, instead of DATE, 
DAT, and DA-TE, use MASTER-DATE, 
DETAIL-DATE, and REPORT-DATE. Using a 
unique prefix for each level-01 item and 
all subordinate fields makes it easier for 
a user unfamiliar with the program to find 
fields in the program listing, and to know 
which fields are logically part of the same 
record or area. 



When using the MOVE statement with the 
CORRESPONDING option and referring to 
individual fields, redefine or rename 
"corresponding" names with the prefixed 
unique names. This technique eliminates 
excessive qualifying. For example: 



Programming Techniques 165 



01 MST-WORK-AREA. 

05 SAME-NAMES. (***) 
10 LAST- NAME PIC... 
10 FIRST-NAME PIC. . . 
10 PAYROLL PIC... 



addition, the compiler can then diagnose 
errors if the data record description 
conflicts with the RECORD CONTAINS clause. 



WORKING-STORAGE SECTION 



05 DIFF- NAMES REDEFINES SAME-N/IMES. 

10 MST- LAST- NAME PIC. . . 

10 MST- FIRST-NAME PIC... 

10 MST- PAYROLL PIC. . . 
01 RPT-WORK-AREA. 

05 SAME-NAMES. (***) 

10 PAYROLL PIC. . . 

10 FILLER PIC... 

10 FIRST-NAME PIC. . . 

10 FILLER PIC... 

10 LAST-NAME PIC. . . 



PROCEDURE DIVISION. 



IF MST- PAYROLL IS EQUAL TO HDQ-PAYROLL 

AITO MST-LAST-NAME 

IS NOT EQUAL TO PRRV-LAST-NAME 

MOVE CORRESPONDING 

MST-WORK-AREA 

TO RPT-WORK-AREA. 

Note ; Fields marked *** above must have 
exactly the same names for their 
subordinate fields to be considered 
"corresponding. " The same names must not 
be the redefining ones or they will not be 
considered to correspond. 



Level Numbers 



The programmer should use widely 
incremented level numbers such as 01, 05, 
10, 15, etc., instead of 01, 02, 03, 04, 
etc. , in order to allow space for f ut\ire 
insertions of group levels. For 
readability, indent level numbers. Use 
level number 88 for codes. Thus, if the 
codes must be changed, the Procedure 
Division coding for tests need not be 
changed. 



Separate Modules 



In a large program, the programmer 
should plan ahead for breaking the programs 
into separately compiled modules, as 
follows : 

1. When using separate modules, an 
attempt should be made to combine 
entries of each Working- Storage 
Section into a single level-01 record 
(or a single level-01 record for each 
32K bytes) . Logical record areas can 
be indicated by using level-02, -03, 
etc., entries. A CALL statement with 
the USING option is more efficient 
when a single item is passed than when 
many level-01 and/or -77 items are 
passed. When this method is employed, 
mistakes are more easily avoided. 

2. Areas which do not contain VALUE 
clauses should be separated from areas 
that do contain VALUE clauses. VALUE 
clauses (except for level-88 items) 
are invalid in the Linkage Section. 

3. When the Working- Storage Section 
consists of one level-01 item without 
any VALUE clauses, the COPY statement 
can easily be used to include the item 
as the description of a Linkage 
Section in a separately compiled 
module. 

4. See the chapter "Using the 
Segmentation Feature" for additional 
information on how to modularize the 
Procedure Division of a COBOL program. 



Locating the Working-Storage Section in 
Dumps 



FILE SECTION 



RECORD CONTAINS Clause 



The programmer should use the RECORD 
CONTAINS clause with the integer CHARACTERS 
option in order to save himself, as well as 
any future programmer, the task of counting 
the data record description positions. In 



A simple method of locating the 
Working- storage Section of a program in 
object-time dumps is to include the two 
following statements as the first and last 
Working- Storage statements, respectively, 
in the program. 

77 FILLER PICTURE X(U4), VALUE "PROGRAM 

XXXXXXXX WORKING- STORAGE BEGINS HERE". 

01 FILLER PICTURE X(a2) , VALUE "PROGRAM 
XXXXXXXX WORKING-STORAGE ENDS HERE". 



166 






These two nonniimeric literals will 
appear in all dumps of the program, 
delimiting the Working- Storage Section. 
The program- name specified in the 
PROGRAM- ID clause should replace the 
XXXXXXXX in the literal. 



DATA DESCRIPTION 



The following illustrates how a table 
(TABLEA) can be initialized by having 
different data descriptions for the same 
data: 



05 VALUE- A. 

10 Al PICTURE S9(9) COMPUTATIONAL 

VALUE IS ZEROES. 
10 A2 PICTURE S9(9) COMPUTATIONAL 

VALUE IS 1. 



The Procedure Division operations that 
most often require adjustment of data items 
include the MOVE statement, the IF 
statement when used in a relation test, and 
arithmetic operations. Efficient use of 
data description clauses, such as 
REDEFINES, PICTURE; and USAGE, avoids the 
generation of extra code. 



10 AlOO PICTURE S9(9) COMPUTATIONA 
VALUE IS 99. 
05 TABLEA REDEFINES VALUE- A 

PICTURE S9(9) COMPUTATIONAL 
OCCURS 100 TIMES. 



REDEFINES Clause 



PICTURE Clause 



REUSING DATA AREAS ; The main storage area 
can be used more efficiently by writing 
different data descriptions for the same 
data area. For example, the coding that 
follows shows how the same area can be used 
as a work area for the records of several 
input files that are not processed 
concurrently . 

WORKING- STORAGE SECTION. 
01 WORK-AREA-FILEl. 

(largest record description for FILED 



DECIMAL- POINT ALIGNMENT ; Procedure 
Division operations are most efficient when 
the decimal positions of the data items 
involved are aligned. If they are not, the 
compiler generates instructions to align 
the decimal positions before any operations 
involving the data items can be executed. 



Assume, for example, that a program 
contains the following instructions; 



01 W0RK-AREA-FILE2 REDEFINES 
WORK-AREA-FILEl . 
(largest record description for FILE2) 



WORKING- STORAGE SECTION. 
77 A PICTURE S999V99. 
77 B PICTURE S99V9. 



PROCEDURE DIVISION. 



ALTERNATE GROUPINGS RND DESCRIPTIONS : 
Program data can often be described more 
efficiently by providing alternate 
groupings or data descriptions for the same 
data. For example, a program references 
both a field and its subfields, each of 
which is more efficiently described with a 
different usage. This can be done by using 
the REDEFINES clause as follows: 



ADD A TO B. 



Time and internal storage space are 
saved by defining B as; 



77 B PICTURE S99V99. 



01 PAYROLL-RECORD. 

05 EMPLOYEE-RECORD PICTURE X(28). 
05 EMPLOYEE- FIELD REDEFINES 

EMPLOYEE-RECORD . 

10 NAME PICTURE X(24). 

10 NUMBERX PICTURE S9(5) COMP. 
05 DATE-RECORD PICTURE X(10). 



If it is inefficient to define B 
differently, a one-time conversion can be 
done, as explained in "Data Format 
Conversion" in this chapter. 



Programming Techniques 167 



FIEL DS OF UNEQUAL LENGTH ; When a data item 
is moved to another data item of a 
different length, the following should be 
considered: 

• If the items are external decimal 
items, the compiler generates 
instructions to insert zeros in the 
high-order positions of the receiving 
field, when it is the larger. 

• If the items are nonnumeric, the 
compiler generates instructions to 
insert spaces in the low-order 
positions of the receiving field (or 
the high-order positions if the 
JUSTIFIED RIGHT clause is specified) . 
This generation of extra instructions 
can be avoided if the sending field is 
described with a length equal to or 
greater than the receiving field. 



SIGN USAGE ; The presence or absence of a 
plus or minus sign in the description of an 
arithmetic field often can affect the 
efficiency of a program. The following 
paragraphs discuss some of the 
considerations. 



Decimal Items ; The sign position in an 
internal or external decimal item can 
contain: 



1. A plus or minus sign. If S is 

specified in the PICTURE clause, a 
plus or minus sign is inserted when 
either of the following conditions 
prevail : 

a. The item is in the Working-Storage 
isection and a VALUE clause has 
been specified. 

b. A value for the item is assigned 
as a result of an arithmetic 
operation during execution of the 
program. 

If an external decimal item is 
punched, printed, or displayed, an 
overpunch will appear in the low-order 
digit. In EBCDIC, the configiiration 
for low-order zeros normally is a 
nonprintable character. Low-order 
digits of positive values will be 
represented by one of the letters A 
through I (digits 1 through 9) ; 
low- order digits of negative values 
will be represented by one of the 
letters J through R (digits 1 through 
9). 



2. A hexadecimal F. If S is not 

specified in the PICTURE clause, an F 
is inserted in the sign position when 
either of the following conditions 
prevail : 

a. The item is in the Working- Storage 
Section and a VALUE clause has 
been specified 

b, A value for the item is developed 
during the execution of the 
program. 

An F is treated as positive, but is 
not an overpunch. 



3. An invalid configuration. If an 
internal or external decimal item 
contains an invalid configuration in 
the sign position, and if the item is 
involved in a Procedure Division 
operation, the program will be 
abnormally terminated. 



Unsigned items (items for which no S has 
been specified) are treated as absolute 
values. Whenever a value (signed or 
unsigned) is stored in or moved in an 
elementary move to an unsigned item, a 
hexadecimal F is stored in the sign 
position of the unsigned item. For 
example, if an arithmetic operation 
involves signed operands and an unsigned 
result field, compiler-generated code will 
insert an F in the sign position of the 
result field when the result is stored. 



For internal and external decimal items 
used as input, it is the user* s 
responsibility to ensure that the input 
data is valid. The compiler does not 
generate a test to ensure that the 
configuration in the sign position is 
valid. 



When a group item is being moved, the 
data is moved without regard to the level 
structure of the group items involved. The 
possibility exists that the configuration 
in the sign position of a subordinate 
numeric item may be destroyed. Therefore, 
caution should be exercised in moving group 
items with subordinate numeric fields or 
with other group operations such as READ or 
ACCEPT. 



168 



USAGE Clause 



The USAGE clause should be written at 
the highest level possible. 

DATA FORMAT CONVERSION : Operations 
involving mixed, elementary numeric data 
formats require conversion to a common 
format. This usually means that additional 
storage is used and execution time is 
increased. The code generated must often 
move data to an internal work area, perform 
any necessary conversion, and then execute 
the indicated operation, often, too, the 
result may have to be converted in the same 
way. Table 23 indicates when data 
conversion is necessary. 



If it is impractical to use the same 
data formats throughout a program, and if 
two data items of different formats are 
frequently used together, a one-time 
conversion can be effected. For example, 
if A is defined as a COMPUTATIONAL item and 
B as a COMPUTATIONAL- 3 item, A can be moved 
to a work area that has been defined as 
COMPUTATIONAL- 3. This move causes the data 
in A to be converted to COMPUTATIONAL- 3. 
Whenever A and B are used in a Procedvire 
Division operation, reference can be made 
to the work area rather than to A. When 
this technique is used, the conversion is 
performed only once, instead of each time 
an operation is performed. 



o 



Programming Techniques 169 



Table 23. Data Format Conversion 



Usage 



Bytes 
Required 



Boundary 

Alignment 

Required 



Typical 
Usage 



Converted 
for 
Arithmetic 
Operations 



Special 
Characteristics 



DISPLAY 
( external 
decimal ) 



1 per digit 
(except for 
V) 



No 



Input from 
cards, output 
to cards, 
listings 



Yes 



I 

DISPLAY 
(external 

floating 

point) 



4 



May be used for numeric 
fields up to 18 digits 
long. 

Fields over 15 digits 
require extra instruc- 
tions if used in 
computations . 



1 per 
character 
(except for 
V) 



No 



4 



Input from 
cards, output 
to cards, 
listings 



Yes 



Converted to COMP-2 
format via COBOL library 
subroutine. 



COMP-3 
(internal 
decimal ) 



1 per 2 
digits plus 
1 byte for 
low- order 
digit and 
sign 



No 



Input to a 
report item 

Arithmetic 
fields 

Work areas 



Sometimes 
when a 
small 

COMP-3 item 
is used 
with a 
small COMP 
item 



Requires less space than 
DISPLAY. 

Convenient form for 
decimal alignment. 

Can be used in arithmetic 
computations without 
conversion. 

Fields over 15 digits 
require a subroutine when 
used in computations. 



COMP 
(binary) 



2 if l<N<a 

4 if 5<N<9 

8 if 10<N<18 
where N is 
the number of 
9 ' s in the 
picture 



Half word 
Fullword 
Fullword 



Subscripting 

Arithmetic 
fields 



Sometimes 
for both 
mixed and 
unmixed 
usages 



I 

COMP-1 
(internal 

floating 

point) 



Rounding and testing for 
the ON SIZE ERROR 
condition are cumbersome 
if calculated result is 
greater than 9(9). 

Extra instructions are 
generated for binary 
computations if the 
SYNCHRONIZED clause is 
not specified. 

Fields of over nine 
digits reqiiire additional 
handling. 



H (short- 
precision) 



Fullword 



Fractional 
exponentiation 



No 



Tends' to produce less 
accurate results if more 
than 17 significant 
digits are required and 
if the exponent is 
large. 

Requires floating-point 
feature. 



COMP-2 
( internal 

floating 

point) 



8 (long- 
precision) 



Double- 
word 



Fractional 
exponenti at i on 
when addition- 
al precision 
is required 



No 



Same as COMP-1. 



170 



The following seven cases show how data 
conversions are handled on mixed elementary 
items for names, data comparisions, and 
arithmetic operations. Moves without the 
CORRESPONDING option to and from group 
items, as well as comparisons involving 
group items, are done without conversion. 



To Perform Arithmetic Operations ; Converts 
COMPUTATIONAL to COMPUTATIONAL- 3 data or 
vice versa, depending on the size of the 
field. 



COMPUTATIONAL to Niameric DISPLAY: 



Numeric DISPLAY to COMPUTATIONAL- 3: 



To Move Data ; Converts COMPUTATIONAL data 
to COMPUTATIONAL- 3 data and then to DISPLAY 
data. 



To Move Data ; Converts DISPLAY data to 
COMPUTATIONAL- 3 data. 



To Compare Data : Converts DISPLAY data to 
COMPUTATIONAL- 3 data. 



To Compare Data ; Converts. DISPLAY to 
COMPUTATIONAL or both COMPUTATIONAL and 
DISPLAY data to COMPUTATIONAL-3 data, 
depending on the size of the field. 



To Perform Arithmetic Operations : Converts 
DISPLAY data to COMPUTATIONAL-3 data. 



Numeric DISPLAY to COMPUTATIONAL : 

TO Move Data ; Converts DISPLAY data to 
COMPUTATIONAL-3 data and then to 
COMPUTATIONAL data. 



To Perform Arithmetic Operations ; 
Depending on the size of the field, 
converts DISPLAY data to COMPUTATIONAL 
data, or both DISPLAY and COMPUTATIONAL 
data to COMPUTATIONAL-3 data in which case 
the result is generated in a 
COMPUTATIONAL-3 work area and then 
converted and moved to the DISPLAY result 
field. 



To Compare Data ; Converts DISPLAY to 
COMPUTATIONAL or converts both DISPLAY and 
COMPUTATIONAL data to COMPUTATIONAL-3 data. 



COMPUTATIONAL-3 to Numeric DISPLAY: 



To Perform Arithmetic Operations : Converts 
DISPLAY data to COMPUTATIONAL-3 or 
COMPUTATIONAL data. 



To Move Data ; Converts COMPUTATIONAL-3 
data to DISPLAY data. 



COMPUTATIONAL-3 to COMPUTATIONAL ; 

To Move Data : Moves COMPUTATIONAL-3 data 
to a work area and then converts 
COMPUTATIONAL-3 data to COMPUTATIONAL data. 



To Compare Data ; Converts DISPLAY data to 
COMPUTATIONAL-3 data. The restilt is 
generated in a COMPUTATIONZy:*- 3 work area 
and is then converted and moved to the 
DISPLAY result field. 



To Compare Data ; Converts COMPUTATIONAL 
data to COMPUTATIONAL-3 or vice versa, 
depending on the size of the field. 

To Perform Arithmetic Operations : Converts 
COMPUTATIONAL data to COMPUTATIONAL-3 or 
vice versa, depending on the size of the 
field. 



Numeric DISPLAY to Numeric DISPLAY: 



To Perform Arithmetic Operations : Converts 
all DISPLAY data to COMPUTATIONAL-3 data. 
The result is generated in a 
COMPUTATIONAL-3 work area and is then 
converted to DISPLAY and moved to the 
DISPLAY result field. 



r 



COMPUTATIONAL to COMPUTATIONAL-3 : 

To Move Data : Converts COMPUTATIONAL data 
to COMPUTATIONAL-3 data in a work area, and 
then moves the work area. 

To Compare Data ; Converts COMPUTATIONAL to 
COMPUTATIONAL-3 data or vice versa, 
depending on the size of the field. 



Internal Floating-point to Any Other : When 
an item described as COMPUTATIONAL-1 or 
COMPUTATIONAL- 2 (internal floating-point) 
is used in an operation with another data 
format, the item in the other data format 
is always converted to internal floating- 
point. If necessary, the internal 
floating-point result is then converted to 
the format of the other data item. 



Programming Techniques 171 



SYNCHRONIZED Clause 



As illustrated in Table 20, 
COMPUTATIONAL, COMPUTATIONAL-1 and 
COMPUTATIONAL- 2 items have specific 
boundary alignment requirements. To ensiire 
correct alignment, either the programmer or 
the compiler may have to insert slack 
bytes. 

The SYNCHRONIZED clause may be used at 
the elementary level to specify the 
automatic alignment of elementary items on 
their proper boundaries, or at the 01 level 
to synchronize all elementary items within 
the group. For COMPUTATIONAL items, if the 
PICTURE is in the range of S9 through 
S9(U)", the item is aligned on a halfword 
boundary. If the PICTURE is in the range 
of 89(5) through S9(18), the item is 
aligned on a fullword boundary. For 
COMPUTATIONAL-1 items, the item is aligned 
on a fullword boundary. For 
COMPUTATIONAL- 2 items, the item is aligned 
on a doubleword boundary. The SYNCHRONIZED 
clause and slack bytes are fully discussed 
in the publication IBM System/360 Disk 
Operating System: American National 
Standard COBOL. 



Special Considerations for DISPLAY and 
COMPUTATIONAL Fields 



statements that involve COMPUTATIONAL- 3 
data. The zeros are inserted by the 
instruction set. 



Data Formats in the Computer 



The following examples illustrate how 
the various COBOL data formats appear in 
the computer in EBCDIC (Extended 
Binary-Coded-Decimal Interchange Code) 
format. More detailed information about 
these data formats appear in the 
publication IBM Svstem/360 Principles of 
Operation . 

Numeric DISPLAY (External Decimal) ; 
Suppose the value of an item is -1234, and 
its PICTURE and USAGE clauses are: 

PICTURE 9999 DISPLAY. 



or 



PICTURE S9999 DISPLAY. 

The item appears in the computer in the 
following forms, respectively: 

I Fl I F2 I F3 I F4 I 
L X X i J 

Byte 



NUMERI C DISPLAY FIELDS : Zeros are not 
inserted into numeric DISPLAY fields by the 
instruction set. When numeric DISPLAY data 
is moved, the compiler generates 
instructions that insert any necessary 
zeros into the DISPLAY fields. When 
numeric DISPLAY data is compared, and one 
field is smaller than the other, the 
compiler generates instructions to move the 
smaller item to a work area where zeros are 
inserted. 

COMPUTATIONAL FIELDS : COMPUTATIONAL fields 
can be aligned on either a halfword or 
fullword boundary. If an operation 
involves COMPUTATIONAL fields of different 
lengths, the halfword field is 
automatically expanded to a fullword field. 
Therefore, mixed halfword and fullword 
fields require no additional operations. 

COMPUTATIONAL-1 AND COMPUTATIONAL- 2 FIELDS : 
If an arithmetic operation involves a 
mixture of short-precision and 
long-precision fields, the compiler 
generates instructions to expand the 
short-precision field to a long-precision 
field before the operation is executed. 

COMPUTATIONAL- 3 FIELDS ; The compiler does 
not have to generate instructions to insert 
high-order zeros for ADD and SUBTRACT 



I Fl I F2 I F3 I D4 I 
L J J. ± J 

Byte 

Hexadecimal F is treated arithmetically as 
positive; hexadecimal D represents a minus 
sign. 

COMPUTATIONAL- 3 (Internal Decimal) : 
Suppose the value of an item is +1234, and 
its PICTURE and USAGE clauses are: 

PICTURE 9999 COMPUTATIONAL-3. 

or 

PICTURE S9999 COMPUTATIONAL-3. 

The item appears internally in the 
following forms, respectively: 

I 01 I 23 I 4F I 
I J JL J 

Byte 



I 01 I 23 I 40 I 

L X X J 



I 



Byte 



172 



Hexadecimal F is treated arithmetically as 
positive; hexadecimal C represents a plus 
sign. 



Note ; Since the low- order byte of an 
internal decimal number always contains a 
sign field, an item with an odd nxiraber of 
digits can be stored more efficiently than 
an item with an even number of digits. 
Note that a leading zero is inserted in the 
above example. 



Binary Item Manipulation ; A binary item is 
allocated storage ranging from one halfword 
to two fullwords, depending on the number 
of 9's in its PICTURE. Table 2H is an 
illustration of how the compiler allocates 
this storage. Note that it is possible for 
a value larger than that implied by the 
PICTURE clause to be stored in the item. 
For example, PICTURE S9(4) implies a 
maximum value of 9,999, although it could 
actually hold the number 32,767. 



COMPUTATIONAL (Binary) ; Suppose the value 
of an item is 1234, and its PICTURE and 
USAGE clauses are; 

PICTURE S9999 COMPUTATIONAL. 

The item appears internally in the 
following form: 

I 0000 I 0100 I 1101 I 0010 I 
L ± X X J 



Sign 
Position 



A in the sign position indicates that 
the number is positive. Negative numbers 
\ are represented in two's complement form; 
,^ thus, the sign position of a negative 
number will always contain a 1. 



For example -1234 would appear as 
follows ; 

I 1111 I 1011 I 0010 I 1110 I 
L X X X J 



Sign 
Position 



Because most binary items are 
manipulated according to their allotted 
storage capacity, the programmer can ignore 
this situation. For the following reasons, 
however, he must be careful of his data; 



1. When the ON SIZE ERROR option is used, 
the size test is made on the basis of 
the maximum value allowed by the 
picture of the resiilt field. If a 
size error condition exists, the value 
of the result field is not altered and 
control is given to the imperative- 
statements specified by the error 
option. 



When a binary item is displayed or 
exhibited, the value used is a 
function of the number of 9's 
specified in the PICTURE clause. 



3. When the actual value of a positive 
number is significantly larger than 
its pictiare value, a value of 1 could 
appear in the sign position of the 
item, causing the item to be treated 
as a negative number in s\ibsequent 
operations. 



Table 24. Relationship of PICTURE to Storage Allocation 



PICTURE 



j. 

|S9 through S9(U) 

I 

|S9(5) through S9(9) 

I 

1S9(10) through S9(18) 

L 



Maximiim Working Value j 

4- 



Assigned Storage 



32,767 

2,147,483,647 

9,223,372,036,854,775,807 



One halfword 
One fullword 
Two fullwords 



Programming Techniques 173 



I T T T 

I I Hexadecimal Result of | Decimal | Actual Decimal Value 
I Case I Binary Calculation | Equivalent | in Halfword of storage 
I 1 



H- 



h 



B 



0008 



8 



+ 8 



OOOA 



10 



+ 10 



DISPLAY or 
EXHIBIT Value 



I C I C350 I 50000 I -15536 

I J. ± J. J. 

Figure 52. Treatment of Varying Values in a Data Item of PICTURE S9 



Figure 52 illustrates three binary 
manipulations. In each case, the result 
field is an item described as PICTURE S9 
COMPUTATIONAL. One halfword of storage has 
been allocated, and no ON SIZE ERROR option 
is involved. Note that if the ON SIZE 
ERROR option had been specified, it would 
have been executed for cases B and C. 



C O MPUTATIONAL- 1 or COMPUTATIONAL- 2 
(Floating-point) ; Suppose the value of an 
item is +1234 and that its USUAGE is 
COMPUTATIONAL-1, the item appears 
internally in the following fojnn: 



MODULARIZING THE PROCEDURE DIVISION 



Modularization involves organizing the 
Procedure Division into at least three 
functional levels: a main- line routine, 
processing subroutines, and input/output 
subroutines. When the Procedure Division 
is modularized, programs are easier to 
maintain and document. In addition, 
modxilarization makes it simple to break 
down a program using the segmentation 
feature, resulting in a more efficient 
segmented program. 



|0|100 0011|0100 1101 0010 0000 0000 00001 
L_J. ± J 

S 1 7 8 31 

S is the sign position of the niimber. 

A in the sign position indicates 
that the sign is plus. 

A 1 in the sign position indicates 
that the sign is minus. 

Bits 1 through 7 are the exponent 
(characteristic) of the number. 

Bits 8 through 31 are the fraction 
(mantissa) of the number. 

This form of data is referred to as 
floating point. The example illustrates 
short-precision floating-point data 
(COMPUTATIONAL-1). In long-precision 
(COMPUTATIONAL-2), the fraction length is 
56 bits. (For a detailed explanation of 
floating-point representation, see the 
publication IBM Svstem/360 Principles of 
Operation . ) 



PROCEDURE DIVISION 



The Procedure Division of a program can 
often be made more efficient or easier to 
debug by using some of the techniques 
described below. 



Main- Line Routine 



The main-line routine should be short 
and simple, and should contain all the 
major logical decisions of the program. 
This routine controls the order in which 
second- level subroutines are executed. All 
second-level subroutines should be invoked 
from the main- line routine by PERFORM 
statements. 



^. 



Processing Subroutines 



Processing subroutines should be broken 
down into as many functional levels as 
necessary, depending on the complexity of 
the program. These must be completely 
closed subroutines, with one entry point 
and one exit point. The entry point should 
be the first statement of the subroutine. 
The exit point should be the EXIT 
statement. Processing subroutines can 
PERFORM only lower level subroutines; 
return to the higher level subroutine 
(processing subroutine) must be 
accomplished by a GO TO statement that 
references the EXIT statement. 



174 



</-'-. 



Input/Output Subroutines 



Intermediate Results and COBOL Library 
Subroutines 



The input/output subroutines should be 
the lowest level subroutines, since all 
higher level subroutines have access to 
them. There should be one OPEN subroutine 
and one CLOSE subroutine for the program, 
and only one functional (READ or WRITE) 
s\ibroutine for each file. Having one READ 
or WRITE subroutine per file has several 
advantages : 



1. Coding can be added to count records 
on a file, transform blanks into 
zeros, check for 9*s padding, etc. 



2. Input and output files can be 
reformatted without changing the logic 
of the program. 

3. DEBUG statements can be added during 
testing to create input or to DISPLAY 
formatted output, instead of having to 
create a test file. 



If a decimal multiplication operation 
requires an intermediate result greater 
than 30 digits, a COBOL library subroutine 
is used to perform the multiplication. The 
result of this multiplication is then 
trioncated to 3 digits. 

A COBOL library s\jbroutine is used to 
perform division if: 

1. The divisor is equal to or greater 
than 15 digits. 

2. The length of the divisor plus the 
length of the dividend is greater than 
16 bytes. 

3. The scaled dividend is greater than 30 
digits. (A scaled dividend is a 
number that has been multiplied by a 
power of ten in order to obtain the 
desired number of decimal places in 
the quotient. ) 



INTERMEDIATE RESULTS 



Intermediate Results Greater Than 30 Digits 



The compiler treats arithmetic 
statements as a succession of operations 
and sets up intermediate result fields to 
contain the results of these operations. 
Examples of such statements are the 
arithmetic statements and statements 
containing arithmetic expressions. See the 
appendix "Intermediate Results" in the 
publication IBM System/360 Disk Operating 
I System: American National Standard COBOL 
for a description of the algorithms used by 
the compiler to determine the number of 
places reseirved for intermediate result 
fields. 



Intermediate Results and Binary Data Items 



If an operation involving binary 
operands requires an intermediate result 
greater than 18 digits, the compiler 
converts the operands to internal decimal 
before performing the operation. If the 
result field is binary, the result will be 
converted from internal decimal to binary. 

If an intermediate result will not be 
greater than nine digits, the operation is 
performed most efficiently on binary data 
fields. 



Whenever the number of digits in a 
decimal intermediate result is greater than 
30, the field is truncated to 30 digits. A 
warning message will be generated during 
compilation, and program flow will not be 
interrupted at execution time. This 
truncation may cause a result to be 
incorrect. 

If binary or internal decimal data is in 
agreement with its data description, no 
interrupt can occur because of an overflow 
condition in an intermediate result. This 
is due to the truncation described in the 
preceding paragraph. 

If the possibility exists that an 
intermediate result field may exceed 30 
digits, truncation can be avoided by the 
specification of floating-point operands 
(COMPUTATIONAL-1 or COMPUTATIONAL-2) ; 
however, accuracy may not be maintained. 



Intermediate Results and Floating-point 
Data Items. 



If a floating-point operand has an 
intermediate resiilt field in which exponent 
overflow occurs, the job will be abnormally 
terminated. 



Programming Techniques 175 



Intermediate Results and the ON SIZE ERROR Note: The other rules for MOVE 



Option 



CORRESPONDING, of course, must still be 
satisfied. 



The ON SIZE ERROR option applies only to 
the final calculated results and not to 
intermediate result fields. 



PROCEDURE DIVISION STATEMENTS 



NOTE Statement 



An asterisk (*) should be used in place 
of the NOTE statement since there is the 
possibility that when NOTE is the first 
sentence in a paragraph, it will 
inadvertently cause the whole paragraph to 
be treated as part of the NOTE, 



COMPUTE Statement 



PERFORM Statement 



The use of the COMPUTE statement 
generates more efficient coding than does 
the use of individual arithmetic 
statements, since the compiler can keep 
track of internal work areas and does not 
have to store the results of intermediate 
calculations. It is the user's 
responsibility, however, to ensure that the 
data is defined with the level of 
significance required in the answer. 



IF Statement 



Nested and compo\and IF statements should 
be avoided as the logic is difficult to 
debug. 



MOVE Statement 



Performing a MOVE operation for an item 
longer than 256 bytes requires the 
generation of more instructions than are 
required for that of a MOVE operation for 
an item of 256 bytes or less. 

When a MOVE statement with the 
CORRESPONDING option is executed, data 
items are considered as "corresponding" 
only if their respective data-names are the 
same, including all implied qualification 
up to, but not including, the data-names 
used in the MOVE statement itself. 



For example: 

01 AA 

05 BB 
10 CC 
10 DD 

05 EE 
10 FF 



01 



XX 

05 BB 
10 CC 
10 DD 

05 YY 
10 FF 



The statement MOVE CORRESPONDING AA TO XX 
will result in moving CC, but not FF, since 
FF of EE does not correspond to FF of YY. 



PERFORI-l is a useful statement if the 
programmer adheres to the following rules: 

1. Always execute the last statement of a 
series of routines being operated on 
by a PERFORM statement. When 
branching out of the routine, make 
sure control will eventually return to 
the last statement of the routine, 
which should be an EXIT statement. 
Although no code is generated, the 
EXIT statement allows a programmer to 
immediately recognize the extent of a 
series of routines within the range of 
a PERFORM statement. 

2. Always either PERFORM routine-name 
THRU routine-name-exit, or PERFORM 
section-name. A PERFORM 

paragraph -name can create problems for 
the programmer trying to maintain the 
program. For example, if one 
paragraph must be broken into two 
paragraphs, the programmer must 
examine every statement to determine 
whether this paragraph is within the 
range of the PERFORM statement. As a 
result, all statements referencing the 
paragraph-name must be changed to 
PERFORM THRU statements. 



READ INTO AND WRITE FROM OPTIONS 



Always use READ INTO and WRITE FROM, and 
process all files in the Working-Storage 
Section for the following reasons: 

1. Debugging is much simpler. 

Working- Storage areas are easier to 
locate in a dump than are buffer 
areas. And, if files are blocked, it 
is much easier to determine which 
record in a block was being processed 
when the abnormal termination 
occtirred. 



176 



2. Trying to access a record- area after 
the AT END condition has occurred (for 
example, AT END MOVE HIGH-VALUE TO 
INPUT-RECORD) can cause problems if 
the record area is defined only in the 
File Section. 



For each GENERATE statement, the records 
for REPORT- A will be written on FILE-1 and 
FILE- 2, respectively. The records on 
FILE- 2 will not contain colximns 102 through 
121 of the corresponding records on FILE-1, 



Note ; The programmer should be aware that 
additional time is used to execute the move 
operation involved in each READ INTO or 
WRITE FROM instruction. 

When a READ INTO statement is used for a 
V-mode or U-mode file, the size of the 
longest record for that file is used in the 
MOVE statement. All other rules of the 
MOVE statement apply. 



TRACE Statement 



The programmer should remember that the 
RESET or READY Options of the TRACE 
statement are initialized with each 
execution of a CALL statement. 



Summing Techniques 



Execution time in an object program can 
be made more efficient by keeping in mind 
that Report Writer source coding is treated 
as though the programmer had written the 
program in COBOL without the Report Writer 
featTire. Therefore, a complex source 
statement or series of statements will 
generally be, executed faster than simple 
statements that perform the same function. 
The following example shows two coding 
techniques for the Report Section of the 
Data Division, Method 2 uses the more 
complex statements. 

RD... CONTROLS ARE YEAR MONTH WEEK DAY. 

Method 1: 



^. 



TRANSFORM Statement 



The TRANSFORM statement generates more 
efficient code than the EXAMINE REPLACING 
BY statement when only one character is 
being transformed. The TRANSFORM 
statement, however, uses a 256-byte table. 



01 TYPE CONTROL FOOTING YEAR. 

02 SUM COST. 
01 TYPE CONTROL FOOTING MONTH. 

02 SUM COST. 
01 TYPE CONTROL FOOTING WEEK. 

02 SUM COST. 
01 TYPE CONTROL FOOTING DAY. 

02 SUM COST. 

Method 2: 



USING THE REPORT WRITER FEATURE 

REPORT Clause in a File Description (FD) 
Entry 



A given report-name may appear in a 
maximum of two file description entries. 
The file description entries need not have 
the same characteristics. If the same 
report-name is specified in two file 
description entries, the report will be 
written on both files. For example: 

ENVIRONMENT DIVISION. 

SELECT FILE-1 ASSIGN SYS005-UR-1403-S. 
SELECT FILE-2 ASSIGN SySOOl-UT-2400-S, 



DATA DIVISION. 

FD FILE-1 RECORDING MODE F 

RECORD CONTAINS 121 CHARACTERS 

REPORT IS REPORT-A. 
FD FILE-2 RECORDING MODE V 

RECORD CONTAINS 101 CHARACTERS 

REPORT IS REPORT-A. 



01 TYPE CONTROL FOOTING YEAR. 

02 SUM A. 
01 TYPE CONTROL FOOTING MONTH. 

02 A SUM B. 
01 TYPE CONTROL FOOTING WEEK. 

02 B SUM C. 
01 TYPE CONTROL FOOTING DAY. 

02 C SUM COST. 

Method 2 will execute faster. One 
addition will be performed for each day, 
one more for each week, and one for each 
month. In Method 1, four additions will be 
performed for each day. 



Use of SUM 



Unless each identifier is the name of a 
SUM counter in a TYPE CONTROL FOOTING 
report group at an equal or lower position 
in the control hierarchy, the identifier 
must be defined in the File, Working- 
Storage, or Linkage Sections as well as in 
a TYPE DETAIL report group as a source 
item. A SUM counter is algebraically 



Programming Techniques 177 



incremented just before presentation of the 
TYPE DETAIL report group in which the item 
being summed appears as a so\irce item or 
the item being summed appeared in a SUM 
clause that contained an UPON option for 
this DETAIL report group. This is known as 
SOURCE- SUM corresponding. In the following 
example, SUBTOTAL is incremented only when 
DETAIL- 1 is generated. 

FILE SECTION. 



02 NO-PURCHASES PICTURE 99. 



REPORT SECTION. 

01 DETAIL-1 TYPE DETAIL. 

02 COLUMN 30 PICTURE 99 SOURCE 
NO-PURCHASES. 



01 DETAIL- 2 TYPE DETAIL. 



01 DAY TYPE CONTROL FOOTING 
LINE PLUS 2. 



02 SUBTOTAL COLUMN 30 PICTURE 999 
SUM NO-PURCHASES. 



01 MONTH TYPE CONTROL FOOTING 
LINE PLUS 2 NEXT GROUP 
NEXT PAGE. 



sequence. When GENERATE report-name 
statement is executed and the report 
contains more than one DETAIL report group, 
the SUM routine is executed for each one. 
The SUM routines are executed in the 
sequence in which the DETAIL report groups 
are specified. 

The following two examples show the SUM 
routines that are generated by the Report 
Writer. Example 1 illustrates how operands 
are selected for inclusion in the routine 
on the basis of simple SOURCE-SUM 
correlation. Example 2 illustrates how 
operands are selected when the UPON 
detail-name option is specified. 

Example 1 ; The following statements are 
coded in the Report Section: 

01 DETAIL-1 TYPE DE . . . 
02 ...SOURCE A. 



01 DETAIL-2 TYPE DE 
02 ...SOURCE B. 
02 ...SOURCE C. 



V 



01 DETAIL- 3 TYPE DE .. 
02 ...SOURCE B, 



01 TYPE CF ... 
02 SUM-CTR-1 



SUM A, B, C. 



01 TYPE CF ... 

02 SUM-CTR-2 ...SUM B. 



SUM Routines 



A SUM routine is generated by the Report 
Writer for each DETAIL report group of the 
report. The operands included for summing 
are determined as follows: 

1. The SUM operand (s) also appears in a 
SOURCE clause (s) for the DETAIL report 
group. 

2. The UPON detail-name option was 
specified in the SUM clause. In this 
case, all the operands are included in 
the SUM routine for only that DETAIL 
report group, even if the operand 
appears in a SOURCE clause in other 
DETAIL report groups. 

When a GENERATE detail-name statement is 
executed, the SUM routine for that DETAIL 
report group is executed in its logical 



A SUM routine is generated for each 
DETAIL report group, as follows: 

SUM-ROUTINE FOR DETAIL-1 

REPORT- SAVE 

ADD A TO SUM-CTR-1. 
REPORT-RETURN 

SUM-ROUTINE FOR DETAIL-2 

REPORT- SAVE 

ADD B TO SUM-CTR-1. 

ADD C TO SUM-CTR-1. 

ADD B TO SUM-CTR-2. 
REPORT-RETURN 

SUM-ROUTINE FOR DETAIL-3 

RE PORT- SAVE 

ADD B TO SUM-CTR-1. 

ADD B TO SUM-CTR-2. 
REPORT-RETURN 



178 



/-- 



Example 2 ; This example uses the same 
coding as Example 1, with one exception: 
the UPON detail -name option is used for 
SOM-CTR-1, as follows: 

01 TYPE CF ... 

02 SUM-CTR-1 ...SUM A, B, C 
UPON DETAIL- 2. 

The following SUM routines would then be 
generated instead of those shown in the 
previous example: 

SUM Routine for DETAIL- 1 

REPORT-SAVE 
REPORT-RETURN 

SUM Routine for DETAIL-2 

REPORT-SAVE 

ADD A TO SUM-CTR-1. 

ADD B TO SUM-CTR-1. 

ADD C TO SUM-CTR-1. 

ADD B TO SUM-CTR-2. 
REPORT-RETURN 

SUM Routine for DETAIL- 3 

REPORT- SAVE 

ADD B TO SUM-CTR-2. 
REPORT-RETURN 



Output Line Overlay 



The Report Writer output line is created 
using an internal REDEFINES specification, 
indexed by integer- 1 . No check is made to 
prevent overlay on any line. For example: 

02 COLUMN 10 PICTURE X(23) 

VALUE "MONTHLY SUPPLIES REPORT". 

02 COLUMN 12 PICTURE X(9) 
SOURCE CURRENT- MONTH. 



Heading at the top of each page, he 
must include the information and data 
to be printed as part of the Page 
Heading. Since only one Page Heading 
may be specified for each report, he 
should be selective in considering his 
Control Heading because it will be the 
same for each page, and may be printed 
at inappropriate times (see "Control 
Footings and Page Format" in this 
chapter) . 

2. GROUP INDICATE items are printed after 
page and control breaks. Figure 53 
contains a GROUP INDICATE clause and 
illustrates the execution output. 



REPORT SECTION. 



01 DETAIL-LINE TYPE IS DETAIL LINE 
NUMBER IS PLUS 1. 
02 COLUMN IS 2 GROUP INDICATE 
PICTURE IS A(9) SOURCE IS 
MONTHNAME OF RECORD- AREA (MONTH) . 



(Execution Output) 
^ ^ 



JANUARY 



15 



AOO... 
A02... 



PURCHASES AND COST... 
^ ^ 



JANUARY 



21 



A03... 
A03. 



L J 

Figure 53. Sample of GROUP INDICATE Clause 
and Resultant Execution Output 



WITH CODE Clause 



A length of 27 in column 10, followed by a 
specification for column 12, will cause 
field overlay when this line is printed. 



Page Breaks 



The Report Writer page break routine 
operates independently of the routines that 
are executed after any control breaks 
(except that a page break will occur as the 
result of a LINE NEXT PAGE clause). Thus, 
the programmer should be aware of the 
following facts: 



When more than one report is being 
written on a file and the reports are to be 
selectively written, a tinique 1-character 
code must be given for each report. A 
mnemonic-name is specified in the RD- level 
entry for each report and is associated 
with the code in the Special-Names 
paragraph of the Environment Division. 



Note: If a report is written with the CODE 
option, the report should not be written 
directly on a printer device. 



1. A Control Heading is not printed after 
a Page Heading except for first 
generation. If the programmer wishes 
to have the equivalent of a Control 



This code will be written as the first 
character of each record that is written on 
the file. When the programmer wishes to 
write a report from this file, he needs 



Programming Techniques 179 



only to read a record, check the first 
character for the desired code, and have it 
printed if the desired code is found. The 
record should be printed starting from the 
third character, as illustrated in Figure 
54. 



I Code 
L 



■T T 

I Control I 
I Character | Record 
.X X 

2 3 



Figure 54, Format of a Report Record When 
the CODE Clause is Specified 



PROCEDURE DIVISION. 



LOOP. READ RPT-IN-FILE AT END 

GO TO CONTINUE. 

IF CODE-CHR = "A" 

WRITE PRINT-REC FROM PRINT-PART 

AFTER POSITIONING CTL-CHR LINES. 

GO TO LOOP. 
CONTINUE. 



The following example shows how to 
create and print a report with a code of A. 
A Report Writer program contains the 
following statements: 

ENVIRONMENT DIVISION. 



SPECIAL- NAMES. 



DATA DIVISION. 



REPORT SECTION. 
RD REP- FILE- A 



A IS CODE-CHR-A 
B IS CODE-CHR-B. 



CODE CODE-CHR-A 



RD REP-FILE-B CODE CODE-CHR-B ... 

A second program could then be used to 
print only the report with the code of A, 
as follows: 



Control Footings and Page Format 



Depending on the number and size of 
Control Footings (as well as the page depth 
of the report) , all of the specified 
Control Footings may not be printed on the 
same page if a control break occurs for a 
high-level control. When a page condition 
is detected before all required Control 
Footings are printed, the Report Writer 
will print the Page Footing (if specified), 
skip to the next page, print the Page 
Heading (if specified) and then continue to 
print Control Footings. 



^- 



DATA DIVISION. 
FD RPT-IN-FILE 

RECORD CONTAINS 122 CHARACTERS 

LABEL RECORDS ARE STANDARD 

DATA RECORD IS RPT-RCD. 
01 RPT-RCD. 

05 CODE-CHR PICTURE X. 

05 PRINT-PART. 

10 PICTURE X. 

10 PICTURE X(120). 

FD PRINT-FILE 

RECORD CONTAINS 121 CHARACTERS 

LABEL RECORDS ARE STANDARD 

DATA RECORD IS PRINT-REC. 
01 PRINT-REC. 

05 FILLER PICTURE X(121). 



If the programmer wishes all of his 
Control Footings to be printed on the same 
page, he must format his page in the 
RD-level entry for the report (by setting 
the LAST DETAIL integer to a sufficiently 
low line number) to allow for the necessary 
space. 



""A 



180 



NEXT GROUP Clause 



01 TYPE DE LINE PLUS 5 



L, 



Each time a CONTROL FOOTING report group 
with a NEXT GROUP clause is printed, the 
clause is activated only if the report 
group is associated with the control that 
causes the break. This is illustrated in 
Figure 55. 



RD EXPENSE-REPORT CONTROLS ARE FINAL, 
MONTH, DAY 



01 TYPE CONTROL FOOTING DAY 
LINE PLUS 1 NEXT GROUP 
NEXT PAGE. 



01 TYPE CONTROL FOOTING MONTH 
LINE PLUS 1 NEXT GROUP 
NEXT PAGE. 



(Execution Output) 
EXPENSE REPORT 



January 31 29. 30 

(Output for CF DAY) 

January total 131. 40 

(Output for CF MONTH) 



Figure 55. Activating the NEXT GROUP 
Clause 



Note: The NEXT GROUP NEXT PAGE clause for 
the Control Footing DAY is not activated. 



Floating First Detail 



The first presentation of a body group 
(PH, PF, CH, CF, DE) that contains a 
relative line as its first line will have 
its relative line spacing suppressed; the 
first line will be printed on either the 
value of FIRST DETAIL or INTEGER PLUS 1 of 
a NEXT GROUP clause from the preceding 
page. For example: 

1. If the following body group was the 
last to be printed on a page 

01 TYPE CF NEXT GROUP NEXT PAGE 

then this next body group 



would be printed on value of FIRST 
DETAIL (in PAGE clause). 

2. If the following body group was the 
last to be printed on a page 

01 TYPE CF NEXT GROUP LINE 12 

and after printing, line-counter = 40, 
then this next body group 

01 TYPE DETAIL LINE PLUS 5 

would be printed on line 12 + 1 (i.e., 
line 13) . 



Report Writer Routines 



At the end of the analysis of a report 
description (RD) entry, the Report Writer 
routines are generated, based on the 
contents of the RD. Each routine has its 
own compiler-generated card number. 
Therefore, in the source listing, the last 
compiler-generated card number for an RD 
and that of the next source statement are 
not sequential. 



TABLE HANDLING CONSIDERATIONS 



Subscripts 



If a subscript is represented by a 
constant and if the subscripted item is of 
fixed length, the location of the 
subscripted data item within the table or 
list is resolved during compilation. 

If a subscript is represented by a 
data-name, the location is resolved at 
execution time. The most efficient format 
in this case is COMPUTATIONAL, with PICTURE 
size less than five integers. 

The value contained in a subscript is an 
integer which represents an occurrence 
number within a table. Every time a 
subscripted data-name is referenced in a 
program, the compiler generates up to 16 
instructions to calculate the correct 
displacement. Therefore, if a subscripted 
data-name is to be processed extensively, 
move the subscripted item to an 
unsubscripted work area, do all necessary 
processing, and then move the item back 
into the table. Even when subscripts are 
described as COMPUTATIONAL, subscripting 
takes time and core storage. 



Programming Techniques 181 



Index-names 



DEPENDING ON Option 



Index-names are compiler-generated 
items, one fullword in length, assigned 
storage in the TGT (Task Global Table). An 
index-name is defined by the INDEXED BY 
clause. The value in an index-name 
represents an actual displacement from the 
beginning of the table that corresponds to 
an occTorrence number in the table. Address 
calculation for a direct index requires a 
maximum of four instructions; address 
calculation for a relative index requires a 
few more. Therefore, the use of 
index-names in referencing tables is more 
efficient than the use of subscripts. The 
use of direct indexes is faster than the 
use of relative indexes. 



Index-names can only be referenced in 
the PERFORM, SEARCH, and SET Statements. 



Index Data Items 



Index data items are compiler-generated 
storage positions, one fullword in length, 
that are assigned storage within the COBOL 
program area. An index data item is 
defined by the USAGE IS INDEX clause. The 
programmer can use index data items to save 
values of index-names for later reference. 



Great care must be taken when setting 
values of index data items. Since an index 
data item is not part of any table, the 
compiler is unable to change any 
displacement value contained in an 
index-name when an index data item is set 
to the value of an index- name or another 
index data item. See the SET statement 
examples later in this chapter. 

Index data items can only be referenced 
in SEARCH and SET statements. 



If a data item described by an OCCURS 
clause with the DEPENDING ON data-name 
option is followed by nonsubordinate data 
items, a change in the value of data-name 
during the course of program execution will 
have the following effects: 

1. The size of any group described by or 
containing the related OCCURS clause 
will reflect the new value of 
data-name . 

2. Whenever a MOVE to a field containing 
an OCCURS clause with the DEPENDING ON 
option is executed, the MOVE is done 
•on the basis of the current contents 
of the object of the DEPENDING ON 
option. 

3. The location of any nonsubordinate 
items following the item described 
with the OCCURS clause will be 
affected by the new value of 
data-name . If the user wishes to 
preserve the contents of these items, 
the following procedure can be used: 
prior to the change in data-name, move 
all nonsubordinate items following the 
variable item to a work area; after 
the change in data-name, move all the 
items back. 

Note: The value of data-name may change 
because a move is made to it or to the 
group in which it is contained; or the 
value of data-name may change because the 
group in which it is contained is a record 
area that has been changed by execution of 
a READ statement. 

For example, assiime that the Data 
Division of a program contains the 
following coding: 

01 ANYRECORD. 

05 A PICTURE S999 COMPUTATIONAL-3. 
05 TABLEA PICTURE S999 OCCURS 100 

TIMES DEPENDING ON A. 
05 GROUPB. 



V .- 



V.-^' 



Subordinate data items. 
End of record. 



OCCURS Clause 



If indexing is to be used to reference a 
table element and the Format 2 (SEARCH ALL) 
statement is also used, the KEY option must 
be specified in the OCCURS clause. A table 
element is represented by the subject of an 
OCCURS clause, and is equivalent to one 
level of a table. The table element must 
then be ordered upon the key(s) and 
data-name (s) specified. 



GROUPB items are not subordinate to TABLEA, 
which is described by the OCCURS clause. 
Assuming that WORKB is a work area with the 
same data structure as GROUPB, the 
following procedural coding could be used: 

MOVE GROUPB TO WORKB 

Calculate a new value of A 

MOVE WORKB TO GROUPB 



182 



The preceding statements can be avoided 
by placing the OCCURS clause with the 
DEPENDING ON option at the end of the 
record. 



Note: data-name can also change because of 
a change in the value of an item that 
redefines it. In this case, the group size 
and the location of nonsubordinate items as 
described in the two preceding paragraphs 
cannot be determined. 



SEARCH ALL Statement 



( INDEX- 1) is set to a value corresponding 
to the relative position within the table 
of the matching entry. If no match is 
found, the index remains at the setting it 
had when execution of the SEARCH ALL 
statement began. 



Note: It is more efficient to test keys in 
order of significance (i.e., KEY-1 should 
be specified before KEY- 2 in the WHEN 
statement) . The WHEN statement can only 
test for equality, and only one side of the 
equation may be a key. 



L 



The SEARCH ALL Statement is used to 
search an entire table for an item without 
having to write a loop procedure. For 
example, a user-defined table may be the 
following: 

01 



TABLE. 






05 ENTRY- IN- TABLE OCCURS 90 TIMES 


ASCENDING KEY-1, KEY-2 


DESCENDING 


KEY- 3 


INDEXED BY 


INDEX-1. 


10 


PART-1 


PICTURE 9(2). 


10 


KEY-1 


PICTURE 9(5). 


10 


PART- 2 


PICTURE 9(6). 


10 


KEY-2 


PICTURE 9(4). 


10 


PART- 3 


PICTURE 9(33). 


10 


KEY- 3 


PICTURE 9(5). 



A search of the entire table can be 
initiated with the following instruction: 

SEARCH ALL TABLE AT END GO TO NOENTRY 
WHEN KEY-1 = VALUE- 1 AND KEY-2 = VALUE- 2 
AND KEY- 3 = VALUE- 3 MOVE PART-1 
(INDEX-1) TO OUTPUT- AREA 

The preceding instructions will execute 
a search on the given array TABLE, which 
contains 90 elements of 55 bytes and 3 
keys. The primairy and secondary keys 
(KEY-1 and KEY-2) are in ascending order 
whereas the least significant key (KEY- 3) 
is in descending order. If an entry is 
found in which the three keys are equal to 
the given values (i.e., VALUE-1, VALUE- 2, 
VALUE- 3) , PART-1 of that entry will be 
moved to OUTPUT-AREA. If matching keys are 
not found in any of the entries in TABLE, 
the NOENTRY routine is entered. 



SET Statement 



The SET statement is used to assign 
values to index-names and to index data 
items. 

When an index-name is set to the value 
of a literal, identifier, or an index- name 
from another table element, it is set to an 
actual displacement from the beginning of 
the table that corresponds to the 
occurrence number indicated by the second 
operand in the statement. The compiler 
performs the necessary calculations. If an 
index-name is set to another index-name for 
the same table, the compiler need make no 
conversion of the actual displacement value 
contained in the second operand. 

However, when an index data item is set 
to another index data item or to an 
index-name, or when an index-name is set to 
an index data item, the compiler is unable 
to change any displacement value it finds, 
since an index data item is not part of any 
table. Thus, no conversion of values can 
take place. Remember this to avoid making 
programming errors. 

For example, suppose that a table has 
been defined as: 

01 A. 

05 B OCCURS 2 INDEXED BY II, I 5. 

10 C OCCURS 2 INDEXED BY 12, 16. 

15 D OCCURS 3 INDEXED BY 13, 14. 
20 E PIC X(20). 
20 F PIC 9(5). 



If a match is found between a table 
entry and the given values, the index 



The table appears in core storage as 
shown in Figure 56. 



Programming Techniques 183 



B (1) 



B (2) 



C (1, 1) 



C (1, 2) 



'C (2, 1) 



,C (2, 2) 



, D (1, 1, 1) 
<D (1, 1, 2) 
f D (1, 1, 3) 



Byte 
-T n 




1 E 1 F 1 

j. 4 ^ 

1 E 1 F 1 


1 E 1 F 1 
j. 4 ^ 

1 E 1 F 1 
|. 4 ^ 

1 E 1 F 1 
L _ 4 J 


1 E 1 F 1 

i. 4 ^ 

1 E 1 F 1 

L _ _ _ L _J 


1 E 1 F 1 
I 1 J 


r T 1 

1 E 1 F 1 

L L J 


1 E 1 F 1 

L _ 4 _J 


1 E 1 F 1 

L J. 4 


r — — T — 1 
1 E 1 F 1 



25 

50 

75 

100 

125 

150 

175 

200 

225 

250 

275 

-JL J 300 



Figure 56. Table Structure in core Storage 



Suppose that a reference to D (2, 2, 3) 
is necessary. The following method is 
incorrect : 



SET 13 TO 2. 

SET INDX-DATA-ITM TO 13. 

SET 13 UP BY 1. 

SET 12, II TO INDX-DATA-ITM. 

MOVE D (II, 12, 13) TO WORKAREA. 



The value contained in 13 after the first 
SET statement is 25, which represents the 
beginning point of the second occurrence of 
D. When the second SET statement is 
executed, the value 25 is placed in 
INDX-DATA-ITM, and the fourth SET statement 
moves the value 25 into 12, and II. The 
third SET statement increases the value in 
13 to 50 i The calculation for the address 
D (II, 12, 13) would then be as follows: 



(address of D (1, 1, 1) ) + 25 + 25 + 50 
= (address of D (1, 1, 1)) + 100 

This is not the address of D (2, 2, 3). 



The following method will find the 
correct address: 

SET 13 TO 2. 

SET 12, II TO 13. 

SET 13 UP BY 1. 

In this case, the first SET statement 
places the value 25 in 13. Since the 
compiler is able to calculate the lengths 
of B and C, the second SET statement places 
the value 75 in 12, and the value 150 in 
II. The third SET statement places the 
value 50 in 13. The correct address 
calculation will be: 

(address of D (1, 1, 1)) + 150 +75+50 
= (address of D (1, 1, 1)) + 275 

The rules for the SET statement are 
shown in Table 25. 

Use care when setting the value of 
index-names associated with tables 
described as OCCURS DEPENDING ON. If the 
table entry length is changed, the value 
contained within the index-name will become 
invalid unless a new SET statement corrects 
it. 






184 



Table 25. Rules for the SET Statement 

•T 



Receiving 



Sending 



Index-name 



Index data item 



Identifier or Literal 



Index-name 



Set to value 
corresponding to 
occurrence n\amber^ 



Move without 
conversion 



Set to value corre- 
sponding to occurrence 
number 



Index data item 



Move without 
conversion 



Move without 
conversion 



Illegal 



Identifier 



Set to occurrence 
number represented 
by index-name 



Illegal 



Illegal 



j^If index-names refer to the same table element, move without conversion. 

L 



f") 



c 



SEARCH Statement 



Only one level of a table (a table 
element) can be referenced with one SEARCH 
statement. Note that SEARCH statements 
cannot be nested, since an 
imperative- statement must follow the WHEN 
condition, and the SEARCH statement is 
itself conditional. 

To write a series of statements that 
will search the 3-dimensional table defined 
in the discussion of the SET statement, the 
programmer could write: 



77 COMPARANDl PIC X(5). 
77 C0MPARAND2 PIC 9(5). 



01 A. 

02 B OCCURS 2 INDEXED BY II 15. 

03 C OCCURS 2 INDEXED BY 12 16. 

OU D OCCURS 3 INDEXED BY 13 14, 
05 E PIC X(5). 
05 F PIC 9(5). 



(Initialize COMPARANDl and C0MPARAND2) 



PERFORM SEARCH-TESTl THRU SEARCH- EXITl 
VARYING II FROM 1 BY 1 UNTIL 12 IS 
GREATER THAN 2. 
ENTRY-NOENTRYl. 

GO TO ERROR- RECOVERYl. 



y 



SEARCH-TESTl. 
SET 13 TO 1. 

SEARCH D WHEN E (II, 12, 13) = 
COMPARANDl AND F (II, 12, 13) 
C0MPARAND2 
SET 15 TO II 
SET 16 TO 12 
SET 12 TO 3 
SET II TO 3 

ALTER ENTRY-NOENTRYl TO PROCEED 
TO ENTRY-PROCESS INGl. 
SEARCH- EXITl. EXIT. 



ERROR-RECOVERYl . 



ENTRY- PROCESSINGl. 

MOVE E (15, 16, 13) 
MOVE F (15, 16, 13) 



TO OUTAREAl. 
TO 0UTAREA2. 



The PERFORM statement varies the indexes 
(II and 12) associated with table elements 
B and C; the SEARCH statement varies index 
13 associated with table element D. 

The values of II and 12 that satisfy the 
WHEN conditions of the SEARCH statement are 
saved in 15 and 16. II and 12 are then 
both set to 3, so that upon rettirn from the 
SEARCH statement, control will fall through 
the PERFORM statement to the GO TO 
statement. 

Subsequent references to the desired 
occurrence of table elements E and F make 
use of the index-names 15 and 16 in which 
the correct value was saved. 

Format 1 SEARCH statements perform a 
serial search of a table. If it is certain 
that the "found" condition is beyond some 
intermediate point in the table, the 



Programming Techniques 185 



index-names can be set at that point and 
only that part of the table be searched; 
this speeds up execution. If the table is 
large and must be searched from the first 
occurrence to the last, Format 2 (SEARCH 
ALL) is more efficient than Format 1, since 
it uses a binary search technique; however, 
the table must then be ordered. 

In Format 1, the VARYING option allows 
the programmer to: 

• Vary an index-name other than the first 
inaex-name statea for this raoie 
element. Thus, with two SEARCH 
statements, each using a different 
index-ncime, more than one value can be 
referenced in the same table element 
for comparisons, etc. 

• Vary an index-name from another table 
element. In this case, the first 
index-name specified for this table is 
used for the SEARCH, and the index-name 
specified in the VARYING option is 
incremented at the same time. Thus, 
the programmer can search two table 
elements at once. 

In Fommat 1, the WHEN condition can be 
any relation condition and there can be 
more than one. If multiple WHEN conditions 
are stated, the implied logical connective 
is OR — that is, if any one of the WHEN 
conditions is satisfied, the imperative- 
statement following the WHEN condition is 
executed. If all conditions are to be 
satisfied before exiting from the SEARCH, 
the compound WHEN condition with AND as the 
logical connective must be written. 

In Format 2 , the SEARCH ALL statement, 
the table must be ordered on the key(s) 
specified in the OCCURS clause. Any key 
may be specified in the WHEN condition, but 
all preceding data-names in the KEY option 
must also be tested. The test must be an 
"equal to" (=) condition, and the KEY 



data-name must be either the subject or 
object of the condition, or the name of a 
conditional variable with which the tested 
condition-name is associated. The WHEN 
condition can also be a compound condition, 
formed from one of the simple conditions 
listed above, with AND as the only logical 
connective. The KEY data item and the item 
with which it is compared must be 
compatible, as given in the rules of the 
relation test. 

Compilation is faster if keys are tested 
in tne isriAKCn statement m tne same order 
as they appear in the KEY option. 

Note that if KEY entries within the 
table do not contain valid values, then the 
results of the binary search will be 
unpredictable. 



Building Tables 



When reading in data to build an 
internal table: 

1. Check to make sure the data does not 
exceed the space allocated for the 
table. 

2. If the data must be in sequence, check 
the sequence. 

3. If the data contains the subscript 
that determines its position in the 
table, check the subscript for a valid 
range. 

When testing for the end of a table, use 
a named value giving the item count, rather 
than using a literal. Then, if the table 
must be expanded, only one value need be 
changed, instead of all references to a 
literal. 



^y 



186 



APPENDIX A: SAMPLE PROGRAM OUTPUT 



The following is a sample COBOL program 
and the output listing resulting from its 
compilation, linkage editing, and 
execution. The program creates a blocked, 
labeled, standard sequential file, writes 
it out on tape, and then reads it back in« 
It also does a check on the field called 
NO-OF-DEPENDENTS. All data records in the 
file are displayed. Those with a zero in 
the NO-OF-DEPENDENTS field are displayed 
with the special character Z. The records 



of the file are not altered from the time 
of creation, despite the fact that the 
NO-OF-DEPENDENTS field is changed for 
display purposes. The individual records 
of the file are created using the 
subscripting technique. TRACE is used as 
debugging aid during program execution. 

The output fonnats illujptrated in the 
listing are described in the chapter 
"Interpreting Output. " 



// JOB SAMPLE 

// OPTICN NODECK, LINK, LIST, LISTXtSYM, ERRS 

PHASE TEST,* 
// EXEC FCOBOL 

CBL CUqtE 



00.47.1A- 



J 



J 



OOCCl 


000010 


00002 


OC0020 


CCCC2 


0C0030 


00CC4 


000040 


C0CC5 


000050 


00C06 


000060 


00007 


000070 


000C8 


CC0080 


00009 


00CC9C 


00010 


OOOlOC 


00011 


OCCllO 


00012 


000120 


0001.3 


000130 


OOCIA 


0C0140 


00015 


CC0150 


00016 


000160 


00017 


0C017C 


00018 


000180 


0CC19 


000190 


00C20 


C002C0 


00C21 


000210 


00C22 


0C022C 


00023 


000230 


00024 


000240 


00C25 


CC025C 


00026 


000255 


00027 


000260 


0CC28 


CC027C 


00029 


000280 


CCC30 


000290 


00C31 


OC030C 


00022 


000310 


00033 


000320 


00034 


000330 


00035 


CC0340 


00036 


00C350 


00C37 


000360 



IDENTIFICATION DIVISION. 
PROGRAM-ID. TESTRUN. 

AUTHOR. PROGRAMMER NAME. 

INSTALLATION. NEW YORK PROGRAMMING CENTER. 
DATE-WRITTEN. SEPTEMBER 10, 1968. 
DATE-COMPILED. 06/20/69 

REMARKS. THIS PROGRAM HAS BEEN WRITTEN AS A SAMPLE PROGRAM FOR 
COBOL USERS. IT CREATES AN OUTPUT FiLE AND READS IT BACK AS 
INPUT. 

ENVIRONMENT DIVISION. 
CONFIGURATION SECTION. 
SOURCE-COMPUTER. IEM-360-H50. 
OBJECT-COMPUTER. ieM-360-H50. 
INPUT-OUTPUT SECTION. 
FILE-CCNTROL. 

SELECT FlLE-1 ASSIGN TO SYS008-UT-2400-S . 

SELECT FILE-2 ASSIGN TO S YSG 08-UT-2400-S. 

DATA DIVISION. 
FILE SECTION. 
FD FILE-1 

LABEL RECORDS 

BLOCK CONTAINS 

RECORDING MODE 

RECORD CONTAIN 

DATA RECORD IS 
RECORD-1. 

05 FIELD-A PIC 
FlLE-2 

LABEL RECORDS 
BLOCK CONTAINS 
RECORD CONTAINS 
RECORDING MODE 
DATA RECORD IS 
RECORD-2. 
05 FIELD-A PIC 



01 



FD 



ARE STANDARD 

5 RECORDS 

IS F 
S 20 CHARACTERS 

RECORD-1. 

X(20). 

ARE STANDARD 
5 RECORDS 

20 CHARACTERS 
IS F 
RECORD-2. 



01 



X(20). 



Appendix A: Sample Program Output i87 



oocBe 

0003S 
C0C4C 
COOAl 
000A2 
00043 
00044 
00045 
C0C46 
00047 
00C48 
0004C 

0005C 
0CC51 
00052 
00053 

oqo5-4 

0055 
00056 
00057 
C0058 
00C59 
00C60 
00061 
00C62 
00063 
00064 
00065 
00066 
00067 
00068 
00C69 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
C0079 
C008C 



CCC37C 
000380 
CC039C 
000400 
000410 
000420 
0CC43C 
000440 
0CC45C 
CC0460 
000470 
CC0480 
000490 
000500 
0C051C 
000520 
CCC53C 
C00540 
0C055C 
CCC560 
000570 
000580 
000590 
0006CC 
00061C 
OC062C 
0CC63C 
CC064C 
0C0650 
CC066C 
000670 
0C0680 
0C069C 
000700 
CC071C 
000720 
000730 
C0074C 
0C0750 
000760 
000770 
00078C 
CC079C 



WORKING-STCRAGE SECTION. 
01 FILLER. 

02 COUNT PIC S99 COMP SYNC. 

02 ALPHABET FIC X(26J VALUE IS "ABCDEFGHIJKLMNnPQRSTUVWXYZ". 

02 ALPHA REDEFINES ALPHABET PIC X OCCURS 26 Tir^ES. 

02 NUr'BR PIC S99 tOMP SYNC. 

02 DEPENDENTS PIC X{26J VALUE "01234012340123401234012340". 

02 DEPEND REDEFINES DEPENDENTS PiC X OCCURS 26 TIMES. 
CI l\CRK-RECCRD. 

05 NAME-FIELD PIC X. 

05 FILLER PIC X. 

05 RECCRD-NO PIC 9999. 

05 FILLER PIC X VALUE IS SPACE. 

05 LOCATICN PIC AAA VALUE IS "NYC". 

05 FILLER PIC X VALUE IS SPACE. 

05 NO-OF-DEPENDENTS PIC XX. 

05 FILLER PIC X ( 7) VALUE IS SPACES. 



PROCEDURE DIVISICN. 

BEGIN. READY TRACE. 

NOTE THAT THE FOLLOWING OPENS 
AND INITIALIZES COUNTERS. 

STEP-1. OPEN OUTPUT FlLE-1. MOVE 
NOTE THAT THE FOLLOWING CRhAT 
CONTAINED IN THE FILE, WRITES 
THEM ON THE CONSOLE. 

STEP-2. ADC 1 TO COUNTt NUM6R. MO 
NAME-FIELD. 

MOVE DEPEND (COUNT) TO NO-OP- 
MOVE NUMBR TO RECORO-NO. 

STEP-3. DISPLAY WORK-KECORD UPON 
WCRK-RECCRD. 

STEP-4. PERFORM STEP-2 THRU STEP- 
NOTE THAT THE FOLLOWING CLOSE 
IT AS INPUT. 

STEP-5. CLOSE FILE-1. OPEN INPUT 
NOTE THAT THE FOLLOWING READS 
OLT EMPLOYEES WITH NO OtPENDE 

STEP-6. READ FILE-2 RECORD INTO W 

STEP-7. IF NO-OF-DEPENDENTS IS EQ 
NO-OF-DEPENDENTS . EXHIBIT NAM 

STEP-8. CLOSE FILE-2. 
STOP RUN. 



THE OUTPUT FILE TO BE CREATED 

ZERO TO COUNT, NUMBR. 
ES INTERNALLY THE RECORDS TO BE 
THEM ON TAPE, AND DISPLAYS 

VE ALPHA (COUNT) TO 

DEPENDENTS. 

CONSOLE. WRITE RECORD-1 FROM 

3 UNTIL COUNT IS EQUAL TO 26. 
S THE OUTPUT FILE AND REOPENS 

FILE-2. 

BACK THE FILE AND SINGLES 
NTS. 

ORK-RECORD AT END GO TO STEP-8. 
UAL TO "0" MOVE "Z" TO 
ED WORK-RECORD. GO TO STEP-6. 



v.^.. 



188 



INTRNL NAME 

DNM=1-148 

DNW=1-178 

DNM=1-199 

DNM=1-21C 

DNM=l-246 

DNM=l-267 

DNM=l-287 

DNM=l-306 

DNM= 1-321 

DNM=l-339 

DNM=l-357 

DNM= 1-372 

DNM=l-392 

DNM=l-408 

DNM= 1-432 

DNM=l-452 

DNM= 1-471 

DNM=l-490 

DNM=2-00Q 

DNM=2-0ie 

DNM=2-037 

DNM=2-063 



LVL SOURCE NAME 

FD FILE-1 

01 RECORD-1 

02 FIELD-A 
FD FILE-2 
01 RECORD-2 
C2 FIELO-A 

01 FILLER 

02 COUNT 

C2' ALPHABET 

C2 ALPHA 

02 NUMBR 

C2 DEPENDENTS 

02 DEPEND 

01 WORK-RECORD 

02 NAME-FIELD 
02 FILLER 

02 RECORD-NO 

02 FILLER 

02 LOCATION 

02 FILLER 

02 NO-OF-DEPENDENTS 

02 FILLER 



BASE 


DISPL 


INTRNL NAME 


DEFINITION 


USAGE 


R Q M 


DTF=01 




DNM=1-14P 






DTFMT 




F 


BL=1 


000 


DNM=1-178 


DS 


0CL20 


GROUP 






BL = 1 


000 


DNM=1-199 


DS 


20C 


DISP 






DTF=02 




DNM=1-216 






DTFMT 




F 


BL = 2 


OCO 


DNM=l-246 


DS 


0CL20 


GROUP 






BL = 2 


000 


DNM=l-267 


DS 


20C 


DISP 






BL=3 


OCO 


DNM=l-287 


DS 


0CL56 


GROUP 






BL=3 


000 


DNM=l-306 


DS 


IH 


COMP 






BL=3 


002 


DNM= 1-321 


DS 


26C 


DISP 






BL=3 


002 


DNM=l-339 


DS 


IC 


DISP 


R 




BL=3 


OlC 


DNM=l-357 


DS 


IH 


COMP 






BL=3 


OlE 


DNM=l-372 


DS 


26 C 


DISP 






BL = 3 


OlE 


DNM=l-392 


DS 


IC 


DISP 


R 




BL=3 


038 


DNM=l-408 


DS 


0CL20 


GROUP 






BL=3 


038 


DNM=l-432 


DS 


IC 


DISP 






BL = 3 


039 


DNM= 1-452 


DS 


IC 


DISP 






BL=3 


03A 


DNM=1-471 


DS 


4C 


OISP-NM 






BL=3 


03E 


DNM=l-490 


DS 


IC 


DISP 






BL=3 


03F 


DNM= 2-000 


DS 


3C 


DISP 






BL=3 


042 


DNM=2-018 


DS 


IC 


DISP 






BL = 3 


043 


DNM=2-037 


OS 


2C 


DISP 






BL=3 


045 


DNM= 2-063 


OS 


7C 


DISP 







V--/ 



Appendix A: Sample Program Output 189 



MEMORY MAP 

TGT 003F0 

SAVE AREA 003F0 

SWITCH 00438 

TALLY 0043C 

SORT SAVE 00440 

ENTRY-SAVE 00444 

SORT CORE SIZE 00448 

NSTD-REELS 0044C 

SORT RET 0044E 

WORKING CELLS 00450 

SORT FILE SIZE 00580 

SORT MODE SIZE 00584 

PGT-VN TBL 00588 

TGT-VN TBL 0058C 

SORT/iB ADDRESS 00590 

LENGTH OF VN TBL 00594 

LNGTH OF SORTAB 00596 

PGM ID 00598 

A(INITl) 005A0 

UPS! SWITCHES 005A4 

OVERFLOW CELLS 005AC 

EL CELLS 005AC 

OTFACR CELLS 005B8 

TEMP STORAGE 005C0 

TEMP STORAGE-2 005C8 

TEMP STORAGE-3 005C8 

TEMP STORAGE-4 005C8 

ELL CELLS 005C8 

VLC CELLS 005CC 

SBL CELLS 005CC 

INDEX CELLS 005CC 

SUBADR CELLS 005CC 

CNCTL CELLS 005D4 

PF^CTL CELLS 005D4 

PFMSAV CELLS 005D4 

VN CELLS 005D8 

SAVE AREA =2 005DC 

XSASW CELLS 005DC 

XSA CELLS 005DC 

PARAM CELLS 005DC 

RPTSAV AREA 005E0 

CHECKPT CTR 005E0 

lOPTR CELLS 005EO 

LITERAL POOL (HEX) 

00628 (LIT+C) COCOOOOl OOI/S5B5B C2D6D7C5 D5405B5B C2C3D3C6 E2C55B5B 

00640 (LIT+24} C2C6C3D4 E4D3FCE9 COOOOOOO 

DISPLAY LITERALS (BCD) 

"0064C (LTL + 36) 'WORK-RECORD* 

PGT 005E8 

OVERFLOW CELLS 005E8 

VIRTUAL CELLS 0u5E8 

PROCEDURE NAME CELLS 005F4 

GENERATED NAME CELLS 00608 

SUBDTF ADDRESS CELLS 00620 

VNI CELLS 00620 

LITERALS 00628 

DISPLAY LITERALS 0064C 



r^ 



190 



.REGISTER /ASSIGNMENT 



57 



57 
60 



60 



60 
64 



6.4 



REG 6 BL =3 












REG 7 BL =1 












REG 8 BL =2 


000658 












000658 


58 


FO 


C 


004 




00065C 


05 


IF 








O0G65E 


C00140 






000661 


04F5F7404040 




000668 


S6 


40 


D 


048 




00066C 


58 


FO 


C 


004 




000670 


05 


IF 








C0C672 


CC014C 






000675 


04F6F0404040 




00067C 


41 


10 


C 


046 




00068C 


58 


CO 


D 


108 




000684 


18 


40 








000686 


C5 


FC 








000688 


50 


00 


F 


008 




00068C 


45 


00 


F 


OOC 




000690 


CCCCCOOC 




000694 


OA 


02 








000696 


41 


00 





1C8 




00069A 


58 


FO 


C 


008 




O0069E 


05 


EF 








0CC6AC 


58 


10 


D 


1C8 




0006A4 


96 


10 


1 


020 




0006A8 


50 


20 


D 


IBC 




0CC6AC 


58 


7C 


D 


IBC 




0006BO 


02 


01 


6 


000 C 040 




0006B6 


D2 


01 


6 


OIC C 040 




0006BC 












0006BC 


58 


FC 


C 


004 




0006CC 


C5 


IF 








0006C2 


00014C 








0006C5 


C4F6F44C^040 




0006CC 


48 


30 


C 


042 




0006D0 


4A 


3C 


6 


000 




0006D4 


4E 


3C 


D 


IDO 




0C06D8 


07 


05 


D 


IDO D IDO 




0006DE 


94 


OF 


D 


1D6 




OC06E2 


4F 


30 


D 


IDO 




0006E6 


40 


30 


6 


000 




0006EA 


48 


30 


C 


042 




00C6EE 


4A 


30 


6 


OIC 




0006F2 


4E 


30 





IDO 




0CC6F6 


07 


05 





IDO IDO 



START 



PN=01 



EQU 


* 






L 


15,004(0,12) 


V(ILBDDSPO) 




BALR 


1,15 






DC 


X'0C0140' 






DC 


X«04F5F7404040' 






CI 


048(13), X'40' 


SWT + 




L 


15,004(0,12) 


V(ILBDDSPO) 




BALR 


1,15 






DC 


X«000140' 






DC 


X«04F6F0404040' 






LA 


1,046(0,12) 


LIT+6 




L 


0,1C8(0,13) 


DTF=1 




LR 


4,0 






BALR 


15,0- 






ST 


0,008(0,15) 






BAL 


0,000(0,15) 






DC 


X' 00000000' 






SVC 


2 






LA 


0,108(0,13) 


DTF=1 




L 


15,008(0,12) 


V( ILBDIMLO) 




BALR 


14,15 






L 


1,108(0,13) 


DTF=1 




CI 


020(1), X'lO* 






ST 


2,1BC(0,13) 


BL =1 




L 


7,1BC(0,13) 


BL =1 




MVC 


000(2, 6), 040(12) 


DNM=l-306 


LIT+0 


MVC 


01C(2,6) ,040(12) 


DNM=l-357 


LIT+0 


EQU 


* 






L 


15,004(0,12) 


V(ILBDDSPO) 




BALR 


1,15 






DC 


X'0C0140' 






DC 


X'04F6F4404040« 






LH 


3,042(0,12) 


LIT + 2 




AH 


3,000(0,6) 


DNM=l-306 




CVD 


3,100(0,13) 


TS=01 




XC 


100(6,13) ,100(13) 


TS=01 


TS=01 


NI 


106(13), X'OF' 


TS=01+6 




CVB 


3,100(0,13) 


TS=01 




STH 


3,000(0,6) 


DNM=l-306 




LH 


3,042(0,12) 


LIT+2 




AH 


3,01C(0,6) 


DNM=l-357 




CVD 


3,100(0,13) 


TS=01 




XC 


100(6, 13), 1D0(13) 


TS=01 


TS = 01 



Appendix A: Sample Program Output 191 



6A 



66 



67 



68 



68 



68 



70 



70 



C006FC 


94 


OF 


D 


106 


Nl 


106(13), X'OF' 


TS=01+6 




0C0700 


4F 


30 


D 


IDO 


CVB 


3,100(0,13) 


TS=01 




000704 


40 


3C 


6 


OIC 


STH 


3,010(0,6) 


DNM=l-357 




CC0708 


41 


40 


6 


002 


LA 


4,002(0,6) 


DNM=l-339 




C0070C 


48 


2C 


6 


000 


LH 


2,000(0,6) 


DNM=l-306 




CCC710 


4C 


20 


C 


042 


MH 


2,042(0,12) 


LIT+2 




CC0714 


lA 


42 






AR 


4,2 






000716 


5B 


40 


C 


040 


S 


4,040(0,12) 


LIT+0 




0C071A 


50 


4C 





IDC 


ST 


4,1DC(0,13) 


SBS=1 




00071E 


58 


EC 


D 


IDC 


L 


14,1DC(0,13) 


SBS = 1 




000722 


02 


00 


6 


038 E 000 


MVC 


038(1, 6), 000(14) 


DNM=l-432 


0NNl = l-339 


000728 


41 


4C 


6 


OlE 


LA 


4,01E(0,6) 


DNM= 1-392 




00072C 


48 


20 


6 


000 


LH 


2,000(0,6) 


DNM=l-306 




000730 


4C 


20 


C 


042 


MH 


2,042(0,12) 


LIT+2 




000734 


lA 


42 






AR 


4,2 






000736 


56 


40 


C 


040 


S 


4,040(0,12) 


LIT+0 




00073A 


50 


4C 


D 


lEO 


ST 


4,1E0(0,13) 


SBS = 2 




0C073E 


58 


EC 


D 


lEO 


L 


14,1E0(0,13) 


SBS = 2 




000742 


02 


00 


6 


043 E 000 


MVC 


043( 1,6), 000(14) 


DNM=2-37 


DNM=l-392 


CCQ748 


92 


4C 


6 


044 


MVI 


044(6), X«40' 


DNM=2-37+l 




00074C 


48 


3C 


6 


OIC 


LH 


3,C1C(C,6) 


DNM=l-357 




0C0750 


4E 


30 


D 


IDO 


CVD 


3,100(0,13) 


TS = 01 




CCC754 


F3 


31 


6 


03A D ID6 


UNPK 


03A(4,6),1D6(2,13) 


DNM= 1-471 


TS=07 


00075A 


96 


FO 


6 


03D 


01 


03D(6),X<F0' 


DNM=l-471+3 




00075E 


58 


FC 


C 


004 


L 


15,004(0,12) 


V(ILBDDSPO) 




000762 


05 


IF 






BALR 


1,15 






000764 


000140 




DC 


X'O00140' 






000767 


C4F6F84C4040 


DC 


X«04F6F8404040' 






00076E 


58 


FC 


C 


004 


L 


15,004(0,12) 


V(ILBDDSPO) 




000772 


05 


IF 






BALR 


1,15 






000774 


0002 






CC 


X«0002' 






000776 


00 








DC 


X'OO' 






CC0777 


000014 




CC 


X«000014« 






C0C77A 


CDCCC1C4 


DC 


X'0D0001C4> 


BL =3 




00077E 


CC38 






DC 


X«0038' 






CC0780 


FFFF 






DC 


X'FFFF* 






000782 


D2 


13 


7 


00 6 03 8 


MVC 


000(20,7) ,038(6) 


DNM=1-178 


DNM=l-408 


000788 


58 


10 


D 


1C8 


L 


1,108(0,13) 


DTF = 1 




00078C 


le 


41 






LR 


4,1 






00078E 


58 


FO 


1 


010 


L 


15,C1C(0,1) 






000792 


45 


EO 


F 


OOC 


BAL 


14,C0C(0,15) 






C00796 


50 


20 


D 


IBC 


ST 


2,1RC(0,13) 


BL =1 




00079A 


58 


70 


D 


IBC 


L 


7,1BC(0,13) 


BL =1 




00C79E 








GN=( 


Dl EQU 


* 






0CC79E 


58 


10 


D 


1E8 


L 


1,1E8(0,13) 


VN=01 




0007A2 


07 


Fl 






BCR 


15,1 






CCC7A4 








PN=( 


D2 EQU 


* 






0007A4 


58 


FC 


C 


004 


L 


15,004(0,12) 


V( ILBDDSPO) 




CC07A8 


05 


IF 






BALR 


1,15 






CCC7AA 


000140 




DC 


X«000140' 






0007AC 


04F7F04C4040 


DC 


X«04F7F0404040' 






0007B4 


58 


CC 


D 


1E8 


L 


0,1E8(0,13) 


VN=01 




0C07B8 


50 


CC 





1E4 


ST 


0,1E4(0,13) 


PSV=1 




0007BC 


58 


00 


C 


024 


L 


0,024(0,12) 


GN=02 




0CC7CC 


50 


CC 


D 


1E8 


ST 


0,1E8(0,13) 


VN = 01 




0C07C4 








GN=i 


02 ECU 


« 






0C07C4 


48 


3C 


6 


000 


LH 


3,000(0,6) 


DNM=l-306 




0007C8 


49 


30 


C 


044 


CH 


3,044(0,12) 


LIT+4 




0007CC 


58 


FC 


C 


028 


L 


15,028(0,12) 


GN=03 




0007DC 


C7 


8F 






BCR 


8,15 







r 



192 



73 



73 



73 



k..y 



76 



76 



76 
77 



0007D2 


58 


ic c 


GOG 


C0C7D6 


07 


Fl 




0007D8 








0007D8 


58 


00 D 


1E4 


0CC7DC 


50 


CC D 


1E8 


0007E0 


58 


FC C 


004 


0007E4 


05 


IF 




0007E6 


C0014C 




0007E9 


04F7F3404040 


0C07FC 


58 


IC D 


1C8 


0007FA 


94 


EF 1 


020 


0007F8 


18 


CI 




0007FA 


18 


4C 




0007FC 


41 


10 C 


04E 


CCC8CC 


C7 


CC 




CC08C2 


05 


FC 




00080^ 


50 


CC F 


008 


CCC8C8 


45 


CC F 


OOC 


0008CC 


CCCCCOOO 


OC0810 


OA 


02 




occeiz 


58 


CC D 


1C8 


000816 


41 


10 C 


05o 


00081/i 


OA 


02 




00081C 


41 


IC C 


046 


000820 


58 


CC C 


ICC 


0CC824 


18 


4C 




000826 


05 


FC 




000828 


5C 


CC F 


008 


OC082C 


45 


CC F 


OOC 


OC083C 


OCCCCOOO 


00083^ 


CA 


C2 




000836 


41 


CC D 


ICC 


oooesA 


58 


FC C 


008 


CC083E 


05 


EF 




00084C 


58 


10 D 


ICC 


000844 


96 


10 1 


020 


0CC848 








000848 


58 


FC C 


004 


0CC84C 


05 


IF 




ooce4E 


0C014C 




C0C851 


04F7F64C4U40 


occese 


58 


IC D 


ICC 


00085C 


58 


FC C 


02c 


OC0860 


91 


20 1 


010 


000864 


07 


IF 




000866 


18 


41 




000868 


41 


FC C 


02c 


00086C 


D2 


02 1 


025 


000872 


58 


FC 1 


010 


CCC876 


45 


EC F 


008 


00087A 


50 


20 D 


ICO 


00C87E 


58 


80 D 


ICO 


CCC882 


D2 


13 6 


038 


000888 


58 


FO C 


018 


0C088C 


07 


FF 




00088E 








00088E 


58 


IC C 


oic 


C0C8S2 


C7 


Fl 




0CC894 








000894 


58 


FC C 


004 



GN=03 



PN=03 



F 001 



8 000 



GN=04 



PN=04 



L 


l,0CC(O,i2) 


PN=01 




BCR 


15,1 






EGU 


* 






L 


0,1E4(0,13) 


PSV=1 




ST 


0,1E8(0,13) 


VN=01 




L 


15, €04(0,12) 


V( ILBDDSPO) 




BALR 


1,15 






DC 


X'000140' 






DC 


X'04F7F3404040' 






L 


1,108(0,13) 


DTF=1 




NI 


020(1), X'EF* 






LR 


0,1 






LR 


4,0 






LA 


1,04E(0,12) 


LIT+14 




BCR 


0,0 






BALR 


15,0 






ST 


0,008(0,15) 






BAL 


O,00C(O,15) 






DC 


X'OCOOOOOO' 






SVC 


2 






L 


0,108(0,13) 


DTF=1 




LA 


1,056(0,12) 


LIT+22 




SVC 


2 






LA 


1,046(0,12) 


LIT+6 




L 


0,1CC(0,13) 


DTF = 2 




LR 


4,0 






BALR 


15,0 






ST 


0,008(0,15) 






EAL 


O,00C(O,15) 






DC 


X'OOOCOOOO' 






SVC 


2 






LA 


0,1CC(0,13) 


DTF=2 




L 


15,008(0, 12) 


V( ILBDIMLO) 




BALR 


14,15 






L 


1,1CC(0,13) 


DTF = 2 




01 


020(1), X'lO' 






EGU 


* 






L 


15,004(0,12) 


V( ILBDDSPO) 




BALR 


1,15 






DC 


X«0C0140' 






DC 


X'04F7F64C4040' 






L 


1,1CC(0,13) 


DTF=2 




L 


15,02C(0,12) 


GN=04 




TM 


010(1), X'20' 






BCR 


1,15 






LP 


4,1 






LA 


15,02C(0,12) 


GN = 04 




fVC 


025(3,1) ,001(15) 






L 


15,C1C(C,1) 






BAL 


14,008(0,15) 






ST 


2,1C0(0,13) 


BL =2 




L 


8,1C0(0,13) 


BL =2 




MVC 


038(20,6) ,000(8) 


DNM= 1-408 


0NM=l-?46 


L 


15,018(0,12) 


PN = 04 




BCR 


15,15 






ECU 


* 






L 


1,01C(0, 12) 


PN = 05 




BCR 


15,1 






ECU 


* 






L 


15,004(0,12) 


V( ILBDDSPO) 





Appendix A: Sample Program output 193 



77 



77 

78 



78 
79 



79 



80 



0CC898 


05 


IF 






occe9A' 


CCC14C 






0CC89D 


C4F7F74C4040 


0G08A4 


58 


IC 


C 


034 


CCCSA8 


58 


2C 


C 


030 


0008AC 


05 


00 


C 


05E 1 


0008B2 


07 


72 






0C08B4 


95 


4C 


6 


044 


0008B8 


07 


72 






CCC8BA 










0008BA 


C2 


CC 


6 


043 1 


0C08C0 


92 


40 


6 


044 


cccec4 










0008C4 


58 


10 


C 


060 


0CC8C8 


50 


10 


D 


lEC 


0C08CC 


41 


20 





lEC 


0008D0 


58 


FC 


C 


004 


000804 


C5 


IF 






0CC8D6 


8001 






000808 


10 








CCC8D9 


CCCOOE 


! 




0008DC 


CCC00064 


0CC8E0 


0000 






0CC8E2 


00 








0008E3 


000014 




0CC8E6 


0DCOC1C4 


0008EA 


cc3e 






0008EC 


FFFF 






0008EE 


58 


IC 


C 


014 


0008F2 


07 


Fl 






0C08F4 










0008F4 


58 


FC 


C 


004 


0008F8 


05 


IF 






CCC8FA 


0C014G 




00C8FC 


C4F7F94C4040 


0C0904 


58 


10 


D 


ICC 


CC0908 


94 


EF 


1 


020 


00090C 


18 


01 






00090E 


18 


40 






0C0910 


41 


10 


C 


04E 


000914 


07 


CO 






CCC916 


C5 


FC 






000918 


5C 


CC 


F 


008 


00091C 


45 


OC 


F 


OOC 


CCC92C 


CCOCCOOO 


000924 


OA 


02 






000926 


58 


CC 


C 


ICC 


00092A 


41 


IC 


C 


056 


00092E 


0/S 


02 






OOC930 


OA 


CE 






0CC932 


CA 


CE 






0C0934 


50 


DC 


5 


008 


0C0938 


50 


5C 


D 


004 


0C093C 


58 


2C 


C 


000 


OC0940 


95 


00 


2 


000 


0CC944 


C7 


79 






000946 


92 


FF 


2 


000 


00094A 


96 


10 





048 


CCC94E 


50 


EC 


D 


054 


000952 


C5 


FC 







6 043 



C 05F 



GN=C6 



GN = 05 



PN=05 



INIT2 



INIT3 



BAlR 


1»15 






DC 


X>000140' 






DC 


X'04F7F7404040' 






L 


1,034(0,12) 


GN = 06 




L 


2,030(0,12) 


GN=05 




CLC 


C5E(1,12) ,043(6) 


LIT+30 


0NM=2-37 


BCR 


7,2 






CLI 


044(6) ,X'40' 


DNM=2-37+l 




BCR 


7,2 






ECU 


* 






yvc 


043(1,6),05F(12) 


DNM=2-37 


LIT+31 


MVI 


044(6), X'40' 


DNM=2-37+l 




ECU 


* 






L 


1,060(0,12) 


LIT+32 




ST 


1,1EC(0,13) 


PRM=1 




LA 


2,1EC(0,13) 


PRM=1 




L 


15,004(0,12) 


V( ILBDDSPO) 




BALR 


1,15 






DC 


X'8001' 






DC 


X'lC 






CC 


X'bOOOOB' 






DC 


X' CCCC0064' 


LIT+36 




DC 


X'OOOO' 






DC 


X'OO' 






DC 


X"000C14' 






DC 


X'0D0001C4' 


BL =3 




DC 


X«0C38' 






DC 


X'FFFF" 






L 


1,014(0,12) 


PN=03 




BCR 


15,1 






ECU 


* 






L 


15,004(0,12) 


V( ILBDDSPO) 




BALR 


1,15 






CC 


X'000140« 






DC 


X'04F7F9404040' 






L 


1,1CC(0,13) 


DTF=2 




NI 


020(1), X'EF" 






LR 


0,1 






LR 


4,0 






LA 


1,04E(0,12) 


LIT+14 




BCR 


0,0 






B/SLR 


15,0 






ST 


0,008(0,15) 






8/lL 


0,000(0,15) 






DC 


X'OOOOOOOO" 






SVC 


2 






L 


0,1CC(0, 13) 


DTF=2 




LA 


1,056(0,12) 


LIT+22 




SVC 


2 






SVC 


14 






SVC 


14 






ST 


13,008(0,5) 






ST 


5,004(0, 13) 






L 


2,000(0,12) 


VIR=1 




CLI 


000(2), X'OO' 






BCR 


7,9 






MVI 


000(2), X'FF' 






CI 


048( 13) ,X'10' 


SWT+0 




ST 


14,054(0,13) 






BALR 


15,0 







1 



194 



y 



OCO'SSA 


91 


20 


D 048 


0CC958 


47 


EC 


F 016 


CCC95C 


58 


CO 


B 048 


0C0960 


98 


2C 


B 050 


CCC964 


58 


EC 


D 054 


000968 


C7 


FE 




00096A 


96 


20 


C 046 


C0096E 


41 


60 


004 


000972 


41 


10 


C OOC 


000976 


41 


70 


C 040 


0C097A 


C6 


7C 




00097C 


05 


50 




00097E 


58 


4C 


1 000 


CC0982 


IE 


4B 




000984 


50 


4C 


1 000 


000988 


87 


16 


5 000 


00098C 


41 


80 


D IBC 


0CC990 


41 


70 


D ICF 


0C0994 


05 


10 




000996 


58 


CC 


8 000 


CCC99A 


IE 


CB 




000990 


50 


CC 


8 000 


0C09A0 


87 


86 


1 000 


0CC9A4 


D2 


C3 


D 1E8 C 03 


0009AA 


58 


60 


D 1C4 


0009AE 


58 


70 


D IBC 


0009B2 


£8 


ec 


D ICO 


0009E6 


58 


EC 


D 054 


0CC9BA 


07 


FE 




OCOCCO 


C5 


FO 


I 


000CC2 


C7 


00 




CCCC04 


90 


CE 


F OOA 


000008 


47 


FO 


F 082 


COOOOC 








0CCC8A 


58 


CC 


F 0C6 


000088 


58 


EC 


C 000 


0C008C 


58 


CC 


F OCA 


000090 


95 


CC 


E 000 


000C94 


47 


7C 


F 0A2 


OC009S 


96 


IC 


D 048 


00009C 


92 


FF 


E 000 


OOOCAO 


47 


FC 


F GAC 


0000A4 


98 


CE 


F 03A 


0C0CA6 


90 


EC 


C OOC 


OOOCAC 


18 


5D 




OCCCAE 


98 


9F 


F ObA 


0000B2 


91 


IC 


D 048 


CC0CB6 


07 


19 




0C00B8 


07 


FF 




OCOCBA 


07 


00 




OCOCBC 


CCCCC94E 


OOOOCO 


OCCCCOOC 


'CCCCC4 


CCCCCOOO 


0000C8 


CCCCC5E8 


CCOCCC 


CCC0C3F0 


CCOCDC 


CCC0C658 


0000D4 


CCCCC934 


00OCD8 


C3D6C2C6F0F0F0F0 


OOOOEO 


E3C 


5E2E3D9E4D540 



INITl 



TM 


048(13) ,X'20' 


SWT + 


BC 


14,016(0,15) 




L 


0,048(0,11) 




LM 


2,13,050(11) 




L 


14,054(0,13) 




BCR 


15,14 




CI 


048(13), X'20' 


SWT+0 


LA 


6,004(0,0) 




LA 


1,00C(0,12) 


PN=01 


LA 


7,040(0,12) 


LIT + 


ECTR 


7,0 




BALR 


5,0 




L 


4,000(0,1 ) 




ALR 


4,11 




ST 


4,C00(0,1) 




BXLE 


1,6,000(5) 




LA 


8,1BC(0,13) 


0VF = 1 


LA 


7,1CF(0,13) 


TS=01-1 


BALR 


1,0 




L 


0,000(0,8) 




ALR 


0,11 




ST 


0,000(0,8) 




BXLE 


8,6,000(1) 




t'VC 


1E8(4, 13), 038(12) 


VN=01-C 


L 


6,1C4(0,13) 


BL =3 


L 


7,1BC(0,13) 


BL =1 


L 


8,1C0(0,13) 


BL =2 


L 


14,C54(0,13) 


• 


BCR 


15,14 




BALR 


15,0 




BCR 


0,0 




STM 


0,14,00A(15) 




BC 


15,C82(0,15) 




CS 


30F 




L 


12,006(0,15) 




L 


14,000(C,12) 


VIR = 1 


L 


13,0CA(0,15) 




CLI 

BC 


000(14) ,X«00« 
7,0A2(0,15) 






CI 


048(13) ,X'10' 


SWT+0 


MVI 


000(14), X'FF" 




BC 


15,0AC(0,15) 




LM 


12,14,03A(15) 




STM 


14,12,000(13) 




LR 


5,13 




LM 


9,15,CBA(15) 




TM 


048(13) , X'lO' 


SWT + 


ECR 


1.9 




BCR 


15,15 




ECR 


0,0 




ACCCN 


L4(INIT3) 




ADCON 


L4( INITl) 




ADCCN 


L4(INIT1) 




ADCON 


L4(PGT) 




ADCON 


L4(TGT) 




ADCCN 


L4(START) 




ADCON 


L4(INIT2) 




DC 


X'C3D6C2C6F0F0F0F0' 




CC 


X'E3C5E2E3D9E4D540' 





VNT = 1 



r 



\. 



Appendix A: Sample Program Output 195 



CROSS-REFERENCE DICTIONARY 



DATA NAMES 



DEFN 



REFERENCE 



FILE-1 

RECORD-1 

FILE-2 

RECORD-2 

COUNT 

ALPHA 

NUMER 

DEPEND 

WORK-RECORD 

NAN|E-FIELD 

RECORD-NO 

NO-OF-DEPENDENTS 



00017 
00028 
C0018 
00036 
00040 
CC042 
00043 
00045 
0C046 
00047 
00049 
00053 



00060 C0060 00068 0C073 

00068 

00073 00073 00076 00076 



00079 



00076 

00060 00064 00064 00064 00066 00070 

00064 00064 

0006C 00064 C0C64 00067 

00066 00066 

00068 00068 00076 00078 
00064 

00067 00C67 

00066 00066 00077 00077 00077 C0077 



PROCEDURE NAMES 



DEFN 



REFERENCE 



STEP-2 
STEP-6 
STEP-e 



0C064 
00076 
CC079 



0007C 
00078 
00076 



CARD ERROR MESSAGE 



64 
64 



ILA5011I-W 
ILA5C11I-W 



HIGH ORDER TRUNCATION MIGHT OCCUR. 
HIGH ORDER TRUNCATION MIGHT OCCUR. 



ENTRY 
// EXEC LNKEDT 



JOB SAMPLE 06/20/69 I 


ACTION 


TAKEN MAP 


LIST 


PHASE TESTt* 


LIST 


AUTOLINK IJFFBZZN 


LIS^ 


AUTOLINK ILBDDSPC 


LIST 


INCLUDE IJJCPDl 


LIST 


AUTOLINK ILBDIMLO 


LIST 


AUTOLINK ILBDMNSC 


LIST 


AUTOLINK ILBDSAEO 


LIST 


ENTRY 



DISK LINKAGE EDITOR DIAGNOSTIC OF INPUT 



r- 



196 



C6/20/69 PHASE XFR-AD LOCORE HICORE OSK-AD ESD TYPE LABEL LOADED REL-FR 

TEST C0300Q 003000 0C48CB 50 07 2 CSECT TESTRUN 003000 003000 

CSECT IJFFBZZN 0039C0 0C39r.0 

* ENTRY IJFFZZZN 0C39C0 

* ENTRY IJFFBZZZ 0039C0 

* ENTRY IJFFZZZZ 0039CO 

CSECT ILBDSAEO 0047D8 0C47D8 

ENTRY ILBCSAEl 0047F8 

CSECT ILBDMNSO 0C47D0 0047D0 

CSECT ILBDDSPO 003F90 003F90 

* ENTRY ILBDCSPI 0044EO 

* ENTRY ILBDDSP2 0C4578 

* ENTRY ILBDDSP3 004730 

CSECT ILBDIMLO 004768 0C4768 

CSECT IJJCPDl 003DC8 003DC8 

ENTRY IJJCPDIN 003DC8 

* ENTRY IJJCPD3 003DC8 



V._ / 



Appendix A: Sample Program Output 197 



// ASSGN SYS008,X'282" 

// TLBL SYS008,'TAPEFILE' ,69/365, ,0001, 0001 

// EXEC 

60 

68 

70 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

64 

68 

73 

76 

77 

WORK-RECGRD = ACGCQl NYC Z 

76 

77 

WORK-RECORD = eC0002 NYC 1 



198 





76 










\ 


77 










/ 


WOBK-RECCRD 

76 

77 




CC0003 


NYC 


2 




WORK-RECCRD 


= 


DCOOOA 


NYC 


3 




76 












77 












WORK-RECORD 


= 


EC00C5 


NYC 


4 




76 












77 












WORK-RECORD 


= 


FC0006 


NYC 


Z 




76 












77 












WORK-RECORO 


= 


GC00C7 


NYC 


1 




76 












77 












WORK-RECORD 


= 


HC0008 


NYC 


2 




76 












77 












WORK-RECORD 


= 


IC00C9 


NYC 


3 




76 












77 












WORK-RECORD 


= 


JCOOIO 


NYC 


4 




76 












77 












WORK-RECCRD 


= 


KCOOll 


NYC 


Z 




76 












77 












WORK-RECORD 


= 


LC0012 


NYC 


1 




76 












77 












WORK-RECORD 


= 


MC0013 


NYC 


2 


1 


76 












77 












WOKK-RECORD 


= 


NC0014 


NYC 


2 




76 












77 












WORK-RECCRD 


= 


QCOOIS 


NYC 


A 




76 












77 












WORK-RECORD 


= 


PC0016 


NYC 


Z 




76 












77 












WORK-RECCRD 


= 


QC0017 


NYC 


1 




76 












77 












WCRK-RECORD 


= 


RC0018 


NYC 


2 




76 












77 












WORK-RECORD 


= 


SC0019 


NYC 


3 




76 












77 












WORK-RECCRD 


= 


TC0020 


NYC 


A 




76 












77 












WORK-RECORD 


= 


UCC021 


NYC 


Z 




76 












77 












WQPK-PECORD 


= 


VC0022 


NYC 


1 




76 












77 











n 



Appendix A: Sample Program Output 199 



WORK-PECCRC = WC0023 NYC 2 

76 

77 

WCRK-PECORC = XC002^ NYC 3 

76 

77 

WORK-RECGRD = YC0025 NYC 4 

76 

77 

WORK-PECORO = ZC0026 NYC Z 

76 

79 



EOJ S/iMPLE 



OIIOA GIVE IPL CONTROL COMMANDS 
set date = 06/20/59,clock = 00/^0/00 
BG 01 20 1 DOS IPL COMPLETE 
BG IIOOA READY FOR COMMUNICATIONS. 
BG 
BG // JOB SAMPLE 

00.40.13 
BG 

4110A NO VOLl LBL FOUND TLBL= SYS008 SYS008=282 
BG mill 
BG ACOOOl NYC 
BG BC0002 NYC 1 
BG CC0003 NYC 2 
BG DCOOOtf NYC 3 
BG EC0005 NYC h 
BG FC0006 NYC 
BG GC0007 NYC 1 
BG HC0008 NYC 2 
BG IC0009 NYC 3 
BG JCOOIO NYC 4 
BG KCOOll NYC 
BG LC0012 NYC 1 
BG MC0013 NYC 2 
BG NCOOlif NYC 3 
BG OC0015 NYC 4 
BG PC0016 NYC 
BG QC0017 NYC 1 
BG RC0018 NYC 2 
BG SC0019 NYC 3 
BG TC0020 NYC 4 
BG UC0021 NYC 
BG VC0022 NYC 1 
BG WC0023 NYC 2 
BG XC0024 NYC 3 
BG YC0025 NYC ^f 
BG ZC0025 NYC 
BG 000101 69171 

'tl33D ERROR IN HDR LBL SYS008 SYS008 = 282 

BG ignore 
BG EOJ SAMPLE 

00. 45. 07, DURATION 00.04.54 



200 



APPENDIX B: STANDARD TAPE FILE LABELS 



File 
Lobe! 
Field Number 







1 








































































































































Li 


2 


3 
File Idenfiner 


4 
File 
Serial 
Number 


5 
Volume 
Sequence 
Number 


6 
File 

Sequence 
Number 


g 7 

il 
OZ 


6 


9 

Creotion 
Dote 


10 

Expiration 
Dote 


n 


12 

Block 
Count 


13 
Syttem Code 


U 
Reterved 


- 




r> 


•« 


<o 






























M 








CO 




n 


a 






S 


S 








95 


5? 










!^ 


? 




1 ^ 


5 


» 


. 


. 


. 


_ 


3 


Z 


_ 


. 


. 


. 


. 


. 


. 


. 


. 


. 


. 


£ 


s 


- 


. 


. 


_ 


. 


!J 



Label 
Identifier 



Version 


File 


Number of 


Security 


Generation 





The standard tape file label format and contents are as follows: 



Field Name and Length 

1. LABEL IDENTIFIER 
3 bytes, EBCDIC 



2. 
3. 

4. 



5. 

6. 
7. 

8. 



FILE LABEL NUMBER 
1 byte, EBCDIC 

FILE IDENTIFIER 
17 bytes, EBCDIC 



FILE SERIAL NUMBER 
6 bytes, EBCDIC 




FILE SEQUENCE 
4 bytes 

GENERATION TIME 
4 bytes 



VERSION NUMBER OF 
GENERATION 



2 bytes 



Description 

Identifies the type of label. 
HDR = Header (beginning of a data file) 
EOF = End-of-file (end of a set of data) 
EOV = End-of -volume (end of the physical reel) 

Always a 1. 



Uniquely identifies the entire file, may contain 
only printable characters. Some other systems 
will not accept embedded blanks in the file 
identifier. 

Uniquely identifies a file/volume relationship. 

This field is identical to the voliome serial 
, number in the volume label of the first or only 

volume of a multivolume file or a multifile set. 

This field will normally be numeric (000001 to 

999999), but may contain any six alphanumeric 

characters. 

Indicates the order of a volume in a given file or 
multifile set. The first must be numbered 0001, 
and subsequent nximbers must be in proper numeric 
sequence. 

Assigns numeric sequence to a file within a multi- 
file set. The first must be numbered 0001. 

Uniquely identifies the various editions of the 
file. May be from 0001 to 9999 in proper numeric 
sequence. 

Indicates the version of a generation of a file. 






Appendix B: Standard Tape File Labels 201 



Field Name and Length 

9. CREATION DATE 
6 bytes 



10. 



11. 



12. 



13. 

14. 



EXPIRATION DATE 
6 bytes 



FILE SECURITY 



1 byte 



BLOCK COUNT 
6 bytes 



SYSTEM CODE 
13 bytes 

RESERVED 
7 bytes 



Description 

Indicates the year and the day of the year that the 
file was created. 



Position 

1 

2-3 

U-6 



Code 
blank 
00-99 
001-366 



Meaning 

none 

year 

day of year 



(e.g., January 31, 1971 would be entered as 
71031). 

Indicates the year and the day of the year when the 
file may become a scratch tape. The format of 
this field is identical to field 9. On a 
multifile reel processed sequentially, all files 
are considered to expire on the same day. 

Indicates security status of the file. 

= No security protection. 

1 = Seciirity protection. Additional 

identification of the file is required before 
it can be processed. 

Indicates the number of data blocks written in the 
file from the last header label to the first 
trailer label, exclusive of tapemarks. Count 
does not include checkpoint records. This field 
is used in trailer labels. 

Uniquely identifies the operating system. 



Reserved. Should be recorded as blanks. 



202 



APPENDIX C: STANDARD MASS STORAGE DEVICE LABELS 

































































































c 


ea 


tion Date— 


Expi 
Date 


ation 

1 




Spare 
























File Name 




File 

Serial 

Number 














Syjtem Code 


- 


. 


. 


- 














































































? 


!9« 










lo 


sIr 


s 




« 


S? 




o- 


s 




-o 


•o 
















1 






IQ 



Reserved 
For Future 
Use 



Reserved 
For Future — 
Use 



Option Record Key 
Codes Length Location 

t i i 



Space 
Remaining 



fo -"t «n ^ 



..a3 0*o^cMfO'«rio 
00 loo 00 CN Qv ^ ov o« o« 



T 



Record Block Key 
Format Lengtfi Length 



Secondary 
Allocation 



Last Used 
Track & 
Record On 
Thot Track 



Format 
Identifier 



Volume 

Sequence 

Number 



Count 

Of 

Extents 



TG 



Bytes Used 

In lost block 

of directory 



Lower 
Limit 



.Data Set 
Indicators 



Extent Type. 
Indicatoi 



JI 



Upper 
Limit 



Additional Extent 



Additional Extent 



Extent 

Sequence 

Number 



Format 1: This format is common to all data files on disk. 



c 



Field Name and Lencfth - 

1. FILE NAME 

44 bytes, alphanumeric EBCDIC 



Description 

This field serves as the key portion of the file 
label. It can consist of three sections: 

1. File ID is an alphanumeric field assigned by 
the user and identifies the file. It can be 
1 through 35 bytes in length if generation 
and version numbers are used, or 1 through 4U 
bytes in length if they are not used. 

2. Generation Numbe r. If used, this field is 
separated from File ID by a period. It has 
the format Gnnnn, where G identifies the 
field as the generation number and nnnn (in 
decimal) identifies the generation of the 
file. 

3. Version Number of Generation . If used, this 
section immediately follows the generation 
number and has the format Vnn, where V 
identifies the field as the version of 
generation number and nn (in decimal) 
identifies the version of generation of the 
file. 



Note: IBM System/360 Disk Operating System 
compares the entire field against the filename 
given in the DLAB and DLBL cards. The generation 
and version numbers are treated differently by the 
IBM System/360 Operating System. 



Appendix C: Standard Mass Storage Device Labels 203 



Fields 2 through 33 constitute the DATA portion of the file label. 



F ield N ame and Length 

FORMAT IDENTIFIER 



2. 
3. 

U. 
5. 



1 byte, EBCDIC numeric 

FILE SERIAL NUMBER 

6 bytes, alphanumeric EBCDIC 



VOLUME SEQUENCE NUMBER 

2 bytes, binary 

CREATION DATE 

3 bytes, discontinuous binary 



Description 
1 = format 1 



Uniquely identifies a file/vol\ime relationship. It 
is identical to the volume serial number of the 
first or only volume of a multivolume file. 

Indicates the order of a volume relative to the 
first volume on which the data file resides. 

Indicates the year and the day of the year the file 
was created. It is of the form YDD, where Y 
signifies the year (0-99) and DD the day of the 
year (1-366). 



6. EXPIRATION DATE Indicates the year and the day of the year the file 

3 bytes, discontinuous binary may be deleted. The form of this field is 

identical to that of field 5. 



7a. EXTENT COUNT 

1 byte, binary 



Contains a count of the number of extents for this 
file on this volume. If user labels are used, 
the count includes the user label track as a 
separate extent. This field is maintained by the 
Disk Operating System. 



7b. BYTES USED I N LAST BLOCK 
OF DIRECTORY 
1 byte, binary 



Used by IBM System/360 Operating System only for 
partitioned (library structxire) data sets. Not 
used by the Disk Operating System. 



■\ 



7c. 



SPARE 
1 byte 



Reserved for future use. 



8. 



SYSTEM CODE 
13 bytes 



Uniquely identifies the operating system. 



9. 



RESERVED 
7 bytes 



Reserved for futtire use. 



10. 



FILE TYPE 
2 bytes 



The contents of this field uniquely identify the 
type of data file. 



Hex 

Code 

4000 

2000 

8000 

0200 

0000 



Meaning 
Sequential organization 

Direct organization 

Indexed organization 

Library organization 

Organization not defined in the file 
label 



204 



Field Name and Length 

^ 11. RECORD FORMAT 

1 byte 



^-.y 



12. OPTION CODES 
1 byte 



13. BLOCK LENGTH 

2 bytes, binary 



14. RECORD LENGTH 

2 bytes, binary 

15. KEY LENGTH 

1 byte, binary 

16. KEY LOCATION 

2 bytes, binary 



Description 

The contents of this field indicate the type of 
records contained in the file. 



Meaning 
Variable- length records 

Fixed-length records 

Undefined format 

No track overflow 

File is organized using track 
overflow (IBM System/360 
Operating System only) 

Unblocked records 

Blocked records 

No truncated records 

Truncated records in file 

Control character ASA code 

Control character machine code 

Control character not stated 

Records are written without 
keys 

1 Records are written with keys 

Bits within this field are used to indicate various 
options used in building the file. 

Bit 
Position Meaning 

If on, indicates data file was created 
using write validity check. 



Bit 




Position 
and 1 


Content 
01 




10 




11 


2 







1 


3 







1 


4 







1 


5 and 6 


01 




10 




00 


7 






1-7 



Unused. 



Indicates the block length for fixed-length 
records, or maximum block size for variable- 
length blocks. 

Indicates the record length for fixed-length 
records, or the maximum record length for 
variable-length records. 

Indicates the length of the key portion of the data 
records in the file. 

Indicates the high-order position of the data 
record. 



Appendix C: Standard Mass Storage Device Labels 205 



Field Name and Length 

17. DATA SET INDICATORS 
1 byte 



Description 

Bits within this field are used to indicate the 
following: 



Bit 
Position 



Meaning 
If on, indicates that this is the last 
voliame on which this file normally 
resides. This bit is used by the 
Disk Operating System DTFSR routine 
only. None of the other bits in 
this byte are used by the Disk 
Operating System. 

If on, indicates that the data set 
described by this file must remain 
in the same absolute location on the 
direct-access device. 

If on, indicates that block length 
must always be a multiple of eight 
bytes. 

If on, indicates that this data file 
is security protected; a password 
must be provided in order to access 
it. 



4-7 



Space. 



Reserved for future use. 



18. SECONDARY ALLOCATION 
4 bytes, binary 



19. LAST USED TRACK AND 
RECORD ON THAT TRACK 
5 bytes, discontinuous binary 



20. A MOUNT OF SPACE REMAINING ON 
LAST TRACK USED 



2 bytes, binary 



Indicates the amount of storage to be requested for 
this data file at end-of -extent. This field is 
used by the IBM System/360 Operating System only. 
It is not used by the Disk Operating System 
routines. 

Indicates the last occupied track in a consecutive 
file organization data file. This field has the 
format CCHHR. It is all binary zeros if the last 
track in a consecutive data file is not on this 
volume, or if it is not consecutive organization, 

A coiint of the number of bytes of available space 
remaining on the last track used by this data 
file on this voliome. 



21. E XTENT TYPE INDICATOR 
1 byte 



Indicates the type of extent with which the 
following fields are associated: 



Hex 

Code 

00 



01 

02 
04 

40 
80 



Meaning 

Next three fields do not indicate any 
extent. 

Prime area (indexed) or consecutive 
area, etc., (i.e., the extent 
containing the user's data records). 

Overflow area of an indexed file. 

Cylinder index or master index area of 
an indexed file. 

User label track area. 

Shared cylinder indicator. 



206 



Field Name and Length 



22. EXTENT SEQUENCE NUMBER 
1 byte, binary 



Description 



Indicates the extent sequence in a multi- extent' 
file. 



23. LOWER LIMIT 

U bytes, discontinuous binary 



The cylinder and the track address specifying the 
starting point (lower limit) of this extent 
component. This field has the format CCHH. 



24. UPPER LIMIT 
4 bytes 



The cylinder and the track address specifying the 
end point (upper limit) of this extent component. 
This field has the format CCHH. 



25-28. ADDITIONAL EXTENT 
10 bytes 



These fields have the same format as the fields 
21 through 24, above. 



29-32. ADDITIONAL EXTENT 
10 bytes 



These fields have the same format as fields 21 
through 24, above. 



33. POINTER TO NEXT FILE LABEL 
WITHIN THIS LABEL SET 
5 bytes, discontinuous binary 



( 



The disk address (format CCHHR) of a continuation 
label is needed to further describe the file. If 
field 9 indicates indexed organization, this 
field will point tp a Format 2 file label within 
this label set. Otherwise, it points to a Format 
3 file label, and then only if the file contains 
more than three extent segments. If no 
additional file label is pointed to, this field 
contains all binary zeros. 



/"■^^ 



Appendix C: Standard Mass Storage Device Labels 207 



APPENDIX D: TRACK FORMATS FOR THE 2311, 231U, AND 2321 DIRECT-ACCESS STORAGE DEVICES 



The track format for the 2311, 2314, and 
2321 direct-access storage devices is 
illustrated in Fig\ire 57. The names of the 
fields are given in the following 
discussion. 



Index Marker: 



All tracks start with an 
It is a signal to the 



index marker. 

hardware that indicates beginning of the 

track. 



Home Address : The home address, preceded 
by a gap, follows the index marker. The 
home address uniquely identifies each track 
by specifying the cylinder and head number. 



Track Descriptor Record (Record 0) : Record 
consists of two parts: a count portion 
and a data portion. The count portion is 
the same as it is for any other record (see 
the following description of coiint for 
record 1. The 8-byte data portion is used 
to record information used by LIOCS. The 
information in the data portion depends on 
the data organization (direct or indexed) 
that is being used. 



For direct orgcinization, this portion in 
the, form of CCHHR contains the address of 
the last record on the track and the niimber 
of bytes remaining on the track. This 
information is used to determine whether 
there is space for another record on the 
track. For indexed organization, the data 
portion contains the address of the last 
record in the cylinder overflow area and 
the number of tracks remaining in the 
cylinder overflow area. Record is then 
used as the cylinder overflow control 
record. 



count, key, and data portion for direct and 
indexed organizations. 



1. Count Portion. The count portion 
contains the identification of each 
record, the key length, and the data 
length. 



a. Identification. Each record is 
identified with its cylinder 
number, head n\imber, or record 
number. The cylinder and head 
numbers will be the same as those 
of the home address. The record 
number will indicate a particular 
record on the track. That is, the 
first record after record will 
be record 1, followed by record 2, 
etc. This 5-byte binary field in 
the form of CCHHR is often 
referred to as the record ID. 



b. Key Length. The key length is 
specified in an 8-bit byte; its 
length can range from to 255. 
This field will contain a zero if 
there is no key. 



Data Length. The data length is 
specified in the 16 bits of the 
next two bytes- 



Note : It is the count portion 
that identifies the presence or 
absence of a key, in addition to 
indicating the data length. In 
this way, each record is unique 
and self formatting. 



Address Marker : All records after record 
will be preceded by a 2-byte address 
marker. The address marker is a signal to 
the hardware that a record is starting. 



2. Key Portion. The key portion of the 
record is normally used to store the 
control field of the data record such 
as a man niamber. Direct and indexed 
files must have a key portion. 



Data Records : Data records (see Rl in 
Figure 49) can consist of a count and data 
portion for sequential organization, or a 



3. Data Portion. The data portion of the 
record contains the data record. 



Appendix D: Track Formats for the 2311, 2314, and 2321 Direct-Access Storage Devices 209 



Note that all records, including the 
data record, terminate with a 2-byte cyclic 
check. The hardware uses this cyclic check 
to ensure that is correctly reread what it 
had written. The cyclic check is 
cumulative and is appended to each record 
when it is written. Upon reading the 
record, the cyclic check is again 
accumulated and then compared with the 
appended cyclic check. If they do not 
agree, a data check is initiated. 

The first byte of the count portion of 
each record and the home address is 
reserved for a flag byte. If a track 



becomes defective, a utility program may be 
\ised to transfer the data to an alternate 
track. (Cylinders 200 through 202 are 
reserved for alternate tracks on the 2321. 
Strips 6 through 9 of subcell 19 of each 
cell are reserved for alternate tracks on 
the 2321.) In this case, a flag bit within 
the byte is set on to indicate that this is 
a defective track and the address of an 
alternate track will be placed in the 
record ID of record 0. Subsequent 
references to this defective track will 
result in the Supervisor accessing record 
for the address of the alternate track. 



RO 



RO 



Count 



Index Home 

Marker Address 



G=Gap 



F I C iC I H I H |C |C I 




Cylinder 
Number 



Cyclic 
Check 



Bits iOiO lO |0 I OiOi I 



Good 

1 Defec 



Track^ | 

tive J 



Original ^ 

1 Alternate j 



Data 



Track 

Descriptor 

Record 



R1 - Count G R1 - Key G R1 - Doto | g | A | G | R2 V^ 



Address 
Marker 



First Data 
Record 



|F,C|C,H,H,R,Kl,Dl,DliC,C, 




Head 
•lumber 



Key 
Length 



Cyclic 
Check 



C.C 



Cylinder Record Data 

Number Number Length 




G 

Data 

(7) Variable 
Length 



W G 

|F|C|C|HiH|R|KL|DL|DL|C|C| A |C|C , H|H,R .BR|BR| |C|C| 



Flag Record Key Data Cyclic 
ID Length Length Check 



T 



Bytes Remaining 
After "Initialize Disk" 



W„> 



Figure 57. Track Format 



210 



o 



APPENDIX E: COBOL LIBRARY SUBROUTINES 



COBOL library subroutines perform 
operations requiring extensive coding. For 
this reason it would be inefficient to 
place the coding in the object module each 
time it is needed. Most COBOL library 
subroutines are stored in the relocatable 
library. When required, they are combined 
at link- edit time with the object module 
produced by the compiler. 



CLOSE WITH LOCK Subroutine 



The ILBDCLKO subroutine is given control 
to issue an object-time message when an 
OPEN statement is used to open a file 
previously closed WITH LOCK. 



[ 



There are several major categories of 
COBOL librairy subroutines: 

• Input/output verb routines 

• Conversion routines 

• Arithmetic verb routines 

• Sort Feature interface routines 

• Checkpoint (RERUN) routines 

• Segmentation Feature routines 

• Other verb routines 



INPUT/OUTPUT SUBROUTINES 



The input/ out put subroutines are used 
for the COBOL verbs DISPLAY (TRACE and 
EXHIBIT), ACCEPT, STOP (literal), READ, 
WRITE, and REWRITE, printer spacing, 
printer overflow, input/output errors, disk 
formatting and extent handling, and tape 
and sequential disk labels. 



WRITE Statement S\ibroutines 



The ILBDVBLO subroutine is used to write 
variable-length blocked records. 

The ILBDDIOO subroutine is used for 
writing files with direct organization 
(DTFDA) . 

The ILBDISMO subroutine is used for 
writing files with indexed organization. 



READ Statement Subroutines 



The ILBDDSRO subroutine is used to read 
sequentially the records of a directly 
organized file. 

The ILBDDIOO subroutine is used to read 
randomly the records of a directly 
organized file. 

The ILBDISMO subroutine is used to read 
an indexed file. 



Printer Spacing 



REWRITE Statement Subroutines 



The ILBDSPAO subroutine is used to 
control printer spacing when the WRITE 
statement with the BEFORE/ AFTER ADVANCING 
or POSITIONING option is specified in the 
source program. 



The ILBDDIOO subroutine is used to 
update records on a directly organized 
file. 

The ILBDISMO subroutine is used to 
update an indexed file. 



/^ >, 



Tape and Sequential Disk Labels 



The ILBDUSLO and ILBDNSLO subroutines 
are used when user or nonstandard labels, 
respectively, are to be processed (LABEL 
RECORDS ARE data-name) . 



DISPLAY (EXHIBIT and TRACE) Subroutines 



The ILBDDSPO s\ibroutine formats one or 
more operands into printed lines, 
performing conversions as needed. 



Appendix E: COBOL Library Subroutines 211 



The ILBDOSYO and ILBDASYO subroutines 
open SYSLST and/or SYSPCH and/or SYSIPT if 
there are DISPLAY or ACCEPT statements in a 
label declarative. 



ACCE P T and STOP (literal) Statement 
Subroutines 



The ILBDACPO subroutine is used to 
handle ACCEPT statements for both SYSIPT 
and the console, as well as the STOP 
(literal) statement. The ILBDACPO 
subroutine does not format or convert 
operands. For operands greater than 80 
characters in length, any remainder in 
excess of the nearest multiple of 80 is 
ignored when accepting data from SYSIPT. 



CLOSE Subroutine 



The ILBDCRDO subroutine is given control 
when a CLOSE UNIT statement is issued for a 
sequential input file with direct 
organization. 



Multiple File Tape Subroutine 



The ILBDMFTO subroutine is given control 
when a reel contains more than one file and 
there are no standard labels. 



Input/Output Error Subroutines 



The ILBDSAEO subroutine is used for 
processing input/output errors that occur 
on tape and sequential disk. 

The ILBDDAEO subroutine is used for 
processing input/output errors that occur 
on directly organizejd files. 

The ILBDISEO subroutine is called 
whenever an input/output error occurs 
during the processing an indexed file. 

The ILBDABXO subroutine is used to issue 
a STXIT macro instruction causing control 
to be passed to it if there is an error on 
a unit-record device. 



Disk Extent Subroutines 



The ILBDFMTO subroutine writes record ( 
(RO) on each track of each extent of a 
directly organized file opened as output, 
and writes an ^nd-of-file (EOF) record as 
the last record in the file. This 
subroutine is called after the file has 
been opened. 

The ILBDXTNO subroutine stores for 
subsequent use the extent information for 
directly organized files. 



Auxiliary Subroutines 



Certain input/output subroutines use 
auxiliary subroutines as follows: 



Auxiliary 

Routine 

ILBDMOVO 



ILBDIDAO 



Used By 

ILBDSPAO, ILBDNSLO, 
ILBDVBLO 

ILBDFMTO, ILBDDSRO 



CONVERSION SUBROUTINES 

Eight niameri.c data formats are permitted 
in COBOL: five external (for input and 
output) and three internal (for internal 
processing) • 

The five external formats are: 

• External or zoned decimal 

• External floating-point 

• Sterling display 

• Niameric edited 

• Sterling report 

The three internal formats are: 

• Internal or packed decimal 

• Binary 

• Internal floating-point, 

The conversions from internal decimal to 
external decimal, from external decimal to 
internal decimal, and from internal decimal 
to numeric edited are performed in-line. 
The other conversions are . performed by the 
COBOL library siibroutines shown in Table 
26. 



C 



v.. 



212 



Table 26. Functions of COBOL Library Conversion Subroutines 

I T 

Conversion 

T 



Subroutine Name 
and Entry Points 



h 



From 



To 



ILBDEFL2 
ILBDEFLl 
ILBDEFLO 



External floating-point 
External floating-point 
External floating-point 



Internal decimal 

Binary 

Internal floating-point 



H- 



ILBDBIDO^ 
ILBDBIDl^ 
ILBDBID2i 



Binary 



Internal decimal 



ILBDBIEO^ 
ILBDBIEl^ 
ILBDBIE2i 



Binary 



External decimal 



1-- 



ILBDBII02 
ILBDBII12 



Binary 



Internal floating-point 



ILBDTEF02 
ILBDTEF12 
ILBDTEF2 
IFBDTEF3 



Binary 

Internal decimal 
Internal floating-point 



External floating-point 

External floating-point 
External floating-point 



h" 



ILBDIDBO 
ILBDIDBl 



Internal decimal 
External decimal 



Binary 
Binary 



ILBDDCIl 
ILBDDCIO 



Internal decimal 
External decimal 



Internal floating-point 
Inteimal floating-point 



H- 



ILBDIFDO 
ILBDIFDl 



Internal floating-point 
Internal floating-point 



Internal decimal 
External decimal 



i~- 



ILBDIFBl 

ILBDIFB23 
ILBDIFB03 



Internal floating-point 



Internal floating-point 



Binary integer and a power 
of 10 exponent 



Binary 



ILBDIDRO 



Internal decimal 



Sterling report 



ILBDIDTO 



Internal decimal 



Sterling non-report 



h- 



ILBDSTIO 



Sterling non-report 



Internal decimal 



^The entry points used depend on whether the double-precision number is in registers 

and 1, 2 and 3, or 4 and 5, respectively. 
^The entry points are for single-precision binary and doiable-precision binary, 

respectively. 
3This entry point is used for calls from other COBOL library siibroutines. 



Appendix E: COBOL Library Sxibroutines 213 



ARITHMETIC VERB SUBROUTINES 



SEGMENTATION FEATURE SUBROUTINE 



r 



Most arithmetic operations are performed 
in-line. However, involved calculations 
with very large niambers, such as decimal 
multiplication of two 30-digit n\imbers, are 
performed by COBOL library arithmetic 
subroutines. These subroutine names and 
their functions are shown in Table 27. 



The Segmentation Feature requires an 
object time sxibroutine, ILBDSEMO. The 
ILBDSEMO subroutine performs the following 
fianctions when segments are needed: 



1. Loads and initializes independent 
segments not in core. 



\, 



SORT FEATURE INTERFACE ROUTINE 



Communication between the Sort/Merge 
program and the COBOL program is maintained 
by ILBDSRTO. 



2. Loads overlayable segments not in 
core. 

3. Initializes independent segments if 
the segment is in core. 

U. Branches to desired entry points if 
the segment is in the root segment. 



CHECKPOINT (RERUN) SUBROUTINE 



OTHER VERB ROUTINES 



The ILBDCKPO subroutine issues the 
checkpoint macro instruction, which will 
write checkpoint records on a 
user- specified tape or disk checkpoint 
device. There are two calling sequences to 
this subroutine. The first, ILBDCKPl, is 
activated during initialization when the 
addresses of all files in the program are 
entered in a table. The second, ILBDCKP2, 
is required to take checkpoints diiring a 
sorting operation. 

If RERUN is requested during a sorting 
operation, ILBDSRTO must gather a list of 
physical IOCS files in use by the Sort 
program every time Sort exits at Ell, E21, 
and E31. ILBDSRTO then calls the 
checkpoint subroutine which will take a 
checkpoint of all active files. 



There are also COBOL library siibroutines 
for comparisons, the verbs MOVE and 
TRANSFORM, and Other features of the COBOL 
language. 



Compare Subroutines 



The ILBDVCOO subroutine compares two 
operands, one or both of which is variable 
in length. Each may exceed 256 bytes. 

The ILBDIVLO subroutine is used in 
comparisons involving the figurative 
constant ALL ' literal' , where literal is 
greater than one character. 



Table 27. Functions of COBOL Library Arithmetic Subroutines 

Function 



r T- 

[ Subroutine Name] 



\- 



ILBDXMUO 



\- 



i Internal decimal multiplication (30 digits * 30 digits = 60 digits) 



ILBDXDIO 



h- 



I Internal decimal division (60 digits/30 digits =30 digits) 



ILBDXPRO 



\- 



Decimal fixed-point exponentiation 



ILBDFPWO 



I 

I ILBDGPWO^ 



j Floating-point exponentiation 



Floating-point exponentiation 



|. ± 

I ^The ILBDGPWO entry point is used if the exponent has a PICTURE clause specifying an 
I integer. The ILBDFPWO entry point is used in all other cases. 

L , 



21U 






MOVE Siibroutines 



The ILBDVMOO siibroutine is used when one 
or both operands is variable in length. 
Each may exceed 256 bytes. The siabroutine 
has two entry points, depending on the type 
of MOVE: ILBDVMOO (left- justified) and 
ILBDVMOl (right- justified) . 

The ILBDMVLO stibroutine is used to move 
the figurative constant ALL 'literal'," 
where literal is greater than one 
character. 



items and those fixed-length items longer 
than 256 bytes. 



Note: The following tables are placed in 
the library for use by the in-line coding 
generated by the compiler and the 
STobroutines called for by both the class 
test and TRANSFORM: 



ILBDATBO — Alphabetic class test 
ILBDETBO — External decimal class test 
ILBDITBO — Internal decimal class test 



The ILBDANEO sxibroutine is used to 
perform a right-or left- justified 
alphanumeric edited move. 



SEARCH Subroutine 



TRANSFORM Subroutine 



The ILBDVTRO stibroutine transforms 
variable-length items. 



The ILBDSCHO subroutine processes each 
search argument key according to type. 



Class Test Subroutine 



Main Program or S\3bproqram S\ibroutine 



v_- 



The ILBDCLSO subroutine is used to 
perform class tests for variable-length 



The ILBDMSNO subroutine is a 1-byte 
switch tested in the code generated for 
EXIT PROGRAM, GOBACK, INITl, and INIT2. 



r \ 



Appendix E: COBOL Library Subroutines 215 



V . 



J\ 



^/ 



APPENDIX F: DIAGNOSTIC MESSAGES 



This appendix describes diagnostic 
messages generated by the compiler and by 
compiler- generated object code. 



COMPILER DIAGNOSTIC MESSAGES 



Using one of the messages as an example, 
COBOL compiler messages are in the 
following format: 



105 ILA1002I-W 



4c*** :1c SECTION HEADER 
MISSING. ASSUMED PRESENT. 



The code 105 is the compiler-generated 
card niimber of the statement where the 
error has occiirred. ILA identifies this as 
a Disk Operating System American National 
Standard COBOL compiler message; 1002 is 
the identifying nximber of the message. The 
symbol I indicates that this is a message 
to the programmer for his action. W is a 
level of severity in the error code with an 
explanation as follows: 

W Warning — Indicates that an error was 
made in the soiirce program. However, 
it is not serious enough to hinder the 
execution of the program. 

C Conditional — Indicates that an error 
was made but the compiler usually 
makes a corrective assumption. The 
statement containing the error is 
retained. Execution can be attempted 
for the debugging value. 

E Error — Indicates that a serious 

error was made. Usually the compiler 
makes no corrective assumption. The 
statement containing the error is 
dropped. Execution of the program 
should not be attempted. 

D Disaster — Indicates that a serious 
error was made. Compilation is not 
completed. Results are \inpr edict able. 

The message text usually describes the 
error and describes the action taken by the 
compiler as a result of the error. Most of 
the messages are self-explanatory, except 
in two situations: 

1. When no compiler action is given. 
These messages are numbered in the 
3000 series. They appear in 
combination with other messages that 
do have the compiler action described. 



2. When messages describe errors that 
require an explanation too long to 
include in a message. These 
explanations appear in text under the 
messages. 

Words in a message that must vary 
according to the program being compiled are 
denoted by five asterisks (**♦♦*) in the 
messages printed below. Three asterisks 
(♦**) appearing in messages on a listing 
indicate that the compiler has encountered 
\:inrecognizable information. 

ILAOOOII-D NO MORE TABLE SPACE AVAILABLE. 
COMPILATION ABANDONED. 

Explanation : Because of the 
size or complexity of the 
source program, all of the 
space available for internal 
tables was exhausted. 

User Response ; Allocate more 
core storage for the compiler 
or make the program smaller or 
less complex. 

ILA0002I-D BASIS LIBRARY NOT FOUND. 
COMPILATION ABANDONED. 

Explanatio n: The source 
statement book specified in a 
BASIS card at the beginning of 
compilation was not found. 

User Response ; correct the 
BASIS card or make the source 
code available in the library. 

ILA0003I-D A TABLE HAS EXCEEDED MAXIMUM 
SIZE. COMPILATION ABANDONED. 

Explanation ; An attempt has 
been made to add information to 
a table that has been made 
static. The problem should 
never occur. 

User Response ; Refer the 
problem to a Customer Engineer. 

ILA0004I- LINK OPTION RESET - D OR E 
LEVEL ERROR FOUND. 

Explanation : The LINK option 
(set by a // OPTION LINK job 
control statement) was reset if 
it had been set previously. 
This prevents the execution of 
a partially compiled program or 
a program with serious errors 



Appendix F: Diagnostic Messages 217 



ILA0005I-D 



in it. If a // EXEC LNKEDT 
card is read later, the job 
control diagnostic - 1S13D 
STATEMENT OUT OF SEQUENCE - is 
logged. The operator usually 
cancels the job at this point. 

LOGIC OR MACHINE ERROR IN 
TAMER. COMPILATION ABANDONED, 

Explanation : A program logic 
error was detected in the 
FCOBOL table management 
routines. 

User Response ; The problem 
should be referred to a 
Customer Engineer. 



Note: Messages numbered ILAOOOII, 
ILA0003I, and ILA0005I may be printed at 
any time during compilation and may be 
followed by a dump. Message ILA0002I is 
printed at the beginning of compilation. 
Message ILAOOOUI follows the last message 
issued. 



The following messages are grouped in 
the compiler output listing. 

ILAIOOII-C NUMERIC LITERAL NOT RECOGNIZED 
AS LEVEL NUMBER BECAUSE •♦****• 
ILLEGAL AS USED. SKIPPING TO 
NEXT LEVEL, SECTION OR 
■ DIVISION. 

ILA1002I-W ***** SECTION HEADER MISSING. 
ASSUMED PRESENT. 

ILA1003I-W ***** PARAGRAPH NAME MISSING. 
ASSUMED PRESENT. 

ILA1004I-E INVALID WORD *****. SKIPPING 
TO NEXT RECOGNIZABLE WORD. 

ILA1005I-E INVALID ORDER IN ENVIRONMENT 
DIVISION. SKIPPING TO NEXT 
DIVISION. 

ILA1006I-E DECLARATIVES SECTION WITHOUT 
USE SENTENCE. SECTION CAN 
NEVER BE EXECUTED. 

ILA1007I-W ***** NOT PRECEDED BY A SPACE. 
ASSUMED SPACE. 

ILA1008I-W RIGHT PAREN SHOULD NOT BE 
PRECEDED BY SPACE. 

ILA1009I-E COPY MUST BE PRECEDED BY 
PROCEDURE- NAME. IGNORED. 

ILAIOIOI-W LEFT PAREN SHOULD NOT BE 
FOLLOWED BY SPACE. 

ILAIOIII-C RECORDING MODE SPECIFICATION IS 
INVALID. ASSUMED VARIABLE. 



ILA1012I-E FILE-NAME NOT UNIQUE. USING 
FIRST DEFINITION. 



ILA1013I-E CHARACTER LENGTH IN 

SPECIAL-NAMES MUST BE ONE. 



ILAlOim-W 
ILA1015I-E 
ILA1016I-E 
ILA1017I-E 
ILA1018I-E 
ILA1019I-E 
ILA1020I-E 
ILA10 21I-E 

ILA1022I-W 
ILA1023I-E 
ILA102UI-E 
ILA1025I-C 

ILA1026I-W 

ILA1027I-E 
ILA1028I-E 

ILA1029I-E 

ILA1030I-E 
ILA1031I-C 

ILA1032I-E 



•FILE' NOT PRESENT IN MULTIPLE 
FILE CLAUSE. ASSUMED PRESENT. 

***** INVALID AS EXTERNAL-NAME. 
IGNORED. 

MORE THAN ONE ***** CLAUSE. 
SKIPPING TO NEXT CLAUSE. 

:|c*4c** INVALID IN ***** CLAUSE. 
SKIPPING TO NEXT CLAUSE. 

COPY CLAUSE INVALID IN A COPY 
LIBRARY. IGNORED. 



NO LIBRARY NAME. 
IGNORED. 



COPY CLAUSE 



*^^,** MUST BE PROCEDURE-NAME 
FOLLOWING DEBUG. *****. 

***** DOES NOT BELONG ON A 
DEBUG CARD. SKIPPING TO NEXT 
CARD. 

PERIOD DOES NOT BELONG ON DEBUG 
CARD. DELETED. 

INVALID FILE-NAME. USE 
IGNORED. 

UNDEFINED FILE-NAME. USE 
IGNORED. 

REDEFINES CLAUSE NOT FIRST 
CLAUSE FOLLOWING DATA-NAME. 
ASSUMED FIRST. 

FOUND ***** EXPECTING 
ENVIRONMENT. ALL ENV. DIV. 
STATEMENTS IGNORED. 

DUPLICATE FD. IGNORED. 

***** SENTENCE IMPROPERLY 
WRITTEN. SENTENCE IGNORED. 

***** IN ***** SENTENCE NOT 
DEFINED AS FILE-NAME. SENTENCE 
IGNORED. 

***** IN *****v SENTENCE IS 
INVALID. WORD IGNORED. 

USE SENTENCE NOT PRECEDED BY 
SECTION-NAME. SECTION-NAME 
ASSUMED. 

***** INCORRECTLY USED IN USE 
SENTENCE. SENTENCE IGNORED. 



218 



V, 



y 



ILA1033I-W ***** FILE-NAME ALREADY 

ASSIGNED THIS SAME CLAUSE 
OPTION. USING FIRST ONE. 



ILA1034I-E ***** CLAUSE ILLEGAL IN ***** 
LEVEL. SKIPPING TO NEXT VALID 
CLAUSE. 

ILA1035I-E INTEGER NOT PRESENT IN MULTIPLE 
FILE CLAUSE, 

ILA1036I-C QUALIFIED NAME INVALID AFTER 
LEVEL NUMBER. USING LOWEST 
NAME. 

ILA1037I-E ***** INVALID IN DATA 

DESCRIPTION. SKIPPING TO NEXT 
CLAUSE. 

ILA1038I-E ***** INVALID AFTER LEVEL 
NUMBER. SKIPPING TO NEXT 
LEVEL. 

ILA1039I-W DATA-NAME IN **--* CLAUSE NEED 
NOT BE QUALIFIED. USING LOWEST 
NAME. 

ILAIOUOI-E IMPROPER LEVEL NUMBER FOR FILE 
SECTION. 

ILA1041I-E ***** INVALID AS USED IN ***** 
SECTION. SKIPPING TO NEXT 
LEVEL, SECTION OR DIVISION. 

ILA1042I-E ASSIGN CLAUSE MISSING IN 
SELECT. CONTINUING. 

ILA1043I-W END OF SENTENCE SHOULD PRECEDE 
*****. ASSUMED PRESENT. 

ILAIOUUI-E INVALID OR MISSING USING AND/OR 
GIVING CLAUSE IN SORT 
STATEMENT. PROGRAM CANNOT BE 
EXECUTED. 

ILA10U5I-E INVALID ORDER IN ***** SECTION. 

ILA10U6I-E MEMBER NOT FOUND IN LIBRARY. 
IGNORING COPY. 

ILA10U7I-E SYNTAX OF COMMENT IS INCORRECT. 
SKIPPING TO NEXT CLAUSE. 

ILA10U8I-E REEL (UNIT) NOT IN ASSIGN 
CLAUSE. ASSUMED PRESENT. 

ILA1049I-E ***** FILE-NAME ALREADY 

ASSIGNED THIS MULTIPLE FILE 
CLAUSE OPTION. USING FIRST 
ONE. 

ILA1050I-E ***** FILE ALREADY ASSIGNED 

THIS APPLY OPTION. FILE-NAME 
IGNORED. 

ILA1051I-E NO DATA- NAME IN USE SENTENCE. 
SENTENCE IGNORED. 



ILA1052I-E ***** ILLEGALLY USED IN USE 
SENTENCE. END SENTENCE, 
RESCANNING AT NEXT RECOGNIZABLE 
WORD. 



ILA1053I-E 
ILA105m-E 
ILA1055I-E 
ILA1056I-E 
ILA1057I-E 
ILA1058I-E 

ILA1059I-E 

ILA1060I-E 

ILA1061I-E 
ILA1062I-E 

ILA1063I-E 

ILA106m-E 

ILA1065I-E 

ILA1066I-E 

ILA1067I-E 

ILA1068I-E 

ILA1069-E 

ILA1070I-C 

ILA1071I-C 

ILA1072I-C 



ifiHHHf CLAUSE INVALID. 
IGNORED. 



CLAUSE 



OPERAND FOR INITIATE NOT FOUND 
OR ILLEGAL. OPERAND DROPPED. 

VALID FILE-NAME NOT PRESENT. 
DESCRIPTION IGNORED. 

FILE-NAME NOT DEFINED IN A 
SELECT. DESCRIPTION IGNORED. 

FIRST WORD IN REPORT SECTION 
NOT RD. IGNORED. 

NO REPORTS CLAUSE IN FILE 
SECTION. REPORT SECTION 
IGNORED. 

NO REPORT CLAUSE FOR RD. RD 
IGNORED. 

INVALID WORD IN REPORT WRITER 
STATEMENT. IGNORED. 

DUPLICATE CLAUSE. DROPPED. 

iHfifif^ IN COPY REPLACING 
STATEMENT INVALID AS BCD NAME. 

DUPLICATE ENTRY IN PAGE CLAUSE. 
DROPPED. 

NO TYPE CLAUSE SPECIFIED. 
SKIPPING TO NEXT 01. 

INTEGER MISSING IN PAGE CLAUSE. 
ENTRY IGNORED. 

INVALID WORD IN PAGE CLAUSE. 
SKIPPING TO NEXT RECOGNIZABLE 
WORD. 

INVALID HEADER. SKIPPING TO 
NEXT RECOGNIZABLE WORD. 

OPERAND FOR GENERATE NOT FOUND. 
CLAUSE DROPPED. 

INVALID TYPE CLAUSE. SKIPPING 
TO NEXT 01. 

FLT-PT LIT MANTISSA EXCEEDS 16 
DIGITS. TRUNCATED TO 16. 

FLT-PT LIT EXPONENT EXCEEDS 2 
DIGITS. TRUNCATED TO 2. 
RESCANNING. 

FLT-PT LIT EXPONENT FOLLOWED BY 
NON-BLANK. RESCANNING AT 
NON- BLANK. 



Appendix F: Diagnostic Messages 219 



ILA1073I-C 

ILA1074I-C 

ILA1075I-C 

ILA1076I-C 
ILA1077I-C 
ILA1078I-W 

ILA1079I-W 
ILA1080I-W 
I ILA1081I-W 
ILA1082I-C 
ILA1083I-C 

ILA108UI-W 
ILA1085I-C 

ILA1086I-W 
ILA1087I-W 

ILA1088I-E 
ILA1089I-E 

ILA1090I-E 

ILA1091I-C 
ILA1092I-E 



FLT-PT LIT E FOLLOWED BY 
INVALID CHARACTER. RESCANNING 
AT E. 

FLT-PT LIT SIGN FOLLOWED BY 
INVALID CHARACTER. RESCANNING 
AT E. 

FLT-PT LIT EXCEEDS LIMIT. 
ASSUME MAX OR MIN PER SIGN OF 
EXPONENT. 

ALPHANUMERIC LIT EXCEEDS 120 
CHARACTERS. TRUNCATED TO 120. 

ALPHANUMERIC LIT CONTINUES IN 
A-MARGIN. ASSUME B-MARGIN. 

ALPHANUMERIC LIT CONTINUED 
WITHOUT HYPHEN OR QUOTE. 
ASSUMED. 

ALPHANUMERIC LIT HAS ZERO 
LENGTH. ASSUME ONE SPACE. 

PERIOD PRECEDED BY SPACE. 
ASSUME END OF SENTENCE. 

PERIOD NOT FOLLOWED BY SPACE. 
ASSUME END OF SENTENCE. 

NUMERIC LIT EXCEEDS 18 DIGITS. 
TRUNCATED TO 18. 

ILLEGAL CHARACTER. SCAN 
RESUMED AT NEXT VT^^ID 
CHARACTER. 

COMMA SHOULD NOT BE PRECEDED BY 
SPACE. 

WORD OR PICTURE EXCEEDS ^0 
CHARACTERS. TRUNCATED TO 30 
CHARACTERS. 

***** SHOULD BEGIN IN A-MARGIN. 

•*****• SHOULD NOT BEGIN IN 
A-MARGIN. 

MISSING FIRST INSERT OR DELETE 
CARD. PASS CARDS UNTIL FOUND. 
*****^ 

INSERT OR DELETE NUMBER OUT OF 
SEQUENCE. SKIPPING TO NEXT 
INSERT OR DELETE NUMBER. 
*****^ 

DELETE THRU NUI/IBER OUT OF 
SEQUENCE. PASS CARDS UNTIL 
NEXT INSERT OR DELETE. *♦***. 

***** IN A-MARGIN NOT VALID AS 
PROC-NM. ASSUME B-MZ^GIN. 

DECLARATIVES DO NOT FOLLOW 
PROCEDURE DIVISION. IGNORED. 



ILA1093I-E 
ILA109m-E 

ILA1095I-W 
ILA1096I-E 



NO DECLARATIVES SECTION. 
DECLARATIVES IGNORED. 



END 



ILA1097I-E 



ILA1098I-C 

ILA1099I-E 
I ILAIIOOI-W 

ILAIIOII-E 

I ILA1102I-W 

ILA1103I-E 

ILA1104I-E 

I ILA1105I-W 

ILA1106I-E 

ILA1107I-C 

ILA1108I-E 
ILA1109I-E 
ILAIIIOI-W 
ILAllllI-W 
ILA1112I-E 



INTEGER IN NEXT GROUP CLAUSE 
DOES NOT CONFORM TO PAGE CLAUSE 
SPECIFICATIONS. CONTINUING. 

WORD 'SECTION* OR 'DIVISION' 
MISSING. ASSUMED PRESENT. 

DATANAME IN UPON CLAUSE NOT 
SPECIFIED AS A DATANAME FOR A 
TYPE DETAIL REPORT GROUP IN 
THIS REPORT. UPON OPTION 
IGNORED. 

PROGRAM-ID MISSING OR 
MISPLACED. IF PROGRAM- ID DOES 
NOT IMMEDIATELY FOLLOW 
IDENTIFICATION DIVISION, IT 
WILL BE IGNORED. 

ALPHA LITERAL NOT CONTINUED 
WITH HYPHEN AND QUOTE. END 
LITERAL ON LAST CARD. 

***** IS INVALID AS USED. 

***** SEQUENCE ERRORS IN SOURCE 
PROGRAM. 

NEXT PAGE NOT IN FIRST LINE 
CLAUSE. IGNORED. 

INCOMPLETE ELEMENTARY ITEM. 
ASSUME VALUE SPACES. 

GROUP TYPE ALLOWED ONCE FOR RD. 
IGNORED. 

CONTROL NAME NOT SPECIFIED IN 
RD. SKIPPING TO NEXT 01. 

ELEMENTARY ITEM EXPECTED. 
ASSUMED. 

OPERAND FOR TERMINATE NOT FOUND 
OR ILLEGAL. OPERAND DROPPED. 

•NEXT GROUP' CLAUSE IS ILLEGAL 
FOR THIS REPORT GROUP. 
IGNORED. 

***** IS NOT A POSITIVE 
INTEGRAL NUMBER. ASSUMED ONE. 

DUPLICATE USE OF CONTROL NAME. 
SKIPPING TO NEXT 01. 

INVALID USE OF SUM CLAUSE. 
CLAUSE IGNORED. 

ELEMENTARY LEVEL WITHOUT COLUMN 
OR SUM CLAUSE. 

•*****• ALREADY SPECIFIED IN 
TWO FILE DESCRIPTION ENTRIES. 
IGNORED. 



\.^ 






220 



iiiAiiiai-E 



L^." 



ILA1114I-C 



ILA1115I-E 



ILA1116I-E 



ILA1117I-E 



ILA1118I-E 



ILA1119I-E 



ILA1120I-W 



ILA1121I-W 



ILA1122I-E 



EXPECTING 6-DIGIT SEQUENCE 
NUMBER. SKIPPING TO NEXT 
INSERT OR DELETE NUMBER. 



EXTRANEOUS COMMA OR HYPHEN ON 
DELETE CARD. IGNORED. 

NO BLANK, COMMA, OR HYPHEN 
FOLLOWING SEQUENCE NUMBER. 
ASSUME BLANK. *****. 

EXPECTING 6-DIGIT SEQUENCE 
NUMBER AFTER HYPHEN. IGNORING 
DELETE FROM THRU NUMBER. 

DELETE NUMBER GREATER THAN LAST 
SEQUENCE NUMBER. STOP INSERT 
AND DELETE. *****. 

INSERT NUMBER GREATER THAN LAST 
SEQUENCE NUMBER. STOP INSERT 
AND DELETE. *****. 

INTEGER IN 'LINE' CLAUSE DOES 
NOT CONFORM TO PAGE CLAUSE 
SPECIFICATIONS. CONTINUING. 

COMMA NOT FOLLOWED BY SPACE. 
ASSUMED. 

PERIOD OR COMMA INVALID AS USED 
IN t»ICTURE CLAUSE. 

EXTERNAL-NAME IN RERUN CLAUSE 
MUST NOT BE THE SAME AS 
SYSTEM-NAME USED IN ASSIGN 
CLAUSE. SENTENCE IGNORED. 



ILA1X32I-E 



ILA1133I-W 



ILA1134I-E 



ILA1135I-W 



ILA1136I-E 



ILA1137I-W 



ILA1141I-C 



ILA1142I-E 



ILA11U3I-E 



ILA1144I-W 



INVALID SYSTEM-NAME. 
TO NEXT CLAUSE. 



SKIPPING 



MORE THAN 1 USE ON STANDARD 
ERROR SPECIFIED FOR SAME FILE 
ON OPEN OPTION. USE IGNORED. 

USE SPECIFIED FOR FILE WITH 
LABEL RECORDS OMITTED OR 
STANDARD. SENTENCE IGNORED. 

INTEGER- 1 OUTSIDE OF ALLOWABLE 
LIMITS. 1 ASSUMED. 

DATANAME ALREADY SPECIFIED FOR 
A TYPE DETAIL REPORT GROUP. 
SKIPPING TO NEXT 01, RD, OR 
SECTION. 

MINIMUM NUMBER OF OCCURRENCES 
IN OCCURS CLAUSE NOT LESS THAN 
MAXIMUM NUMBER. CONTINUING. 

FILE ORGANIZATION FIELD INVALID 
IN SYSTEM-NAME. SEQUENTIAL 
ASSUMED. 

USE FOR STANDARD ERROR OR LABEL 
PROCESSING SPECIFIED FOR FILE 
AND OPEN OPTION. USE FOR OPEN 
OPTION IGNORED. 

USE STATEMENTS IMPLY STANDARD 
AND NON-STANDARD LABELS. USE 
IGNORED. 

WRITE AFTER POSITIONING AND 
WRITE BEFORE ADVANCING. 
ILLEGALLY USED FOR 1 FILE. 



ILA1123I-E 



ILA112UI-E 



ILA1125I-C 



ILA1126I-E 



ILA1127I-C 



NUMBER IS ZERO OR NEGATIVE. 
SENTENCE IGNORED. 

NUMBER TOO LARGE FOR RERUN. 
SENTENCE IGNORED. 

***** FILE-NAME USED IN 
■PPT?!VIOUS RF-RUN, USING FIRST 

ONE. 

***** FILE- NAME SPECIFIED IN 
BOTH RERUN AND USING OR GIVING 
OPTION. RERUN IGNORED. 

*if:^f** INVALID IN ***** 
SENTENCE. REST OF SENTENCE 
IGNORED. 



ILA1129I-C ID DIV. HEADER MISSING OR 
MISPLACED. ASSX3MED PRESENT. 

ILA1130I-E ***** DIV. HEADER MISSING. 

WORDS IN ***** STATEMENTS ARE 
INVALID. 



ILA1145I-E 



ILA11U7I-E 



ILA1148I-C 



ILA11U9I-E 



ILA1131I-W INVALID PRIORITY NUMBER. 
ASSUMED. 



ZERO 



ILA1151I-E 



IAL1152I-E 



ILA1154I-E 



:ff***:t: DUPLICATELY DEFINED IN 
SPECIAL NAMES PARAGRAPH. 
SENTENCE IGNORED. 

SD FILE ILLEGALLY SPECIFIED IN 
SAME AREA CLAUSE. CLAUSE FOR 
SD IGNORED. 



INVALID SEGMENT LIMIT. 
ASSUMED. 



FIFTY 



FILES IN SAME AREA CLAUSE DO 
NOT ALL APPEAR IN THE SAME 
SORT/RECORD AREA CLAUSE, 
(^c^c**** NOT GIVEN SAME AREA 
NUMBER. 

ILLEGAL CHARACTER USE IN 
CURRENCY SIGN CIlAUSE. CLAUSE 
IGNORED. 

ON AND/OR OFF STATUS MUST BE 
SPECIFIED ON UPSI CLAUSE. 
SPECIAL NAME IGNORED. 

2 DIFFERENT LABEL PROCEDURES 
FOR EOF AND EOV WITH 'BEFORE* 



Appendix F: Diagnostic Messages 221 



OPTION. BOTH LABEL PROCEDURES 
IGNORED. 



ILA1155I-E DEVICE CLASS INVALID IN 

SYSTEM-NAME. SKIPPING TO NEXT 
FIELD. 



ILA1156I-C 
ILA1158I-E 

ILA1156I-W 
ILA1160I-E 
ILA1161I-W 
ILA1162I-E 
ILA116^^-E 

ILAliem-E 

ILA1165I-E 

ILA1166I-E 

ILA1167I-W 

ILA1168I-W 
ILA1169I-E 

ILA1170I-E 
ILA1171I-E 

ILA1172I-E 
ILA1173I-E 



DEVICE NUMBER INVALID IN 
SYSTEM-NAME. •♦*♦**• ASSUMED. 

•♦♦**♦' IN ENTRY STATEMENT IS 
SAME AS PROGRAM- ID. • ♦♦♦♦*i 
IGNORED FOR ENTRY VERB. 

PAGE LIMIT INTEGER- 1 NOT 
SPECIFIED. ASSUME HIGH-VALUE. 

CONTINUATION OF WORD FOUND IN 
A-MARGIN. IGNORED. 



RESERVED WORD MISSING. 
PRESENT. 



ASSUMED 



INTEGER IN LINE CLAUSE IS LESS 
THAN PREVIOUS VALUE. IGNORED. 

ABSOLUTE LINE NUMBER IS 
PRECEDED BY A RELATIVE LINE 
NUMBER. IGNORED. 

NO PAGE CLAUSE SPECIFIED. ALL 
LINE CLAUSES MUST BE 'LINE PLUS 
INTEGER* . IGNORED. 

•HEADING' EQUALS 'FIRST DETAIL' 
IN PAGE CLAUSE. PAGE HEADING 
IS ILLEGAL. CONTINUING. 

•FOOTING' EQUALS 'PAGE LIMIT' 
IN PAGE CLAUSE. PAGE FOOTING 
IS ILLEGAL. CONTINUING. 

'LINE NEXT PAGE' CLAUSE IS 
ILLEGAL FOR THIS REPORT GROUP. 
IGNORED. 

DUPLICATE REPORT NAME. 
SKIPPING TO NEW RD. 

AN OPERAND IN THIS SUM CLAUSE 
DOES NOT APPEAR AS A SOURCE 
ITEM IN DETAIL *****. OPERAND 
IGNORED. 

DETAIL REPORT GROUP SPECIFIED 
WITH NO DATANAME. CONTINUING. 

INTEGERS IN PAGE CLAUSE ARE NOT 
IN ASCENDING ORDER. 
CONTINUING. 

WORD INVALID AS REPORT NAME. 
RD IGNORED. 

GROUP INDICATE IS ILLEGAL FOR 
THIS REPORT GROUP. IGNORED. 



ILA1174I-E 

ILA1175I-E 

ILA1176I-E 
ILA1178I-E 



NO LINE CLAUSE SPECIFIED IN 
PRECEDING REPORT GROUP. NO 
OUTPUT GENERATED. 

DATANAME FOR THIS REPORT GROUP 
IS NOT UNIQUE. SKIPPING TO NEW 
01, RD, SECTION. 

SYS NUMBER NOT EQUAL TO 001 FOR 
SORT FILE. ASSUMED PRESENT. 

RESET CLAUSE SPECIFIED, AND IS 
EITHER ILLEGAL FOR THIS REPORT 
GROUP, OR ELEMENTARY ITEM DOES 
NOT CONTAIN A SUM CLAUSE. 
CLAUSE IGNORED. 



ILA1179I-E 
ILA2001I-C 
ILA2002I-W 
ILA2003I-W 
ILA200UI-E 

ILA2005I-W 

ILA2006I-C 
ILA2007I-C 

ILA2008I-C 

ILA2009I-C 



COLUMN NUMBER ILLEGAL. 
COLUMN 1. 



ASSUME 



BLOCK SIZE SMALLER THAN RECORD 
SIZE. BLOCK CONTAINS IGNORED. 



ORGANIZATION INCORRECT. 
STANDARD SEQUENTIAL. 



USING 



ILA2010I-E 

ILA2011I-E 

ILA2012I-E 
ILA2013I-C 



RANDOM ACCESS ILLEGAL FOR THIS 
FILE. USING SEQUENTIAL. 

RECORDING MODE ILLEGAL FOR 
ACCESS METHOD. RECORDING MODE 
IGNORED. 

A CARD-FILE OPENED INPUT MUST 
HAVE FIXED RECORD FORMAT. 
FIXED ASSUMED. 

SPANNED RECORDS INVALID FOR 
THIS DEVICE. USING VZ^IABLE. 

RECORD CONTAINS CLAUSE 
CONFLICTS WITH RECORD 
DESCRIPTION. CLAUSE IGNORED. 

APPLY MASTER/CYLINDER INDEX 
VALID ONLY FOR INDEXED FILES. 
CLAUSE IGNORED. 

SYNCHRONIZED ITEM NOT ON PROPER 
BOUNDARY. NO ALIGNMENT 
PERFORMED BECAUSE STARTING 
ADDRESS OF THE REDEFINES ITEM 
WOULD HAVE TO BE CHANGED. 

OBJECT OF REDEFINES CLAUSE IS 
OCCURS DEPENDING ON SUBJECT. 
REDEFINES CLAUSE IGNORED. 

AN INDEX DATA ITEM MAY NOT BE A 
CONDITIONAL VARIABLE. 88 (S) 
DISCARDED. 

INDEX NAMES AND/OR KEYS IGNORED 
FOR TABLE WITH ILLEGAL SUBJECT. 

BLOCK CONTAINS CLAUSE 
IMPROPERLY WRITTEN. CLAUSE 
IGNORED. 



\. 



222 



ILA2014I-C BLOCK CONTAINS CHARACTERS MUST 
BE USED FOR SPANNED RECORDS. 
USING VARIABLE. 



ILA2015I-W CONFLICTING SPECIFICATIONS FOR 
RECORD FORMAT. ***** ASSUMED. 



ILA2033I-C ITEM'S USAGE INCOMPATIBLE WITH 
USAGE OF GROUP IT BELONGS TO. 
USAGE CHANGED TO GROUP'S USAGE. 



ILA2016I-E 



ILA2017I-E 



ILA2018I-E 



ILA2019I-C 



ILA2020I-C 



ILA2021I-C 



ILA2022I-E 



ILA2023I-E 



ILA2024I-E 



ILA2027I-C 



ILA2028I-W 



DATA-RECORD SIZE IS VARIABLE. 
■RECORDING MODE F» IGNORED. 

IF THE SUBJECT OF AN INDEXED BY 
CLAUSE IS AN ELEMENTARY ITEM 
ONLY THAT ITEM MAY BE SPECIFIED 
IN THE KEY CLAUSE. REST OF 
KEYS DISCARDED. 

OBJECT OF RENAMES CLAUSE WAS 
NOT FOUND OR NON-UNIQUE IN 
LOGICAL RECORD. 

BLOCK CONTAINS CLAUSE INVALID 
WHEN RECORD FORMAT IS UNDEF. 
CLAUSE IGNORED. 

TRACK-AREA CLAUSE ILLEGAL FOR 
THIS ACCESS METHOD. CLAUSE 
IGNORED. 

PICTURE DUPLICATION FACTOR 
TRUNCATED TO 5 SIGNIFICANT 
DIGITS. 

THE OBJECT OF THE RENAMES OR 
RENAMES THRU CLAUSE CANNOT BE 
AN 01, 66, 77, OR 88. 
STATEMENT DISCARDED. 



**4c** KEY MISSING. 
IGNORED. 



FILE 



***** KEY IS ILLEGAL FOR THIS 
ACCESS METHOD. CLAUSE IGNORED. 

APPLY CORE INDEX ILLEGAL FOR 
THIS ACCESS METHOD. CLAUSE 
IGNORED. 

RECORD CONTAINS CLAUSE 
IMPROPERLY WRITTEN. CLAUSE 
IGNORED. 



ILA2029I-C FIRST NON 77, 88 ITEM IN 

SECTION IS NOT AN 01. THIS 
ITEM WAS CHANGED TO 01. 

ILA2030I-C 77 ITEM PRECEDED BY AN 01-49 

ITEM OR 77 IN FILE SECTION. 77 
CHANGED TO 01. 

ILA2031I-C 88 ITEM MUST MUST BE PRECEDED 
BY 01-49 OR 77 ITEM. 88 
CHANGED TO 01. 

ILA2032I-E 88 ITEM CONTAINED A CLAUSE 
OTHER THAN VALUE CLAUSE. 
CLAUSE DELETED. 



ILA203UI-E 
ILA2035I-E 
ILA2036I-E 
ILA20 37I-E 
ILA2038I-E 

ILA2039I-C 

ILA2040I-E 

ILA2041I-E 
ILA2042I-E 

ILA2043I-E 

I ILA2044I-E 
ILA2045I-E 
ILA2046I-E 

ILA2047I-E 

ILA2049I-C 
ILA2050I-C 

ILA2051I-C 

ILA2052I-E 
ILA2055I-C 



GROUP ITEM HAS PICTURE CLAUSE. 
CLAUSE DELETED. 

GROUP ITEM HAS BLANK WHEN ZERO 
CLAUSE. CLAUSE DELETED. 

GROUP ITEM HAS JUSTIFIED 
CLAUSE. CLAUSE DELETED. 

BLANK WHEN ZERO CLAUSE USED 
INCORRECTLY. CLAUSE IGNORED. 

ACTUAL KEY MUST BE GREATER THAN 
U AND LESS THAN 259 BYTES IN 
LENGTH. USING 5. 

PICTURE CONFIGURATION ILLEGAL. 
PICTURE CHANGED TO 9 UNLESS 
USAGE IS • DISPLAY-ST' , THEN 
L(6)BDZ9BDZ9. 

JUSTIFIED CLAUSE SPEC'D FOR 

NON-ALPHABETIC OR 

NON- ALPHANUMERIC ITEM. CLAUSE 

DELETED. 

CONDITION NAME UNDER GROUP HAS 
VALUE CLAUSE THAT IS NUMERIC. 
88 DISCARDED. 

THIS ITEM CAUSES OVER 3 LEVELS 
OF SUBSCRIPTING. OCCURS CLAUSE 
DROPPED FOR THIS ITEM. 

01 OR 77 LEVEL HAS AN OCCURS 
CLAUSE. CLAUSE DELETED. 

DUPLICATE SD. IGNORED. 

REPORT CONTROL NAME UNDEFINED. 

REPORT CONTROL NAME NOT FIXED 
LENGTH. 

MORE THAN 12 INDEX NAMES 
SPECIFIED FOR TABLE. FIRST 12 
ACCEPTED. 

NO VALID OPEN FOR FILE. FILE 
IGNORED. 

BLOCK SIZE TOO LARGE. USING 
MAXIMUM FOR DEVICE. RECORD 
TRUNCATED. 

APPLY EXTENDED SEARCH VALID 
ONLY FOR DIRECT FILES. CLAUSE 
IGNORED. 

MORE THAN 12 KEYS SPECIFIED FOR 
TABLE. FIRST 12 ACCEPTED. 

STERLING NON- REPORT PICTURE - 
SIGN IN POUND FIELD MUST BE ON 



Appendix F: Diagnostic Messages 223 



HI OR LO ORDER DIGIT, PICTURE 
REPLACED BY 9D8D7. 



ILA2072I-C NUMERIC PICTURE - NO 9 IN 

PICTURE. PICTURE REPLACED BY 
9(1). 



ILA2056I-C STERLING NON-REPORT PICTURE - 9 
IN ILLEGAL POSTION. PICTURE 
REPLACED BY 9D8D7. 



ILA2057I-C STERLING NON-REPORT PICTURE - 

SIGN IN SHILLING FIELD ILLEGAL. 
PICTURE REPLACED BY 9D8D7. 

ILA2058I-C STERLING NON-REPORT PICTURE - 8 
IN ILLEGAL POSITION. PICTURE 
REPLACED BY 9D8D7. 

ILA2059I-C STERLING NON-REPORT PICTURE - 
SIGN IN PENCE FIELD ILLEGAL. 
PICTURE REPLACED BY 9D8D7. 

ILA2060I-C STERLING NON-REPORT PICTURE - 6 
OR 7 IN ILLEGAL POSITION. 
PICTURE REPLACED BY 9D8D7. 

ILA2061I-C STERLING NON-REPORT PICTURE, 

USAGE NOT DISPLAY-ST. PICTURE 
REPLACED BY 9(1). 

ILA2062I-C STERLING NON- REPORT PICTURE - V 
IN ILLEGAL POSITION. PICTURE 
REPLACED BY 9D8D7. 

ILA2063I-C STERLING NON-REPORT PICTURE - S 
IN ILLEGAL POSITION. PICTURE 
REPLACED BY 9D8D7. 

ILA2064I-C STERLING NON-REPORT PICTURE - 
DIGIT LENGTH GT 2. PICTURE 
REPLACED BY 9D8D7. 

ILA2065I-C STERLING NON-REPORT PICTURE - 
SHILLING FIELD GT 18. PICTURE 
REPLACED BY 9D8D7. 

ILA2066I-C STERLING NON-REPORT PICTURE - 
PENCE FIELD GT 2. PICTURE 
REPLACED BY 9D8D7. 

ILA2067I-C STERLING NON-REPORT PICTURE - 
NO POUND SEPARATOR. PICTURE 
REPLACED BY 9D8D7. 

ILA2068I-C ONLY THE RENAMES CLAUSE MAY BE 
SPECIFIED FOR A LEVEL 66 ENTRY. 
CLAUSE IGNORED. 

ILA2069I-C NUMERIC PICTURE - SIGN IN 
ILLEGAL POSITION, PICTURE 
REPLACED BY 9(1). 

ILA2070I-C NUMERIC PICTURE - P IN ILLEGAL 
POSITION. PICTURE REPLACED BY 
9(1): 

ILA2071I-C NUMERIC PICTURE - V IN ILLEGAL 
POSITION. PICTURE REPLACED BY 
9(1). 



ILA2073I-C NUMERIC PICTURE - P ENCLOSED BY 
9»S. PICTURE REPLACED BY 9(1). 

ILA2074I-E COMPILER ERROR - MINOR CODE FOR 
RENAMES ENTRY IS ILLEGAL. 

ILA2075I-C NUMERIC PICTURE - DIGIT LENGTH 
GT 18. PICTURE REPLACED BY 
9(1). 

ILA2076I-C NUMERIC PICTURE - DIGIT LENGTH 
+ SIGN SCALE GT 18. PICTURE 
REPLACED BY 9(1). 

ILA2077I-C EXTERNAL FLOATING-POINT PICTURE 

- USAGE NOT DISPLAY. PICTURE 
CHANGED TO 9. 

ILA2078I-W EXTERNAL FLOATING-POINT PICTURE 

- MORE THAN 1 SIGN. CHANGED TO 
1. 

ILA2079I-C EXTERNAL FLOATING-POINT PICTURE 

- SIGN IN ILLEGAL POSITION. 
PICTURE CHANGED TO +9.E+99. 

ILA2080I-C EXTERNAL FLOATING-POINT PICTURE 

- SIGN MISSING. ASSUME MINUS 
SIGN. 

ILA2081I-C EXTERNAL FLOATING-POINT PICTURE 

- REQUIRED CHARACTER BEFORE 
EXPONENT MISSING. PICTURE 
CHANGED TO +9.E+99. 

ILA2082I-W EXTERNAL FLOATING-POINT PICTURE 

- NO DECIMAL POINT IN MANTISSA. 
ASSUME IMPLIED V. 

ILA2083I-C EXTERNAL FLOATING-POINT PICTURE 

- MANTISSA LENGTH GT 16. 
PICTURE CHANGED TO +9.E+99. 

ILA2084I-C EXTERNAL FLOATING-POINT PICTURE 

- TOTAL LENGTH GT 21. PICTURE 
CHANGED TO +9.E+99. 

ILA2085I-C EXTERNAL FLOATING-POINT PICTURE 

- EXPONENT LENGTH NOT 2 DIGITS. 
ASSUME 2 DIGITS. 

ILA2086I-C NUMERIC EDITED PICTURE - TWO 
FIXED DOLLAR SIGNS, +, - OR 
FIXED AND FLOATING DOLLAR SIGN. 
PICTURE REPLACED BY 9(1). 

ILA2089I-C NUMERIC EDITED PICTURE - 9, Z 
OR * PRECEDES FLOATING STRING. 
PICTURE REPLACED BY 9("). 

ILA2090I-C NUMERIC EDITED PICTURE - P IN 
ILLEGAL POSITION. PICTURE 
REPLACED BY 9(1). 



22U 



ILA2091I-C NUMERIC EDITED PICTURE - TWO 
DIFFERENT FLOATING STRING 
CHARACTERS. PICTURE REPLACED 
BY 9(1). 

ILA2092I-C NUMERIC EDITED PICTURE - Z AND 
* IN PICTURE. PICTURE REPLACED 
BY 9(1). 

ILA2093I-C NUMERIC EDITED PICTURE - 9 
PRECEDES * OR Z. PICTURE 
REPLACED BY 9(1). 



IIiA2107l-W NUMERIC EDITED PICTURE - USAGE 
NOT DISPLAY. PICTURE CHANGED 
TO 9. 



ILA2108I-E 



KEYS IGNORED FOR ITEM WITH NO 
INDEXED BY CLAUSE. 



ILA2110I-C APPLY WRITE-ONLY VALID ONLY FOR 
VARIABLE BLOCKED RECORDS. 
CLAUSE IGNORED. 



ILA2094I-C NUMERIC EDITED PICTURE - ILA2113I-W 

FLOATING STRING PRECEDES ♦ OR 
Z. PICTURE REPLACED BY 9(1). 

ILA2096I-C DECIMT^J POINT MAY ONLY APPEAR 

ONCE IN A PICTURE CHARACTER ILA211UI-E 

STRING. PICTURE REPLACED BY 

9(1). 



ITEM WITH USAGE OF 
COMPUTATIONAL- 1 OR 
COMPUTATIONAL- 2 HAS PICTURE 
CLAUSE. CLAUSE IGNORED. 

ONLY THE SYNCHRONIZED CLAUSE IS 
ALLOWED FOR A USAGE IS INDEX 
ITEM. CLAUSE IGNORED. 



ILA2097I-C NUMERIC EDITED PICTURE - ILA2115I-E 

DECIMAL POINT OR V 
CONTRADICTORY TO P. PICTURE 
REPLACED BY 9(1). ILA2116I-E 

ILA2098I-C INDEXED BY AND/OR KEY CLAUSE IS I 
ILLEGAL FOR ITEM SUBORDINATE TO 
GROUP THAT HAS OCCURS BUT NO 

INDEXED BY CLAUSE. CLAUSE ILA2117I-E 
IGNORED. 



LENGTH OF VARIABLE GROUP GT 
32K. ACCEPTED AS WRITTEN. 

FIXED LENGTH GROUP ITEM IN 
WORKING-STORAGE OR LINKAGE 
SECTION IS GT 131K. ACCEPTED 
AS WRITTEN. 

INVALID REPORT CHARACTER. 
PICTURE CHANGED TO 9. 



ILA2099I-C 



ILA2100I-C 



ILA2101I-C 



ILA2102I-C 



ILA2103I-C 



ILA210UI-C 



ILA2105I-E 



ILA2106I-E 



NUMERIC EDITED PICTURE - CR OR 
DB AND SIGN BOTH USED. PICTURE 
REPLACED BY 9(1). 

NUMERIC EDITED PICTURE - CR OR 
DB NOT LAST TWO CHARACTERS IN 
PICTURE. PICTURE REPLACED BY 
9(1). 

NUMERIC EDITED PICTURE - SIGN 
IS NOT FIRST OR LAST CHARACTER 
IN PICTURE. PICTURE REPLACED 
BY 9(1). 

NUMERIC EDITED PICTURE - 
NUMERIC CHARACTERS AFTER 
DECIMZVL POINT ARE NOT THE SAME. 
PICTURE REPLACED BY 9(1). 

NUMERIC EDITED PICTURE - TOTAL 
LENGTH GT 127. PICTURE 
REPLACED BY 9(1). 

NUMERIC EDITED PICTURE - 
NUMERIC LENGTH GT 18. PICTURE 
REPLACED BY 9(1). 

ONLY ONE KEY MAY BE SPECIFIED 
IF THE SUBJECT OF TABLE IS A 
KEY. REST OF KEYS DISCARDED. 

THE RENAMES CLAUSE MUST BE THE 
LAST ENTRY IN A LOGICAL RECORD. 
SKIPPING TO NEXT LEVEL, 
SECTION, OR DIVISION. 



ILA2118I-C 



ILA2119I-E 



ILA2120I-E 



ILA2121I-W 



ILA2122I-E 



ILA2123I-W 



ILA2124I-C 



ILA2125I-W 



ILA2126I-C 



LENGTH OF REDEFINES SUBJECT 
GREATER THAN LENGTH OF 
REDEFINES OBJECT. SUBJECT 
LENGTH USED. 

VALUE CLAUSE SPECIFIED FOR AN 
ITEM IN A REDEFINES GROUP. 
CLAUSE IGNORED. 

OBJECT OF REDEFINES CLAUSE 
UNDEFINED OR ILLEGAL. CLAUSE 
IGNORED. 

SUBJECT OF REDEFINES IS 
VARIABLE LENGTH. 

REDEFINES SUBJECT LEVEL NUMBER 
NOT EQUAL TO REDEFINES OBJECT 
LEVEL NUMBER OR OBJECT NOT 
IMMEDIATELY PRECEDING SUBJECT. 
CLAUSE IGNORED. 

OBJECT OF REDEFINES IS 
SUBSCRIPTED. 

OBJECT OF REDEFINES IS VARIABLE 
LENGTH GROUP ITEM. REDEFINES 
CLAUSE IGNORED. 

VALUE CLAUSE TREATED AS 
COMMENTS FOR ITEMS IN FILE AND 
LINKAGE SECTIONS. 

VALUE CLAUSE LITERAL TOO LONG. 
TRUNCATED TO PICTURE SIZE. 



Appendix F: Diagnostic Messages 225 



ILA2127I-C NUMERIC VALUE CLAUSE SPECIFIED 
FOR GROUP ITEM. CLAUSE 
IGNORED. 



ILA2146I-W RECORD CONTAINS DISAGREES WITH 
COMPUTED MAXIMUM. USING 
COMPUTED MAXIMUM. 



ILA2128I-C VALUE CLAUSE LITERAL DOES NOT 

CONFORM TO PICTURE. CHANGED TO 
BLANKS. 



ILA2129I-C VALUE CLAUSE LITERAL DOES NOT 

CONFORM TO PICTURE. CHANGED TO 
ZERO. 



ILA2130I-E ITEM CANNOT HAVE VALUE CLAUSE. 
CLAUSE IGNORED. 

ILA2132I-E RECORD KEY LENGTH GREATER THAN 
255 BYTES. ACCEPTED AS 
WRITTEN. 

ILA2133I-W LABEL RECORDS CLAUSE INVALID OR 
MISSING. ***** ASSUMED. 

ILA2134I-C VALUE FOR SCALING CHARACTER 
SHOULD BE ZERO. CHANGED TO 
ZERO. 

ILA2135I-C RECORDS IN ISAM FILE CANNOT BE 
VARIABLE LENGTH. ASSUMED FIXED 
AT MAXIMUM SIZE. 

ILA2136I-E NOMINAL KEY LENGTH FOR INDEXED 
FILE GREATER THAN 255 BYTES. 
KEY IGNORED. 

ILA2137I-E THE OBJECT OF THE RENAMES THRU 
CLAUSE IS SUBORDINATE TO THE 
SUBJECT. STATEMENT DISCARDED. 

ILA2139I-W APPLY WRITE VERIFY VALID ONLY 
FOR MASS STORAGE DEVICES. 
CLAUSE IGNORED. 

ILA2140I-E VALUE CLAUSE SPECIFIED ON BOTH 
GROUP AND ELEMENTARY ITEM OR ON 
SUBORDINATE GROUP. SECOND 
ITEM'S VALUE CLAUSE IGNORED. 

ILA21U1I-C LENGTH OF LITERAL IS MORE OR 
LESS THAN LENGTH OF GROUP. 
LENGTH OF LITERAL ASSUMED. 

ILA2142I-W ALPHABETIC OR ALPHANUMERIC ITEM 
HAS ILLEGAL USAGE. PICTURE 
CHANGED TO 9. 

ILA21U3I-W STERLING NON-REPORT PICTURE - 
MORE THAN ONE V OR S. ASSUMED 
ONE. 

ILA2ia4l-C NUMERIC PICTURE - MORE THAN ONE 
V OR S. ASSUMED ONE. 

ILA21U5I-E ALPHABETIC OR ALPHANUMERIC ITEM 
LENGTH GREATER THAN 32767. 
TRUNCATED TO 32767, 



ILA2148I-W ON AN 01 (77) COPY LIBRARY- NAME 
CLAUSE, LIBRARY DID NOT HAVE AN 
01 (77) AS FIRST CARD. 

ILA2149I-E VALUE CLAUSE SPECIFIED FOR ITEM 
WITH OCCURS OR FOR ITEM 
SUBORDINATE TO AN ITEM WITH 
OCCURS. CLAUSE IGNORED. 

ILA2150I-E VALUE CLAUSE SPECIFIED FOR ITEM 
IN VARIABLE LENGTH PORTION OF A 
WORKING- STORAGE RECORD. CLAUSE 
IGNORED. 

ILA2151I-C ELEMENTARY ITEMS NOT INTERNAL 
FLOATING-POINT MUST HAVE 
PICTURE. PICTURE ASSUMED 9. 

ILA2152I-D COMPILER ERROR - PHASE 2 INPUT 
UNRECOGNIZABLE. SKIPPING TO 
NEXT PHASE. 

ILA2153I-C APPLY CYLINDER OVERFLOW VALID 

ONLY FOR INDEXED FILES. CLAUSE 
IGNORED. 

ILA215UI-C THE AREA BEING REDEFINED IS NOT 
IMMEDIATELY PRECEDING THE ENTRY 
WHICH REDEFINES IT OR THE LEVEL 
NUMBERS OF THE SUBJECT AND 
OBJECT OF THE REDEFINES ARE NOT 
THE SAME. THE OBJECT OF THE 
REDEFINES IS ASSUMED TO BE THE 
LAST ENTRY WITH THE SAME LEVEL 
NUMBER AS THE SUBJECT OF THE 
REDEFINES. 

ILA2155I-C ILLEGAL STERLING NON-REPORT 
PICTURE CHARACTER. PICTURE 
REPLACED BY 9D8D7. 

ILA2156I-W PICTURE DOES NOT CONTAIN A 

SIGN. SIGN DROPPED FROM VALUE 
CLAUSE LITERAL. 

ILA2157I-W RESERVE CLAUSE TREATED AS 
COMMENTS FOR THIS FILE 
ORGANIZATION. 

ILA2158I-D OCCURS DEPENDING ON VARIABLE IS 
IN VARIABLE PORTION OF A 
RECORD. PROGRAM INTERRUPT WILL 
OCCUR. 

ILA2159I-C OBJECT OF REDEFINES CLAUSE NOT 
DEFINED. PREVIOUS 01 ASSUMED 
TO BE OBJECT. 

ILA2160I-E THE OBJECT OF THE RENAMES OR 
RENAMES THRU CLAUSE CANNOT 
CONTAIN AN OCCURS OR OCCURS 
DEPENDING ON CLAUSE NOR MAY IT 
BE SUBORDINATE TO AN ITEM THAT 



r 



r 



226 



ILA2161I-C 
ILA2162I-C 
ILA2163I-C 
ILA2164I-C 
ILA2165I-C 
ILA2166I-C 
ILA2167I-C 
ILA2168I-C 
ILA2169I-C 
ILA2170I-C 
ILA2171I-C 

ILA2172I-C 
ILA2173I-C 
ILA2174I-C 

ILA2175I-C 
ILA2176I-W 



WAS ONE OF THESE CLAUSES. 
STATEMENT DISCARDED. 



PICTURE INVALID. ADJACENT C 
DELIMITERS. ASSUMED PICTURE 
L(6)9BDZ9BDZ9. 

PICTURE INVALID. ADJACENT D 
DELIMITERS. ASSUMED PICTURE 
L(6)9BDZ9BDZ9. 

PICTURE INVALID. MORE THAN 2 
DELIMITERS. ASSUMED PICTURE 
L(6)9BDZ9BDZ9. 

PICTURE INVALID. NO STERLING 
DELIMITERS. ASSUMED PICTURE 
L(6)9BDZ9BDZ9. 

PICTURE INVALID. ONLY 1 
STERLING DELIMITER. ASSUME 
PICTURE L(6)9BDZ9BDZ9. 

PICTURE INVALID. ERROR IN 
SHILLING FIELD. ASSUMED 
SHILLING PICTURE Z9B. 

PICTURE INVALID. NUMBER DF 
POUND DIGITS EXCEEDS 15. 
ASSUMED PICTURE L(6)9BD. 

PICTURE INVALID. ERROR IN 
WHOLE PENCE FIELD. ASSUMED 
PENCE PICTURE Z9. 

PICTURE INVALID. ERROR IN 
DECIMAL PENCE FIELD. DECIMAL 
FIELD TRUNCATED. 

PICTURE INVALID. ERROR IN 
POUND FIELD. ASSUMED POUND 
PICTURE L(6)9B. 

PICTURE INVALID. NUMBER OF 
POUND DIGITS PLUS NUMBER OF 
PENCE DECIMAL EXCEEDS 15. 
DECIMAL PENCE DROPPED. 

PICTURE INVALID. SIZE OF 
REPORT FIELD EXCEEDS 127 BYTES. 
ASSUMED PICTURE L(6)BDZ9BDZ9. 

PICTURE INVALID. CR OR DB NOT 
VALID WITH LEADING SIGN. 
DECIMAL FIELD TRUNCATED. 

PICTURE INVALID. SIGN IN 
DECIMAL PENCE FIELD NOT VALID 
WITH LEADING SIGN. DECIMAL 
FIELD TRUNCATED. 

TRACK- AREA EXCEEDS AND IS 
REDUCED TO 32,760 BYTES. 

MULTIPLE JILE TAPE CLAUSE ONLY 
APPLIES TO MAGNETIC TAPE FILES. 
CLAUSE IGNORED. 



ILA2177I-W ZERO SUPPRESSION CHARACTER WILL 
OVERRIDE BLANK WHEN ZERO 
CLAUSE. CLAUSE IGNORED. 

ILA2178I-E RECORD-KEY IS NOT WITHIN 
FILE-RECORD. 

ILA2179I-E RECORD-KEY IS NOT FIXED- LENGTH. 

ILA2180I-C RECORD-KEY FOR UNBLOCKED FILE 
INCLUDES FIRST BYTE OF RECORD. 

ILA2181I-C NOMINAL OR ACTUAL KEY IS 
DEFINED WITHIN THE FILE. 

ILA2182I-E FILE MAY BE OPENED OUTPUT ONLY. 
FILE IGNORED. 

ILA2183I-W NO LEVEL 01 FOR FD OR SD. 

ILA2184I-E VALUE CLAUSE LITERAL DOES NOT 
CONFORM TO PICTURE. CLAUSE 
IGNORED. 

ILA2185I-E DATA-NAME-3 EITHER PRECEDES 

DATA-NAME- 2 OR IS DATA-N21ME-2 
IN THE RENAMES THRU CLAUSE. 
STATEMENT DISCARDED. 

ILA2186I-C PICTURE DUPLICATION FACTOR IS 
ZERO. ASSUMING ONE OCCURRENCE 
OF PICTURE CHARACTER. 

ILA2187I-E OBJECT OF RENAMES CLAUSE OR 

RENAMES THRU CLAUSE IS NOT IN 
SAME LOGICAL RECORD. STATEMENT 
DISCARDED. 

ILA2188I-C EXTERNAL FLOATING-POINT PICTURE 
ILLEGAL WHEN CURRENCY SIGN IS 
E. PICTURE CHANGED TO 9. 

ILA2190I-W PICTURE CLAUSE IS SIGNED, VALUE 
CLAUSE UNSIGNED. ASSUMED 
POSITIVE. 

ILA2191I-C THE SYNCHRONIZED CLAUSE SHOULD 
NOT BE SPECIFIED WHEN 88' S ARE 
UNDER GROUP. STATEMENT 
ACCEPTED AS WRITTEN. 

ILA2192I-E ONLY USAGE IS DISPLAY SHOULD BE 
SPECIFIED WHEN VALUE CLAUSE IS 
ASSOCIATED WITH A GROUP ITEM. 
ACCEPTED AS WRITTEN. 

ILA2193I-C LITERAL-1 IS GREATER THAN OR = 
TO LITERAL- 2 IN VALUE THRU 
CLAUSE. IGNORED. 

ILA219UI-C CHARACTERS OPTION IN BLOCK 
CONTAINS CAUSE NOT LEGAL IN 
INDEXED FILE. CLAUSE IGNORED. 

ILA2196I-C NO VALUE CLAUSE GIVEN FOR 

CONDITION NAME. VALUE ASSUMED 
ZERO OR SPACES DEPENDING ON 
PICTURE. 



Appendix F: Diagnostic Messages 227 



TRACK AREA TOO SMALL. 
IGNORED. 



CLAUSE 



ILA2199I-C 

ILA2200I-E TAPE RECORD MUST CONTAIN AT 
LEAST 18 CHARACTERS. FILE 
IGNORED. 

ILA2201I-E NOMINAL KEY OR CORE- INDEX 

DATANAME MUST BE DEFINED IN 
WORKING- STORAGE SECTION. 

ILA2202I-E NOMINAL KEY OR CORE-INDEX 

DATA-NAME MUST BE DEFINED IN 
THE FIXED PORTION OF A RECORD. 
CONTINUING. 

ILA2203I-E INVALID DEVICE TYPE FOR SD. 
DISK ASSUMED. 

ILA220m-E RECORD KEY AND NOMINAL KEY MUST 
BE THE SAME LENGTH. CONTINUING. 

ILA2205I-E ORGANIZATION ILLEGAL FOR 
ACCESS. FD IGNORED. 

ILA2206I-E REWRITE ILLEGAL FOR 

ORGANIZATION. FD IGNORED. 

ILA2207I-C APPLY CORE-INDEX LEGAL ONLY FOR 
INDEXED ORGANIZATION. CLAUSE 
IGNORED. 

ILA2208I-E ***** KEY INVALID, UNDEFINED, 

OR NOT UNIQUE. CLAUSE IGNORED. 

ILA2209I-C CORE-INDEX DATANAME INVALID. 
UNDEFINED, OR NOT UNIQUE. 
CLAUSE IGNORED. 

ILA2210I-E ACTUAL KEY MUST BE GREATER THAN 
8 AND LESS THAN 263 BYTES IN 
LENGTH. USING 9. 

ILA2211I-C CYLINDER OVERFLOW TOO LARGE. 
CLAUSE IGNORED. 

ILA2212I-W INVALID ALPHANUMERIC EDITED 
CHARACTER. ACCEPTED AS 
WRITTEN. 

ILA2213I-W USER LABEL RECORD NOT DESCRIBED 
UNDER FD. USER LABEL IGNORED. 

ILA2214I-C STERLING NON-REPORT PICTURE - 

NO SHILLING SEPARATOR. PICTURE 
REPLACED BY 9D8D7. 

ILA3001I-E ***** NOT DEFINED. ***. 

Explanation ; This message 
always appears in conjunction 
with another message. 

ILA3002I-E ***** NOT UNIQUE. ***. 

Explanation ; This message 
always appears in conjiinction 
with another message. 



ILA3003I-E HIGHEST LEVEL QUALIFIER ***** 
NOT DEFINED. ***. 



Explanation : This message 
always appears in conjunction 
with another message. 

ILA300UI-W QUALIFYING NAME ***** NOT 
UNIQUE. DISC70UDED. 



Explanation ; This message 
always appears in conjunction 
with another message. 

ILA3005I-E ***** NOT A VALID QUALIFIER. 
***. 



Explanation ; This message 
always appears in conjunction 
with another message. 

ILA3006I-E ***** NOT DEFINED AS PART OF 
*****, ***, 

Explanation ; This message 
always appears in conjunction 
^ with another message. 

ILA3007I-W ***** NOT UNIQUELY QUALIFIED BY 
♦*♦**. DISCARDED. 

Explanation ; This message 
always appears in conjunction 
with another message. 

ILA3008I-E ***** NOT VALID AS IDENTIFIER-1 
IN ***** CORRESPONDING 
STATEMENT. STATEMENT 
DISCARDED. 

ILA3009I-E ***** NOT VALID AS IDENTIFIER- 2 
IN 4^**** CORRESPONDING 
STATEMENT. 

ILA3010I-W SUPERFLUOUS 'TO* IGNORED IN 

***** CORRESPONDING STATEMENT. 

ILA3011I-W NO CORRESPONDENCE FOUND BETWEEN 
IDENTIFIER AND *****. 

ILA3012I-D COMPILER ERROR - LAST ITEM 
REFERENCED BY ACCESS WAS 
ELEMENTARY ITEM. 

ILA3013I-D DICT PTR LESS THAN QVAR ENTRY 
FOR ELEMENTARY ITEM. 

ILA301UI-D NO MATCH FOUND IN QVAR FOR 
***** ELEMENTARY ITEM. 

ILA3016I-D IMPOSSIBLE *****. COMPILER 
ERROR. 

ILA3017I-D COMPILER ERROR. ***** MINOR 
CODE ILLEGAL. 



228 



ILA3018I-E SPECIAL REGISTERS TIME-OF-DAY 
OR CURRENT- DATE MAY ONLY BE 
USED IN THE MOVE STATEMENT. 

Explanation ; This message 
always appears in conjunction 
with another message. 

ILA3019I-D ILLEGAL LEVEL FOR ♦****. 

ILA3020I-E REPORT NAME ILLEGAL AS USED. 
DISCARDED. 

ILA3021I-C ***** NOT UNIQUE IN ITS GROUP. 
DISCARDED. 

ILA3022I-E ***** NOT VALID AS IDENTIFIER-1 
IN SEARCH STATEMENT. STATEMENT 
DISCARDED. 

ILA3023I-W ITEMS CONTAINING THE USAGE IS 
INDEX, REDEFINES, RENAMES, OR 
OCCURS CLAUSES DO NOT QUALIFY 
AS CORRESPONDING IDENTIFIERS. 

ILA302UI-E NO KEYS WERE SPECIFIED FOR 

*****. STATEMENT DISCARDED. 

ILA3025I-E AN ERROR WAS DETECTED 

PROCESSING THE 'KEY FOR» 
PARAMETER. 

ILA3026I-E IDENTIFIER OMITTED IN ***** 
CORRESPONDING STATEMENT. 

ILA3027I-W DATA-NAME UNDER LABEL RECORD IS 
NON-UNIQUE. LAST DATA 
DESCRIPTION OF ***** ASSUMED. 

ILA3029I-E CONDITION NAME ILLEGAL AS USED 
IN ***** STATEMENT. ♦****. 

ILAUOOII-C OUTCOME OF PRECEDING CONDITION 
LEADS TO NON-EXISTENT 'NEXT 
SENTENCE'. 'STOP RUN' 
INSERTED. 

ILA4002I-E ***** STATEMENT INCOMPLETE. 
STATEMENT DISCARDED. 

ILAU003I-E EXPECTING NEW STATEMENT. FOUND 
***«*. DELETING TILL NEXT VERB 
OR PROCEDURE NAME. 

ILAU004I-E ***** / ***** IS ILLEGALLY USED 
IN ***** STATEMENT. DISCARDED. 

ILA10q5l-E ***** AND ***** VIOLATE RULE 
ABOUT LENGTH OF TRANSFORM 
OPERANDS. STATEMENT DISCARDED. 

ILA4006I-C ***** STATEMENT CONTAINS 

UNPAIRED LEFT PARENTHESES. 
OUTERMOST IGNORED. 

ILAU007I-C ***** MISSING OR MISPLACED IN 
***** STATEMENT. ASSUMED IN 
REQUIRED POSITION. 



ILAU008I-W 



ILAU009I-E 



SUPERFLUOUS ***** FOUND IN 
***** STATEMENT. IGNORED. 

EXAMINE STATEMENT REQUIRES 
FIGURATIVE CONSTANT, SINGLE 
ALPHANUMERIC CHARACTER, OR 
1-DIGIT UNSIGNED NUMERIC 
INTEGRAL LITERAL. FOUND *****. 
STATEMENT DISCARDED. 

***** STATEMENT CONTAINS 
UNPAIRED RIGHT PARENTHESES. 
OUTERMOST IGNORED. 

***** IS NOT AN ALLOWABLE 
CHARACTER FOR ♦****, STATEMENT 
DISCARDED. 

COMPARISON BETWEEN TWO LITERALS 
IS ILLEGAL. TEST DISCARDED. 

RELATIONAL MISSING IN IF 
STATEMENT. " 'EQUAL* ASSUMED. 

EXAMINE STATEMENT REQUIRES 
IDENTIFIER WHOSE USAGE IS 
DISPLAY. FOUND ***** / *****. 
STATEMENT DISCARDED. 

'GO TO' ILLEGAL UNLESS ALTERED. 
STATEMENT DISCARDED. 

OPERAND OF ***** APPEARS IN 
WRONG SEGMENT OF PROGRAM. 
ACCEPTED AS WRITTEN. 

ELSE UNMATCHED BY CONDITION IS 
DISCARDED. 

SET STATEMENT HAS AN ILLEGAL 
OPERAND BEFORE 'TO' OR 
INCOMPATIBLE OPERANDS. OPERAND 
BEFORE 'TO' DISCARDED. 

***** / ***** MAY NOT BE USED 
AS ARITHMETIC OPERAND IN ***** 
STATEMENT. ARBITRARILY 
SUBSTITUTING *****. 



ILA4020I-C SIGN BEFORE ***** IS DISCARDED. 

ILA4021I-W MINUS SIGN FOLLOWED BY SPACE 
ACCEPTED AS REVERSING SIGN OF 
FOLLOWING LITERAL. 

ILAU022I-W EXIT MUST BE SINGLE-WORD 
PARAGRAPH PRECEDED BY A ^ 
PROCEDURE- NAME . STATEMENT 
DISCARDED. 

ILAU023I-E STORE- FIELD WHEN USED IN 

COMPUTATION MUST BE TO NUMERIC 
DATA- NAME. FOUND ***** / 
*♦*♦*, STATEMENT DISCARDED. 

ILAU02UI-E TWO OPERANDS ARE REQUIRED 

BEFORE 'GIVING*. STATEMENT 
DISCARDED. 



ILA4010I-C 



ILAUOllI-E 



ILA4012I-E 



ILA4013I-C 



ILA4014I-E 



ILAU015I-E 



ILA4016I-E 



ILA4017I-E 



ILAU018I-E 



ILA4019I-E 



Appendix F: Diagnostic Messages 229 



ILA4025I-E WRITE AFTER POSITIONING AND 
WRITE BEFORE ADVANCING 
ILLEGALLY USED FOR SAME FILE. 
BEFORE ASSUMED. 



ILAU037I-E SYNTAX REQUIRES PROCEDURE- NAME 
TO FOLLOW 'THRU'. FOUND *****. 
***** OPTION DISREGARDED. 



v.. 



ILA4026I-E 



ILA4027I-C 



***** / ***** IS ILLEGALLY USED 
IN ***** TEST. TEST DISCARDED. 

RIGHT TERM OF A CONDITION MAY 
NOT BE NEGATED. NEGATION IS 
APPLIED TO THE RELATIONAL. 



ILAU028I-C TWO 'NOT'S' IN SUCCESSION 
ILLEGAL. ACCEPTED AS 
CANCELLING EACH OTHER. 



ILA4029I-E 



ILA4030I-E 



ILA4031I-E 



ILA4032I-C 



ILA4033I-C 



ILAUOSUI-C 



ILA4035I-W 



ILAU036I-W 



***** / ***** j^Y NOT BE 
COMPARED WITH ***** / *****. 
TEST DISCARDED. 

FOUND ***** AFTER CONDITION. 
EXPECT »0R«, 'AND*, OR VERB TO 
IMMEDIATELY FOLLOW CONDITION. 
DELETING TILL ONE OF THESE IS 
FOUND. 

PROCEDURE-NAME NOT THAT OF A 
SINGLE GO PARAGRAPH MAY NOT BE 
ALTERED. STATEMENT DISCARDED. 

NO ACTION INDICATED IF 
PRECEDING CONDITION IS TRUE. 
STATEMENT ACCEPTED WITH TRUE 
AND FALSE OUTCOMES IDENTICAL, 

PROCEDURE- NAME WHICH IS THE 
END-OF-RANGE OF A PERFORM 
STATEMENT MAY NOT BE ALTERED. 
STATEMENT DISCARDED. 

GO DEPENDING ON MUST BE 
FOLLOWED BY INTEGRAL IDENTIFIER 
LESS THAN H DIGITS IN LENGTH. 
FOUND *****. STATEMENT 
DISCARDED. 

NO MORE THAN 3 INDEX-NAMES OR 
IDENTIFIERS SHOULD BE VARIED IN 
PERFORM STATEMENT. ACCEPTED AS 
WRITTEN. 



Explanation ; This compiler can 
normally handle a program 
varying more than three . 
data-names, but the practice is 
illegal \mder standard COBOL 
language rules and is not 
recommended. 

PERFORM RANGE IS FROM ***** TO 
***** , WHICH PRECEDES IT. 
ACCEPTED AS WRITTEN. 

Explanation ; This compiler can 
normally handle the perform 
range indicated, but the 
practice is not recommended. 



ILA4038I-E 

ILA4039I-E 

ILAU040I-E 
ILAU041I-E 

ILA4042I-E 

ILA40U3I-W 

ILAUOUUi-C 

ILA4045I-E 
ILA4047I-E 
ILA40U8I-E 

ILA4049I-W 
ILA4050I-E 
ILA4052I-E 

ILA4054I-E 

ILA4055I-C 
ILAU056I-E 
ILAU057I-E 



VARYING OPTION REQUIRES NUMERIC 
IDENTIFIER/INDEX- NAME. FOUND 
LITERAL. ARBITRARILY 
SUBSTITUTING ♦****. 

*****/***** IN VARYING OR TIMES 
OPTION IS NOT NUMERIC. 
ARBITRARILY SUBSTITUTING *****. 

***** FILE ***** MAY NOT BE 
OPENED ***** AND IS DISCARDED. 

SYNTAX REQUIRES 'INPUT', 
• OUTPUT* , OR • I-O* AFTER OPEN. 
FOUND *****. DELETING TILL ONE 
OF THESE IS FOUND. 

SYNTAX REQUIRES FILE-NAME IN 
***** STATEMENT. FOUND **♦**. 
DELETING TILL LEGAL ELEMENT 
FOUND. 

WRITE AFTER ADVANCING AND WRITE 
AFTER POSITIONING ILLEGALLY 
USED FOR SAME FILE. ACCEPTED 
AS WRITTEN. 

*****/***** SHOULD NOT BE MOVED 

TO NUMERIC FIELD. SUBSTITUTING 
*****^ 

CODE OPTION ILLEGAL FOR ON-LINE 
DEVICE. OPTION DELETED. 

READ OR WRITE ILLEGAL FOR LABEL 
RECORDS. STATEMENT DISCARDED. 

USE VERB MAY NOT APPEAR EXCEPT 
IN DECLARATIVES SECTION. 
STATEMENT DISCARDED. 

INAPPROPRIATE OPTIONAL COBOL 
WORDS PRECEDING ***** IGNORED. 

SYNTAX REQUIRES *****. FOUND 
*****, STATEMENT DISCARDED. 

*****/***** M^Y NOT BE T7VRGET 
FIELD FOR *♦***/***** IN ***** 
STATEMENT AND IS DISCARDED. 

SYNTAX REQUIRES SORT- FILE NAME, 
FOUND *****. STATEMENT 
DISCARDED. 

SORT SEQUENCE NOT SPECIFIED. 
ASCENDING ASSUMED. 

SYNTAX REQUIRES *****. FOUND 
♦****. DISCARDED. 

NUMBER OF SORT KEYS EXCELDS 
MAXIMUM OR TOTAL KEY LENGTH 



V.,,.' 



230 



EXCEEDS 256 BYTES. 
DISCARDED. 



♦ **♦* 



ILAU059I-E SORT-KEY MUST BE 

NON-SUBSCRIPTED OR NON-INDEXED 
FIXED-LENGTH DATA-NAME DEFINED 
UNDER AN SD. FOUND ♦**♦♦. 
DISCARDED. 

ILA4060I-C *♦♦** IS NOT A POSITIVE NUMERIC 
INTEGRAL LITERAL OF REQUIRED 
LENGTH. ♦♦♦*♦ OPTION 
DISCARDED. 

ILA4061I-W NEITHER NAMED NOR CHANGED 

SPECIFIED. STATEMENT ACCEPTED. 
WILL BE TREATED AS FORMATTED 
DISPLAY. 



ILA4062I-W 'NAMED CHANGED" 
•CHANGED NAMED" 



ACCEPTED AS 



ILAU063I-W 



ILA4064I-E 



ILA4065I-W 



ILA4066I-E 



ILA4067I-W 



PREVIOUS DEBUG PACKET REFERS TO 
SAME PROCEDURE-NAME. CARD 
DELETED AND FOLLOWING 
STATEMENTS ATTACHED TO 
IMMEDIATELY PRECEDING PACKET. 

4c4.*:tc4c IS NOT A POSITIVE NUMERIC 
INTEGRAL LITERAL OF REQUIRED 
LENGTH. SUBSTITUTING *♦***. 

NUMERIC LITERAL IN EXAMINE 
STATEMENT SHOULD BE UNSIGNED. 
SIGN IGNORED. 

SYNTAX REQUIRES 01 LEVEL SD 
DATA-NAME IN RELEASE STATEMENT. 
FOUND *♦***. STATEMENT 
DISCARDED. 

ALL CHARACTER SHOULD NOT BE 
USED AS LITERAL IN EXAMINE 
STATEMENT. STATEMENT ACCEPTED 
AS WRITTEN. 



ILA4068I-D COMPILER ERROR. PHASE H TRYING 
TO GET DATA ATTRIBUTES FOR 
**♦**. 

ILAU069I-C SYNTAX REQUIRES DEVICE-NAME. 

FOUND ***** IN ***** STATEMENT. 
SYSTEM UNIT ASSUMED. 

ILA4070I-E ***** STATEMENT REQUIRES 
IDENTIFIER WHOSE USAGE IS 
DISPLAY. FOUND SPECIAL 
REGISTER. STATEMENT DISCARDED. 

ILA4071I-E ***** EXCEEDS LEGT^ LENGTH. 
DISCARDED. 

ILA4072I-W EXIT FROM ***** PROCEDURE 
ASSUMED BEFORE *****, 



ILA407UI-C 



ILAU075I-C 



ILA4076I-E 



ILA4077I-E 



ILAU078I-E 



ILAt;079I-E 



ILAU080I-W 



ILAlt081I-C 



ILA4082I-E 



ILA4083I-E 



ILA4084I-C 



ILA4085I-E 



Explanation : The statement 
will be compiled I but its use 
is illegal under standard COBOL 
rules and is not recommended. 



STATEMENT CONTAINS FLOATING 
POINT DATA ITEMS. REMAINDER 
IGNORED. 



•NEXT SENTENCE' ."ILLEGAL AND 
DISCARDED. BOTH ***** AND NOT 
***** WILL CAUSE EXECUTION OF 
NEXT VERB. 

***** REQUIRES ***** LEVELS OF 
SUBSCRIPTING OR INDEXING. 
SUBSTITUTING FIRST OCCURRENCE 
OF ♦****, 

***** MAY NOT BE USED AS A 
SUBSCRIPT SINCE IT REQUIRES 
SUBSCRIPTING ITSELF. 
SUBSTITUTING FIRST OCCURRENCE 
OF *****. 

SUBSCRIPT MUST BE INTEGRAL 
DATA-NAME OR LITERAL. FOUND 
NON- INTEGER *****. 
SUBSTITUTING FIRST OCCURRENCE 
OF *****, 

***** FOUND AMONG SUBSCRIPTS. 
SUBSTITUTING FIRST OCCURRENCE 
OF *****, 

DEBUG CARD MAY NOT REFER TO A 
PROCEDURE NAME WHICH ITSELF IS 
IN A DEBUG PACKET. CARD 
DELETED AND FOLLOWING 
STATEMENTS ATTACHED TO 
IMMEDIATELY PRECEDING PACKET. • 

***** EXCEEDS ***** CHARACTERS. 
UP TO 114 ACCEPTED. 

***** IS NOT DEFINED AS 
SUBSCRIPTED OR INDEXED. 
SUBSCRIPTS DISCARDED. 

OCCURS-DEPENDING-ON-VARIABLE 
MUST BE INTEGRAL 
NON- SUBSCRIPTED DATA-NAME. 
FOUND *****. ARBITRARILY 
SUBSTITUTING *****. 

ILLOGICAL USE OF PARENTHESES 
ACCEPTED WITH DOUBTS AS TO 
MEANING. 

RECORD DESCRIPTION FOR FILE 
***** MISSING OR ILLEGAL. 
STATEMENT DISCARDED. 



r 



ILAU073I-W ***** SHOULD NOT APPEAR IN 

DECLARATIVE SECTION. ACCEPTED 
AS WRITTEN. 



ILA4086I-C ***** CONDITION USED WHERE ONLY 
IMPERATIVE STATEMENTS ARE LEGAL 
MAY CAUSE ERRORS IN PROCESSING. 



Appendix F: Diagnostic Messages 231 



ILAU087I-E 'END DECLARATIVES* :MISSING OR 
MISPLACED. PROGRAM CANNOT BE 
EXECUTED. 



POSITIVE INTEGRAL NUMERIC 
LITERAL. FOUND *****. 
STATEMENT DISCARDED. 



ILAa088I-D COMPILER ERROR. I-C TEXT COUNT 
FIELD 0. SKIPPING TO PHASE 5. 



ILAU089I-W 

ILAU090I-E 

ILA4091I-E 
ILA4092I-W 

ILA4094I-W 



ILA4095I-E 



ILAU096I-W 



ILAU097I-C 



ILAU098I-E 



ILA4099I-E 



ILA4100I-W 



4c****/4t***4c SHOULD NOT BE 
TARGET FIELD FOR ♦**♦*/***** IN 
***** STATEMENT. STATEMENT 
ACCEPTED AS WRITTEN. 

SORT-KEY MUST BE IN FIXED 
POSITION NOT MORE THAN 4092 
BYTES FROM START OF RECORD. 
***** DISCARDED. 



SYNTAX REQUIRES OPERAND. 
***♦♦. TEST DISCARDED. 



FOUND 



ILAUIOII-E 



EXTERNAL DECIMAL NAME USED IN 
TRANSFORM STATEMENT. STATEMENT 
ACCEPTED AS WRITTEN. 

***** IS IN A RECORD OF AN 
APPLY- WRITE-ONLY FILE, AND, 
REFERRING TO IT MAY CAUSE 
ERRORS IF FILE IS OPENED AS 
OUTPUT WHEN ***** STATEMENT IS 
EXECUTED. 

WRITE FROM IDENTIFIER REQUIRED 
FOR *****, TO WHICH WRITE-ONLY 
IS APPLIED. STATEMENT 
DISCARDED- 

***** STATEMENT WILL NEVER BE 
EXECUTED. 

Explanation ; The logic of the 
COBOL source program prevents 
the computer from executing the 
statement noted. The compiler, 
however, accepts the statement 
as written. 

UNIT (REEL) OPTION ILLEGAL FOR 
***♦♦. DISCARDED. 

'ALTER* STATEMENT VIOLATES RULE 
ABOUT REFERENCES TO A GO TO IN 
A DIFFERENT INDEPENDENT 
SEGMENT. IGNORED. 

NO EXIT SPECIFIED BEFORE END OF 
THIS DECLARATIVE SECTION. 
CONTROL WILL FALL THROUGH TO 
NEXT SECTION. 

IDENTIFIER FOLLOWING INTO (FROM) 
IN READ (WRITE) STATEMENT SHOULD 
NOT BE DEFINED UNDER SAME FD AS 
RECORDNAME. ACCEPTED AS 
WRITTEN. 

SET STATEMENT REQUIRES OPERAND 
AFTER 'UP* OR 'DOWN* TO BE 
NUMERIC INTEGRAL DATANAME OR 



ILA4102I-E SET STATEMENT REQUIRES OPERAND 
AFTER 'TO* :T0 BE INDEX NAME, 
INDEX DATA ITEM, NUMERIC 
LITERAL, DATA NAME, OR POSITIVE 
INTEGRAL NUMERIC LITERAL. 
FOUND ***** . STATEMENT 
DISCARDED. 

ILAai03I-C 'ALL* : MUST BE FOLLOWED BY 

ALPHANUMERIC LITERAL. FOUND 
*****, DISCARDING 'ALL*. 

I ILAUIOUI-E (SEARCH OR) SEARCH ALL 
STATEMENT HAS EITHER 
SUBSCRIPTED OR INDEXED 
IDENTIFIER- 1 OR ILLEGAL 
OPERAND. SCANNING TILL 'AT 
END' : OR 'WHEN'. DELETING TILL 
ONE OF THESE IS FOUND. 

ILAtH05I-E DATA-NAME CANNOT BE BOTH 

INDEXED AND SUBSCRIPTED IN 
***** STATEMENT. SUBSCRIPTS 
DISCARDED. 

ILA4106I-E DATA-NAME MUST BE INDEXED BY 
INDEX NAME OR INDEX NAME PLUS 
OR MINUS AN INTEGRAL NUMERIC 
LITERAL. SUBSTITUTING FIRST 
OCCURRENCE OF *****. 

ILA4108I-E CALLED PROGRAM MAY NOT BE 

SEGMENTED. ENTRY STATEMENT 
IGNORED. 

ILA4109I-E KEY IN SEARCH- ALL FLOATING 

POINT OR STERLING. STATEMENT 
CHANGED TO SEARCH STATEMENT. 

ILA4110I-E CONDITION IN SEARCH ALL 

STATEMENT TESTS KEY WITHOUT 
TESTING ALL PRECEDING KEYS. 
STATEMENT DISCARDED. 

ILA4111I-E INVALID CONDITION OR INVALID 
FORMULA IN CONDITION IN 
SEARCH-ALL STATEMENT. 
STATEMENT DISCARDED. 

ILAU112I-W SET UP OR DOWN SHOULD NOT 

INCREMENT INDEX- NAME BY INDEX 
DATA ITEM. ACCEPTED AS 
WRITTEN. 

ILA4113I-C BEFORE OR AFTER ADVANCING OR 

AFTER POSITIONING REQUIRED FOR 
*****. ASSUMING *****. 

ILA4114I-C INVALID ADVANCING/POSITIONING 
OPTION. 1 LINE ASSUMED. 

ILA4115I-C 'AFTER POSITIONING* EXPECTED 
BUT NOT FOUND. ASSUMED 
PRESENT. 



232 



Lj 



ILA4116I-E 

ILA4117I-C 

ILAU118I-C 

ILA4119I-C 

I ILA4120I-C 

ILA5001I-D 

ILA5002I-D 

ILA5003I-C 
ILA500t|I-W 
ILA5005I-D 
ILA5006I-D 

ILA5007I-D 

ILA5008I-D 

ILA5009I-D 

ILA5010I-C 
IIA5011I-W 
ILA5012I-D 

ILA5013I-C 

ILA5014I-E 



ILLEGAL TO ***** FILE *****. 
STATEMENT DELETED. 



***** CLAUSE MISSING. 
NEXT SENTENCE USED. 



4c 4c*** 



NO REWIND IS AN INVALID OPTION 
FOR FILE *****. IGNORED. 

INVALID FILE-TYPE FOR START 
VERB. STATEMENT DISCARDED. 

REWRITE LEGAL ONLY FOR *D» ."AND 
•W* DIRECT FILE. ACCEPTED AS 
• WRITE •. 

ERROR OCCURRED WHILE TRYING TO 
ASSIGN A DOUBLE REGISTER. 
COMPILATION ABANDONED. 

ERROR OCCURRED WHILE PROCESSING 
A SUBSCRIPTED OR INDEXED 
DATA-NAME. COMPILATION 
ABANDONED. 

DIVISOR IS ZERO. RESULT WILL 
BE ALL 9'S. 

ALPHANUMERIC SENDING FIELD TOO 
BIG. 18 LOW ORDER BYTES USED. 

ERROR OCCURRED WHILE PROCESSING 
A MOVE. COMPILATION ABANDONED. 

UNEXPECTED INPUT TO THE MOVE OR 
STORE PROCESSOR. COMPILATION 
ABANDONED. 

UNEXPECTED INPUT TO THE 
ARITHMETIC CODE GENERATOR. 
COMPILATION ABANDONED. 

UNEXPECTED INPUT TO THE 
FLOATING-POINT ARITHMETIC 
ROUTINE 'FBCVBH'. COMPILATION 
ABANDONED. 

LOST SUBSCRIPT OR INDEX ID IN 
TABLE 'XSSNT*. COMPILATION 
ABANDONED. 

HIGH ORDER TRUNCATION OF THE 
CONSTANT DID OCCUR. 

HIGH ORDER TRUNCATION MIGHT 
OCCUR. 

LOST INTERMEDIATE RESULT 
ATTRIBUTES IN 'XINTR* TABLE. 
COMPILATION ABANDONED. 

ILLEGAL COMPARISON OF TWO 
NUMERIC LITERALS. STATEMENT 
DISCARDED. 

KEY IN SEARCH ALL AT INVALID 
OFFSET. STATEMENT DISCARDED. 



ILA5015I-E INVALID USE OF SPECIAL 

REGISTER. STATEMENT DISCARDED. 

ILA5016I-E MORE THAN 255 SUBSCRIPT ADDRESS 
CELLS USED. PROGRAM CANNOT 
EXECUTE CORRECTLY. 

I ILA5017I-C INVALID ADVANCING CLAUSE OPTION 
FOR A DTFCD FILE. USING 
STACKER 1. 

j ILA5018I-C INTEGER IN POSITIONING CLAUSE 
NOT BETWEEN AND 3. 
1 ASSUMED. 

ILA5019I-C PUNCH STACKER SELECT SPECIFIED 
FOR A DTFPR FILE. USING "SKIP 
TO CHANNEL 1". 

ILA5020I-C IDENTIFIER IN EXHIBIT EXCEEDS 
MAXIMUM. TRUNCATED TO 120 
CHARACTERS. 

ILA5021I-C INTEGER IN ADVANCING OR 
POSITIONING CLAUSE NOT 
POSITIVE. POSITIVE ASSUMED. 

ILA5022I-C MORE THAN 2-DIGIT INTEGER IN 
ADVANCING CLAUSE. USING 
INTEGER-1. 

ILA5023I-E EOP INVALID FOR DOUBLE-BUFFERED 
FILE. IGNORED. 

ILA502UI-E END OF PAGE OPTION REQUESTED 
FOR NON-DTFPR FILE. IGNORED. 

ILA5025I-C ADVANCING OR POSITIONING OPTION 
ILLEGAL FOR NON- SEQUENTIAL 
FILE. IGNORED. 

ILA5026I-C EXHIBIT CHANGED OPERAND GREATER 
THAN 256 BYTES. LENGTH OF 256 
ASSUMED. 



The following messages may be 
interspersed in phase 6 output. 



ILA6003I-D ERROR FOUND PROCESSING FU TEXT. 
UNKNOWN DATA A-TEXT CODE. 

ILA6005I-D ERROR FOUND PROCESSING Fl TEXT. 
COMPILATION ABANDONED. 

ILA6006I-E MAP SUPPRESS SPECIFIED AND 
E-LEVEL DIAGNOSTIC HAS 
OCCURRED. LISTX, LINK, CLIST 
I AND DECK WILL BE IGNORED. 

ILA6007I-D TABLE HAS EXCEEDED MAXIMUM 

SIZE. PMAP, LOAD MODULE AND 
DECK WILL BE INCOMPLETE. 



The following messages are issued on 
SYSLOG and SYSLST during an FCOBOL 



Appendix F: Diagnostic Messages 233 



compilation. They are printed on SYSLST 
with the prefix ILA. 



ClOOI 



CIOII 



C102I 



C103I 



C104I 



BACKGROUND AREA IS LESS THAN 
54K. 



Explanation ; At least 54K is 
required to compile using 
FCOBOL. 



User Response ; Allocate at 
least 54K to the backgroxind 
partition. 

DEVICE NOT ASSIGNED - SYSnnn. 



Explanation : nnn is either 
001, 002, 003, or OOU. The 
specified logical unit is 
unassigned and must be 
assigned. 



User Response ; Make sure that 
the assignment is made. 

UNSUPPORTED DEVICE TYPE - 
SYSnnn. 



Explanation ; nnn is either 
001, 002, 003, or OOU. The 
specified file must be a disk 
file if SYSOOl, or a tape or 
disk file if SYS002 through 
SYS004. 

User Response ; Make the 
correct assignment. 

END OF FILE ON SYSIPT. 

Explanation ; End-of-file was 
encountered in the 
initialization phase - no 
source language was found. 

User Response ; Check the 
source module for embedded /* 
(slash asterisk) cards or 
missing source cards. 

WARNING. SYSOOl FILE IS TAPE. 

Explanation ; In small, simple 
programs that do not require 
dictionary spill, it is 
sometimes possible to compile 
with the spill file (SYSOOl) 
assigned to tape. However, if 
any spill does occur, an 
input/output error may occur. 

User Response ; Reassign SYSOOl 
to a disk file. 



OBJECT TIME MESSAGES 



The following messages are normally 
issued on SYSLOG. 

CllOA STOP literal 



Explanation ; The programmer 
has issued a STOP literal 
statement in the FCOBOL 
program. 



User Response : Operator should 
respond with end-of-block, or 
with any character in order to 
proceed with the program. 

ClllA AWAITING REPLY 

Explanation : This message is 
issued in connection with the 
FCOBOL ACCEPT Statement. 

User Response : The operator 
should reply as specified by 
the programmer. 

The following messages are issued on 
SYSLOG and SYSLST prior to cancellation of 
the job. If the DUMP option is specified, 
a partial dump is taken from the problem 
program origin to the highest core location 
of the last phase loaded. When this 
occurs, the eight bytes immediately 
preceding the DTF are destroyed. The 
messages have the form; 

Cmmml SYSnnn filename dtfaddress text 

where mmm and text correspond as follows : 

mmm text 

112 DATA CHECK 

113 WRONG LENGTH RECORD 

114 PRIME DATA AREA FULL 

115 CYLINDER INDEX FULL 

116 MASTER INDEX FULL 

117 OVERFLOW AREA FULL 

118 DATA CHECK IN COUNT 

119 DATA CHECK IN KEY OR DATA 

120 NO ROOM FOUND 

121 DASD ERROR 

122 DASD ERROR WHILE ATTEMPTING 

TO WRITE RECORD ZERO 

123 FILE CANNOT BE OPENED AFTER 

CLOSE WITH LOCK 

Explanation ; Condition 
indicated occurred on SYSnnn, 
filename is 7 characters in 
length and is the file-name as 
generated in the SELECT 
sentence, and dtfaddress is the 
hexadecimal address of the 
file's DTF table. 



r 



234 



User Response : Rerun the job 
or add a user declarative 
section to the Procedure 
Division to handle errors 
within the program. 

124 CYLINDER AND MASTER INDEX 

TOO SMALL 

125 NO EXTENTS 



Explanation ; During CLOSE UNIT 
processing, no extent is found 
for the next volume. 



User Response ; Rertm job with 
proper EXTENT (XTENT) 
statements . 



The following message is issued on 
SYSLOG: 



User Response ; The operator 
must respond either with N if 
it is not the last reel, or 
with Y if it is the last reel. 



COBOL Object Program Unnumbered Messages 



XXX. . . 



Explanation ; This message is 
written on the console and is 
recognizable because it is not 
preceded by a message code and 
action indicator. It is issued 
by an object program originally 
coded in COBOL. The message 
text is supplied by the object 
program and may indicate 
alternative action to be taken. 



C126D 



r ""^ 



IS IT EOF? 



Explanation ; A tapemark was 
just read on an unlabeled tape 
file described at compilation 
time as having more than one 
reel. 



System Action : 
continues. 



The job 



Operator Response ; Operator 
response, if any is needed, is 
determined by the message text. 



Appendix F: Diagnostic Messages 235 



r-- 



APPENDIX G: MACHINE CONSIDERATIONS 



This appendix contains information 
concerning system requirements for the DOS 
American National Standard COBOL compiler, 
execution time considerations, and the Sort 
Feature. Additional information used in 
estimating the main and aiixiliary storage 
requirements is contained in the publication 
IBM System/360 Disk Operating System : 
performance Estimates , Form GC24-5032. 



Note ; All devices currently supported by 
IBM System/360 Disk Operating System COBOL 
are supported by IBM System/360 Disk 
Operating System American National Standard 
COBOL, 



EXECUTION TIME CONSIDERATIONS 



The amount of main storage must be 
sufficient to accomodate at least: 



MINIMUM MACHINE REQUIREMENTS FOR THE 
COMPILER 



• The selected control program 

• Support for the file processing 
techniques used 



r'"^ 



1. At least a System/360 Model 30. The 
compiler also operates on Models 40, 
50, 65, 67 (in 65 mode), or 75. A 
minimum of 5 UK bvtes of main storage 
is required except when using the 
Report Writer Feature. This 
necessitates a minimum partition size 
of 8 OK b vtes. " 

2. Four utility data sets on 2U00 Tape 
Units, 2311 Disk Drives, or 2314 Disk 
Storage Facility. At least one 
utility data set as well as the 
operating system must reside on a mass 
storage device (i.e., a 2311 or 2314). 
If the three remaining utility data 
sets reside on tape, there must be a 
separate tape unit for each data set. 
If they reside on a mass storage 
device, there must be enough space on 
that device. 

Utility data set assignments must be 
made as follows: 

SYSOOl - disk unit 
SYS002 - disk or tape unit 
SYS003 - disk or tape unit 
SYS004 - disk or tape unit 

3. A device, such as a printer keyboard, 
for direct operator communication. 

4. A device, such as a card reader, for 
the job input stream. 

5. A device, such as a printer or tape 
unit, for system output files. 

6. The commercial instruction set, and 
floating-point arithmetic feature, if 
floating-point literals or 
calculations are used. 



• Load module to be executed 



SORT FEATURE CONSIDERATIONS 



The Sort/Merge program must be executed 
under control of the Disk Operating System. 
The program reqmres the following minimu m 
machine configuration: — — ~ . 



1. 16K (16,384) bytes of main storage if 
the program is to use IBM 2400 Series 
Magnetic Tape Units or IBM 2311 Disk 
Storage Drives for intermediate 
storage. The Sort/Merge program uses 
10,240 bytes; an additional 6K bytes 
are needed for the Disk Operating 
System and user-written routines. 

2. 32K (32,768) bytes of main storage if 
the program is to use the IBM 2314 
Direct Access Facility for 
intermediate storage. The Sort/Merge 
program uses 22,528 bytes; an 
additional lOK bytes are needed for 
the Disk Operating System and 
user-written routines. 

Note: Performance increases 
significantly if 50K is available for 
operation of the Sort/Merge program. 
At the 10 OK level, the performance is 
very high. 

3. Standard instruction set. 

4. One 2311 or 2314 disk iinit attached to 
one selector channel for soirt input, 
output, and work files. (System 
residence requirements may necessitate 
having an additional disk storage unit 
for sorting. ) 



Appendix G: Machine Considerations 237 



5. One IBM 1403 and 1U43 Printer, or one 
IBM 1052 Printer Keyboard, 

6. One IBM IHHI, 2501, 2520, and 2540 
Card Reader, or one IBM 2400 Series 
Magnetic Tape Unit (7- or 9-track) 
assigned to SYSIPT and SYSRDR. 

7. Three IBM 2400 Series Magnetic Tape 
Units for work files when tape units 
are to be used for intermediate 
storage. 

8. One IBM 2400 Series Magnetic Tape Unit 
if tape input/output is to be used. 



When tape units are used for 
intermediate storage, five input/output 
devices are required as the minimum for a 
sorting operation (one input, three work, 
one output) . When disk units are used for 
intermediate storage, three extents are 
required (one input, one work, one output). 



Three extents are required as a minimum 
for a disk merging operation (two input, 
one output). A one-way merge, which simply 
copies the input file, may be executed with 
two tape units or one disk unit. 



^.-- 



238 



APPENDIX H: COMMUNICATION REGION 



J 



COMMUNICATION REGION 



iUe-byte 
3or used 



-cv* 



The Communication Region is a| 
storage area within the Supervisc^r used -ijy 
the Supervisor and the COBOL compiler. The 
structure of the Communication Region is 
illustrated in Figure 58. 



Fields in the Comm\inication Region are 
addressed relative to the first byte of the 
region. An asterisk (*) identifies the 
fields available to the COBOL user. 



Byte(s) 
0-7* 



8,9 



V, 



Meaning 
Calendar date supplied during the 
IPL procedure or by the DATE 
control statement. This field 
can be used for dating printed 
output of the COBOL program via 
the special register 
CURRENT- DATE. The date can be 
in one of two forms: mm/dd/yy 
or dd/mm/yy where iran is month, dd 
is day, and y^ ^s year. The form 
is chosen by the installation at 
system generation time. 



Address of the backgroxind program 
label area. 



10,11 Reserved for control program use. 

12-22* User area for inter-program or 
intra-program communication. 
This field can be referenced in a 
COBOL program executing in the 
background via the special 



Byte ( s ) Meaning 

register COM- REG. All eleven 
bytes are initialized to binary 
zeros when a JOB control 
statement is encountered. 

23* User program switch indicators 
(UPSI). The condition-name 
associated with the status of the 
UPSI switches can be specified in 
the COBOL program via the 
Special-Names paragraph of the 
Environment Division. UPSI byte 
switches are set by the UPSI 
control statement. The 
condition- name associated with 
each may be tested in the 
Procedure Division of the COBOL 
program. UPSI byte switches are 
initialized to binary zeros when 
a JOB control statement is 
encountered. 

24-31 Jobname for background programs 

located in the operand field of 
the JOB control statement. 

32-35 Address of the uppermost byte of 
the background program area. 

36-39 Address of the uppermost byte of 
the last phase loaded into the 
background program area. 

UO-43 Address of the uppermost byte used 
in loading any phase of the 
background program. 

44, 45 Length of the background program 
label area. 



Bytes 





c 


















Date 


<0 

§ 




User Area 




Job Nome 




E 





< 




^ 






^^ 






Ji 


? 


1 


Mo/DayAr 


s 

1 

o 




(inter -or Intrcprogram 


a. 
3 


( Entered from 


E 


I 


^ E 
1% 


3 


or 


Reserved 


Communication) 


1 
o 


Job Control) 


IB 
o 


b 
U 


"s i 


a. 


Doy/MoAr 


*» 










o 





!? 


E 




^ 






E 




>> o 


t:.9! 


x"^ 


ji 




o 










CO 0) 


a> o 




1: 










8" 




ti< 


t!^ 


t;^ 






ddress: 
rst byt 
rea 






a. 




ddress: 
ppermo 
rogram 


ddress: 
ppermo 
rogram 


ddress: 
ppermo 
lose of 


o 

JC 




<M.< 










< 3 a. 


< Do. 


< 3 Q. 


J 


7 


8 9 


10 11 


12 22 


23 


24 31 


32 35 


36 39 


40 43 


44 45 


i 





















Address of first 
byte supplied in 
register 1 by 
COMRG 

Figure 58. Commtinication Region in the Supervisor 



Appendix H: Communication Region 239 



r"- 



APPENDIX I: SAMPLE JOB DECKS 



This appendix illustrates the necessary 
job control statements and their sequence 
for five typical programs: 

1. Creating a Direct File 

2. Retrieving and Updating a Direct File 

3. Creating an Indexed File 

4. Retrieving and Updating an Indexed 
File 

5. Sorting an Unlabeled Tape File 



The DLBL control statememt for a labeled 
file on a mass storage device must contain 
the same name as system-name. This is the 
name by which the file is known to the 
control program. (The name field of 
system-name is optional. If name is 
omitted, the DLBL statement must specify 
the logical unit (SYSnnn) as the 
file-name. ) The code field of the DLBL 
statement must correspond to the class and 
organization fields of system-name as 
follows : 



V. 



In all five programs the programmer has 
requested the following compiler options 
through the OPTION control statement: 

NODECK — No punched card output for 
the object program is 
needed. 

LINK — The object module is to be 
linkage edited. 

LIST — The COBOL source statements 
are to be printed on SYSLST. 

LISTX — A Procedure Division map is 
to be printed on SYSLST. 

SYM — A Data Division map is to be 
printed on SYSLST. 

ERRS — The diagnostic messages of 

the COBOL compiler are to be 
printed on SYSLST. 

The EXEC FCOBOL statement calls for 
execution of the FCOBOL compiler. 

By using the CBL card, the programmer 
indicates that in this source program the 
quotation mark (") is used for nonnumeric 
literals. 

The ASSIGN clause in the COBOL source 
program specifies a system-name with the 
following fields: 

SYSnnn-class-device-organization- [name] 

The ASSGN control statement for a file 
must specify the same logical \init as the 
SYSnnn field of system-name. The ASSGN 
statement assigns the logical unit to a 
specific hexadecimal address. The address 
specified must be associated with the 
device whose number is given in the device 
field of system-name. 



DLBL 
"code" 


1 . 


ASSIGN 
"class" 


I 


ASSIGN 
" organization" 


SD 


T 


DA or UT 


1 


S 


DA 




DA 




A or U, D or 


ISC 




DA 




I 


ISE 




DA 




I 



The first EXTENT control statement for a 
file on a mass storage device must specify 
the same logical unit as the SYSnnn field 
of system- name. (Subsequent EXTENT 
statements for the same file, if they 
immediately follow the first, may omit this 
field. ) The type of the extent must be 
compatible with the organizatio n field of 
system-name as follows: 



EXTENT 
"type" 



(data area, no 
split cylinder) 



(overflow area for 
indexed file) 



(index area for 
indexed file) 



(data area, split 
cylinder) 



ASSIGN 
" organization" 



S, A, U, I, D, W 



S, A, U, I, D, W 



Appendix I: Sample Job Decks 2U1 



DIRECT FILES 



The following two examples illustrate 
the job control statements necessary for 
programs that create and update a direct 
file. 

In the COBOL source programs, the 
programmer has written: 

SELECT DA- FILE ASSIGN TO 
SYS015-DA-2311-A-MASTER. . . 

SELECT CARD-FILE ASSIGN TO 
SYS007-UR-2540R-S, . . 



(Note that in the EXTENT statement, the 
relative track number (1020) is not 
required for the input DA file of the 
updating program, since the system will use 
the file labels for this information. ) 



The EXEC statement begins execution of 
the problem program, and is followed by 
input data. 



The /* statements indicate end-of-data, 
the /& statement indicates end -of -job. 



In the READFILE source program, the 
programmer has written: 

SELECT PRINT-FILE ASSIGN TO 
SYS008-UR-2U03-S. . . 



(Note the relationship between the 
system-names in the source programs and the 
control statements . ) 



Creating a Direct File 



// JOB CREATEDA 

// OPTION NODECK, LINK, LIST, LISTX, SYM, ERRS 
// EXEC FCOBOL 
CBL QUOTE 



{COBOL source deck} 



The LBLTYP statement defines the amount /* 
of storage to be reserved to process labels 
for the DA file. The file has one extent. 



The EXEC LNKEDT Statement causes the 
object program to be linkage edited. 

An ASSGN control statement assigns 
logical unit SYS007 to the hexadecimal 
address OOC — a 2540R Card Reader. 

In the updating program, another ASSGN 
statement assigns logical unit SYS008 to 
the hexadecimal address OOE — a 1403 
Printer. 

The next series of statements identify 
the direct file completely. 

The ASSGN statement identifies the file 
as residing on logical unit SYS015, which 
has the hexadecimal address of 192 — a 
2311 Disk Drive. 



// LBLTYP NSD(Ol) 
// EXEC LNKEDT 
// ASSGN SYS007,X»00C» 
I // ASSGN SYS015,X»192» 
// DLBL MASTER, 70/365, DA 
// EXTENT SYS015, mill, 1,0, 1020, 100 
// EXEC 



V 



{input data cards} 



/* 
/g 



The DLBL statement specifies the 
filename as MASTER, with an expiration date 
of the 365th day of 1970, and that the file 
has direct organization (DA) . 

The EXTENT statement specifies that the 
file residing on logical unit SYS015 has a 
serial number 111111, that the extent is a 
data area with no split cylinder and that 
this is the first (and only) extent for the 
file (type and sequence number 1,0), that 
the file begins on relative track 1020 
(track of cylinder 102), and that the /* 
file occupies 100 tracks. /g 



Retrieving and Updating a Direct File 



// JOB READFILE 

// OPTION NODECK, LINK, LIST, LISTX, SYM, ERRS 
// EXEC FCOBOL 
CBL QUOTE 

{COBOL source deck} 
/* 

// LBLTYP NSD(Ol) 
// EXEC LNKEDT 
// ASSGN SYS007,X'00C* 
// ASSGN SYS008,X»00E* 

// ASSGN SYS015,X»192» 

// DLBL MASTER, 70/365, DA 

// EXTENT SYS015, mill, 1,0,1020,100 



{input data cards} 



r 

V 



242 



c 



INDEXED FILES 



The following two examples illustrate 
the job control statements necessary for 
programs that create and update an indexed 
file. 

In the CREATEIS source program, the 
programmer has written: 

SELECT IS-FILE ASSIGN TO 

SYS015-DA-2311-I-MASTER 
ACCESS IS SEQUENTIAL 
RECORD KEY IS REC-ID. 

In the RANDIS so\arce program, the 
programmer has written: 

SELECT IS-FILE ASSIGN TO 

SYS015-DA-2311-I-MASTER 
ACCESS IS RANDOM 
NOMINTO. KEY IS KEY- ID 
RECORD KEY IS REC-ID. 

SELECT PRINT-FILE ASSIGN TO 

SYS008-UR-1403-S 
RESERVE NO ALTERNATE AREAS. 

In both source programs, he has written: 

SELECT CARD-FILE ASSIGN TO 
SYS007-UR-2540R-S. 

I-O- CONTROL. 

APPLY MASTER- INDEX TO 2311 ON IS-FILE. 

(Note the relationship between the 
source program statements and the job 
control statements. ) 

The LBLTYP statement defines the amount 
of storage reserved to process lables for 
the indexed file. The file has three 
extents: a master index extent, a cylinder 
index extent, and a data extent. 

The EXEC LNKEDT statement causes the 
object module to be linkage edited. 

An ASSGN control statement assigns 
logical unit SYS007 to the hexadecimal 
address OOC — a 2540R Card Reader. 

In the retrieval program, another ASSGN 
statement assigns logical unit SYS008 to 
the hexadecimal address OOE — a 1403 
Printer. 

The next ASSGN statement assigns logical 
unit SYS 015 to the hexadecimal address 193 
— a 2311 Disk Drive. 

The DLBL statement names the tile as 
MASTER, and indicates the expiration date 
as the 365th day of 1970. In the file 
creation program, the file label is indexed 
sequential using Load Create (code ISC) ; in 



the retrieval program, the file label is 
indexed sequential using Load Extension, 
Add or Retrieve (code ISE). 



The first EXTENT statement is identified 
as a master index (type and sequence 
numbers are 4,0), and the relative track is 
1800 (the extent begins on cylinder 180 
track 0), and the extent is 10 tracks long. 



The second EXTENT statement is 
identified as a cylinder index (type and 
sequence number are 4,1), the relative 
track is 1810 (the extent begins on 
cylinder 181, track 0), and the extent is 
10 tracks long. 



(Note that the extents assigned to 
master and cylinder indexes must be 
contiguous, and that the master index must 
precede the cylinder index on the disk 
pack. Also note, that if a master index is 
not requested, the first extent is that for 
the cylinder index, which would be type 4, 
sequence number 1. ) 



The third EXTENT statement is identified 
as a data area (type 1) and is the third 
extent named for this file. The relative 
track is 0010 (the extent begins on 
cylinder 1, track 0) , and the extent is 
1750 tracks long. 



End-of-data is indicated with the /* 
statement; end-of-job is indicated with the 
/S statement. 



Creating an Indexed File 



// JOB CREATEIS 

// OPTION NODECK, LINK, LIST, LISTX,SYM, ERRS 
// EXEC FCOBOL 
CBL QUOTE 

{COBOL so\irce deck} 
/* 

// LBLTYP NSD(03) 
// EXEC LNKEDT 
// ASSGN SYS007,X»00C« 
// ASSGN SYS015,X"193' 
// DLBL MASTER, 7 0/3 6 5, ISC 
// EXTENT SYS015,111111, 4, 0,1800,10 
// EXTENT SYS015, mill, 4, 1,1810, 10 
// EXTENT SYS015, 111111,1, 2, 0010, 1750 
// EXEC 



/♦ 
/g 



{input data card} 



Appendix I: Sample Job Decks 243 



Retrieving and Updating an Indexed File 



// JOB RANDIS 

// OPTION NODECK, LINK, LIST, LISTX,SYM, ERRS 

// EXEC FCOBOL 

{COBOL source deck> 
// LBLTYP NSD(03) 
// EXEC LNKEDT 
// ASSGN SYS007,X'00C» 
// ASSGN SYS008,X'00E» 
// TISSGN SYS015,X»193* 
// DLBL MASTER, 70/365, ISE 
// EXTENT SYS015,111111,4,0,1800, 5 
// EXTENT SYS015, 111111, 4, 1,1810, 10 
// EXTENT SYS015,111111, 1,3,0010, 1750 
// EXEC 



/* 
/S 



{input data cards} 



FILES USED IN A SORT OPERATION 



The following example illustrates the 
job control statements necessary for a 
program that sorts an unlabeled tape file. 

In the COBOL so\irce program, the 
programmer has written: 

SELECT NET- FILE- IN ASSIGN TO 
SYS007-UT-2400-S. 

SELECT NET-FILE-OUT ASSIGN TO 
SYS008-UT-2400-SL. 

SELECT NET-FILE ASSIGN TO 3 
SYS001-UT-2400-S. 

NET- FILE- IN is the input file; 
NET- FILE-OUT is the output file; NET- FILE 
is the sort work file, which utilizes three 
tape units. 



(Note the relationship between the 
system-names in the COBOL source program 
and the control statements. ) 



The EXEC LNKEDT Statement causes the job 
to be linkage edited. 

The first two ASSGN control statements 
assign the logical unit SYS007 to 
hexadecimal address 181, and logical unit 
SYS008 to hexadecimal address 182. SYS007 
is the sort input file, and SYS008 is the 
sort output file. 

The last three ASSGN statements assign 
logical unit SYS 001 to hexadecimal address 
183, logical unit SYS002 to hexadecimal 
address 281, and logical unit SYS003 to 
hexadecimal address 282. SYSOOl, SYS002, 
and SYS003 are the logical units that must 
be used for sort work files. The sort work 
files must be assigned to 9-track tape 
units. At this installation, 9-track tape 
drives are associated with hexadecimal 
addresses 183, 281, and 282. 



Sorting an Unlabeled Tape File 



// JOB SORTCOB 

// OPTION NODECK, LINK, LIST, LISTX,SYM, ERRS 
// EXEC FCOBOL 
CBL QUOTE 

{COBOL source deck} 
// EXEC LNKEDT 
// ASSGN SYS007,X»181« 
// ASSGN SYS008,X*182' 
// ASSGN SYSOOl, X*183« 
// ASSGN SYS002,X*281* 
// ASSGN SYS003,X»282» 
// EXEC 
/& 



r 



//-' 



/' 



2U4 



INDEX 



(Where more than one page reference is given, the major reference appears first.) 



* 


21 


/* 


15 


/£ 


25 



c 



abnormal termination 54-57 
ACCEPT statement 78 

subroutines 212, 211 
accessing a direct file 109-127 
randomly 110-111 
sequentially 110 
accessing an indexed file 127-131 
randomly 130-131 
sequentially 130 
accessing a sequential file 109 
actual key 111-127 

actual track addressing 
111-115,125-127 

sample program 115-119 
relative track addressing 111-113 
sample program 120-124 
ACTUAL KEY clause 111-112 
actual track addressing 111-115,125-127 

sample program 115-119 
ADD statement 46 
adding records to an indexed file 

128-129,130-131 
adding source statements to a book 46 
addressing direct files 
actual track addressing 
111-115,125-127 

sample program 115-119 
relative track addressing 111-1±3 
sample program 120-124 
ALTER statement 

in a called program 81 
APOST option 36 
application programs 12 
APPLY EXTENDED- SEARCH clause 110 
APPLY WRITE-ONLY clause 157 

programming technique 165 
arguments ^ 

passed to a called assembler language 

program 84-85 
passed to a called COBOL program 
81,82-83 
arithmetic subroutines 214 
assembler language routine for 
accomplishing overlay 88-89 
assembler language subprograms 83-87 
assembler sublibrary of source statement 

library 43 
ASSGN control statement 22-23,20 
ASSIGN clause 19, 20 
assigning storage for compiler work file 

buffers 36 
assignment of input/output devices 19-20 
asterisk (*) 21 
AUTOLINK 40 



Automatic Library Look-Up (AUTOLINK) 
and ENTRY control statement 40 
and PHASE control statement 39 

auxiliary subroutines 212 



background program 12 

label area 239 
BASIS card 48-49,43 

used for debugging 
batched- job mode 12 
binary items 173-174 
BKEND control statement 
block descriptor field 
block-length field 

V-mode records 154 
books in the source statement library 

cataloging 43-44 

retrieving 44-45 

updating 45-47 



40 



54 



44 
157 



braces 21 
brackets 21 
BUF option 36 
biiilding tables 



186 



CALL statement 81-82 

in segmented program 99 
called program 81 
calling an assembler language subprogram 

84-87 
calling and called programs 81-93 
calling program 81 
capacity records 109-110 
CATAL option 34, 41 
cataloging 

a book 43-45 

a module 42-43 

a program phase 41-42,37,39 

a segmented program 101 
CATALR control statement 42 
CATALS control statement 43 
CBL statement 36-37 
checking standard labels 148,150 

DLAB control statement 29 

DLBL control statement 26 

TLBL control statement 25 

TPLAB control statement 30 

VOL control statement 28-29 
checkpoint subroutine 214, 65 
checkpointing a COBOL program 64-66 
checkpoints during a sort operation 97 

control statement requirements 65 
CHKPT macro instruction 65 
class test subroutine 215 
CLIST option 36 
CLOSE control statement 24 
CLOSE UNIT subroutine 212 
CLOSE WITH LOCK subroutine 211 
COBOL option card (CBL card) 36-37 



Index 245 



COBOL sublibrary of source statement 

library 43 
conunent control statement 21 
comments in job control statements 21 
comments on the phase map 77 
Communication Region 239 

DATE control statement 2tt 
compare subroutines 214 
compilation 17, 11 

options for 36-37,33-34 

work files recpiired for 236 
compile and edit job 14 
compile, edit, and execute job 14 
compile-only job 14 
compiler diagnostic messages 217-235,74 

generation of 64 

working with 64 
compiler-generated card number 

on diagnostic messages 74 

on object code listing 73 

on source statements 67 
compiler machine requirements 237 
compiler options 

CBL card 36-37 

OPTION control statement 33-34 
compiler output 67-75 
completion codes from sort program 97 
computational items 

conversions involving 169-171 

internal representation of 172-174 

special considerations for 172 
COMPUTE statement 

programming technique 176 

subroutines 214 
COM- REG 239 

condensed object listing 36 
continuation of job control statements 21 

DLAB control statement 29 

TPLAB control statement 30 
control fields 

S-mode records 157 

V-mode records 154 
control footings and page format 180 
control program 11 
control sections 39 
conversion subroutines 212-213 
converting elementary data items 169-171 
converting track addresses 

in a COBOL source program 
relative to actual 115 

in EXTENT control statement 
actual to relative 27 
relative to actual 27 
copy function of Librarian 41 
COPY statement 44-45 
core image directory 41 
core image library 41-42,37,39 
correspondence of arguments and parameters 

assembler language subprograms 84 

COBOL subprograms 82-83 
creating a direct file 110-111 

actual track addressing 
111-119,125-126 

sample program 115-119 

relative track addressing 
111-113,120-124 

sample program 120-124 

sample job decks 241-242 



creating an indexed file 130 
sample job deck 243,241 

creating standard mass storage file 
labels 149-150 

DLAB control statement 29 
DLBL control statement 26 
PARSTD option 34 
STDLABEL option 34 

creating standard tape file labels 
144,145-149 

PARSTD option 34 
STDLABEL option 34 
TLBL control statement 25 
TPLAB control statement 30 

creating user labels 148-149,144 
USRLABEL option 34 

cross-reference dictionasry 74 

CURRENT-DATE 239,25 

cylinder index 128 

cylinder overflow area 128 



data, locating in a dump 57 
data extents 

direct files 27, 30 

indexed files 27,30 
data files 17 

data format conversion 169-171 
data formats in the computer 172-174 
data management 108,17 
DATE-COMPILED 67 
DATE control statement 24-25 

and Communication Region 239 
debug packet 54 
debugging language 51-54 
DECK option 33 
DEL statement 46 
DELETE card 48-50 

used for debugging 54 
deleting source statements 

for one run only 49-50 

from a book 46 
DEPENDING ON option of OCCURS clause 

and Table Handling Feature 182-183 

and variable-length records 162-164 
device assignment 19-20 

duration of effect 23 
diagnostic messages 

compiler 74-75,64,217-234 

generation of 64 

linkage editor 77 

object time 79,234-235 
direct files 109-127 

actual track addressing 
109-119,125-126 

relative track addressing 
109-113,120-124 

sample job decks 241-242 
direct linkage 88 
direct organization 109-127, 107 
disk extent subroutines 212 
DISPLAY items 

conversions involving 171,170 

internal format of 172 

special considerations for 172 
DISPLAY statement subroutines 211-212 



-^ 



\-- . ..-J 



246 



division/remainder method of randomizing 
113-115 

used to create a direct file 

actual track addressing 115-119 
relative track addressing 120-124 
DLAB control statement 29 
DLBL control statement 26 

identifying private libraries 48 
DTF 

creation of 108, 133 

locating in a dump 56 

symbolic name of 29 
DTF tables 133-138 
dummy segment 99 
DUMP option 33 
dumps 54-63 

errors causing 55-56 

how to use 55 

locating data in 57 

locating DTF in 56 



file retention 

on direct-access storage devices 26 

on tape devices 25 
fixed- length records 153 
fixed partitioned multiprogramming 12 
FLAGE option 36 
FLAGW option 36 
foreground programs 12 
format F records 153 
format notation 21-22 
format S records 157-162 
format U records 153-154 
format V records 154-157 



generic terms 21 

GIVING option of error declarative 

139-141 
global table 73 
glossary 72 
GOBACK statement 82 



edit and execute job 14 

editing 17-18 

edit-only job 14 

EJECT 67,165 

ellipsis 22 

END statement 47 

end-of-data control statement 15 

end-of-job control statement 15 

ENTRY control statement 40 

generated by compiler for Segmentation 
100,101 
entry point in a called program 81,82 
ENTRY statement 82 

in an overlay structure 89 
error recovery 

on unit-record devices 36 

using an assembler language routine 
141-143 

using error declarative section 138-141 

using INVALID KEY 138,139 
ERRS option 33 
EXEC control statement 15 
EXEC FCOBOL Statement 17,15 
EXEC LNKEDT Statement 17,15 
execute- only job 14 
execution output 77-79 

execution time, machine requirements 237 
EXHIBIT statement 52-53 

subroutine 211 
EXIT PROGRAM Statement 8 2 
extended search 110 
extended source program library facility 

48-50 
EXTENT control statement 26-28 
extents, maximum number 27,30 
external-name 8 2 
external reference 82 

unresolved 40 

F-mode records 153 

FCOBOL 17 

file integrity 110 

file organization 107-108 

direct 109-126,107 

indexed 127-131,107 

sequential 109,107 



IBM-supplied processing programs 12 
identification field of COBOL source 

statements 45 
IF statement 176 
ILBDCKPO subroutine 65,214 
ILBDSEMO subroutine 101,102,214 
ILBDSRTO subroutine 96, 214 
in-line parameter list 85,87 
INCLUDE control statement 39 
independent overflow area 128 
independent segment 99 
index data items 182,183 
index-names 182,183-186 
indexed files 127-131 

adding records to 128-129 

sample job decks 241,243-244 
indexed organization 107,127-131 

improving efficiency when using 131 
indexes 128 

indirect addressing 112-114 
Initial Program Loader (IPL) 11 
input 

compiler 17 

Job Control Processor 20 

Linkage Editor 17,37,39 

for a segmented program 100,101,102 
INPUT PROCEDURE option 95,96 
Input/Output Control System (IOCS) 108 
input/output error subroutines 212 
input/output errors 138-143 
INSERT card 49,50 

used for debugging 54 
intermediate results 175-176 
interrupts, errors causing 55-56 
INVALID KEY condition 138,139 

direct organization 110,139 

indexed organization 139 

standard sequential organization 
109,139 
IOCS 108 



job 13 

types 14 
job control commands 



37 



Index 247 



job control considerations 

for accomplishing overlay 90 

for sort program 95-96 
Job Control Processor 11,21 

options 33-3U 
JOB control statement 31,15 
job control statements 15,21-37 

definition 11 

format notation 21 

formation of 21 

overlay considerations 90 

sequence of 22 

sort considerations 95-96 
job deck 15,22 
job definition 13 
job definition statements 15 
job step 13 

label area, reserving storage for 31 
label definition 

DLAB control statement 29 

DLBL control statement 26 

TLBL control statement 25 

TPLAB control statement 30 
label processing 144-151 

mass storage file labels 1U9-151 

tape file labels 144-149 
label processing considerations 

mass storage file labels 150-151 

tape file labels 148-149 
label processing subroutines 211 
LBLTYP control statement 31-32 
level numbers 166 
LIBR option 37 
Librarian 41,12 

line overlay (Report Writer) 179 
LINK option 38,33,216 
linkage 81-83 

in a called program 8 2 

in a calling program 81 

correspondence of arguments and 
parameters 82 

entry points 82 
linkage conventions 83-87 

argument list 85 

assembler subprogram 83 

generated by compiler for segmentation 
100,101,102 

overlay considerations 89 

in-line parameter list 85 

lowest level subprogram 87 

register use 84 

save area 84 
linkage editing 17,14 

with overlay 89 

without overlay 83 
Linkage Editor 11 
linkage editor control statements 37-40 

fields of 37 

generated by compiler for segmentation 
100,101,102 

overlay considerations 

placement of 38-39 
linkage editor diagnostic of input 77 
linkage editor input deck 18 
linkage editor input for a segmented 

program 100,101,102 
linkage editor messages 77 



linkage editor output 75-77,64,17-18 

linkage registers 84 

linkage with the Sort Feature 96-97 

LIOCS 108 

LIST option 33 

LISTIO control statement 32 

LISTX option 33 

literal pool 73 

locating the Working-Storage Section in 

dumps 166-167 
LOG option 33 
logic module 108 
Logical Input/Output Control System 

(LIOCS) 108 
logical record 108 

spanning physical blocks 157-162 

machine considerations 231-238 

main program or subprogram subroutine 215 

maintenance function of Librarian 41-48 

mass storage device 107 

mass storage file labels 149-151 

master index 120 

modularizing 

the Data Division 166 

the Procedure Division 174-175 

used by the Segmentation Feature 99 

module 11 

input to Linkage Editor 39 

MOVE statement 176 

MOVE statement subroutines 215 

MTC control statement 32-33 

multifile volumes 

TLBL control statement 25 

multiphase program 18,13,14 

multiple file tape subroutine 212 

multiprogramming 12 

multivolume tape files with nonstandard 
labels 149 



naming conventions used by Segmentation 

100 
NEXT GROUP clause 181 
NODECK option 33 
NODUMP option 33 
NOERRS option 33 
NOLI BR option 37 
NOLINK option 33 
NOLI ST option 33 
NOLISTX option 33 
NOLOG option 33 
NOMAP option 18,40 
NOMINAL KEY clause 130,131 
nonstandard tape file labels 144 

multivolume file considerations 149 
NOSEQ option 36 
33 

176 

37 
33 



NOSYM option 
NOTE statement 
NOTRUNC option 
NOXREF option 
NSTD-REELS 149 



object code listing 73-74 
object module 75 

produced by the compiler for 
Segmentation 100 
object time messages 234-235 



248 



OCCURS clause 

with Table Handling Feature 



182 



c 



162-16U 
162-164 
162-164 



187-199 



100-102 



with S-mode records 

with U-mode records 

with V-mode records 
ON statement 51 
operator communication 

ACCEPT statement 78 

job control commands 37 

PAUSE control statement 3U 

STOP statement 78 
operator intervention between job steps 

34 
operator messages 

ACCEPT statement 78 

STOP statement 78 
OPTION control statement 33 

duration of effect 34 
OPTIONAL (SELECT clause) 23 
options for compiliation 

CBL card 36-37 

OPTION control statement 33-34 
organization of files 107-108 

direct 109-127,107 

indexed 127-131, 107-108 

s equent ial 109,107 
origin point of phase 39 
output 

compiler 67-75,17 

complete sample program 

EXHIBIT statement 51-53 

from a segmented program 

linkage editor 75-77,64,17-18 

phase execution 77-78 

system 79 

TRACE statement 51-53 
OUTPUT PROCEDURE option 96 
overflow area 128-129 
overlay 14 

using Segmentation Feature 

using subprogram linkage 
overlay logic 89 
overlay structures 87-93 

job control considerations 

linkage editor 89-93 

PHASE statement 39 

provided by Segmentation Feature 
99-103 
overlayable fixed segment 99 

page breaks 179 

parameter list 82, 85 

PARSTD option 34 

PAUSE control statement 34 

PERFORM statement 176 

permanent segment 99 

phase 

definition of 11 
origin point 39 
PHASE control statement 39 

generated by compiler for Segmentation 
100,101,102 

89 
18 



99-103 
89-93 



90 



I 



using overlay 
phase execution 
output 77-78 
] , phase map 77 
^ Physical Input/Output Control System 
(PIOCS) 108 



PICTURE clause 167-168 

PIOCS 108 

pre-DTF switch 138 

prefixes 165-166 

prime area 127 

prime numbers 113,114 

printer spacing subroutine 211 

priority numbers 99 

private libraries 48 

private relocatable library 40 

problem program area 18 

Procedure Division header 82 

processing 

direct files 110-111 

indexed files 130 

sequential files 109 
processing programs 11 
Program Global Table (PGT) 73 
PROGRAM- ID paragraph 

and program linkage 81 

and Segmentation 100 
program switches 35-36 

Communication Region 239 
programmer logical units 19, 20 
programming techniques 165-186 

Data Division 165-174 

Environment Division 165 

general considerations 165 

Procedure Division 174-177 

Report Writer Feature 177-181 

Table Handling Feattire 181-186 

QUOTE option 36 

randomizing 

for the 2311 Disk Drive 125 

for the 2321 Data cell Drive 126 
randomizing techniques 112-115 

sample programs 115-119,120-124 
READ INTO statement 176-177 
READ statement subroutines 211 
READY TRACE statement 51,177 
RECORD CONTAINS clause 166 
record formats 153-164 

format F 153 

format S 157-162 

format U 153-154 

format V 154-157 
RECORD KEY clause 130-131 
record zero (RO) 109 
recording capacities of mass storage 

devices 107 
REDEFINES clause 167 
register use for linkage 84 
relocatable library 42, 43 

directory 42 

INCLUDE statement 39 
REP statement 46 

replacing source statements in a book 46 
REPORT clause 177 
Report Writer Feature 177-181 
Report Writer routines, generation of 181 
RERUN clause 

and RSTRT control statement 65,35 

and Sort Feature 97 

subroutine 214 
RESET control statement 35 
RESET TRACE Statement 51 



Index 249 



restarting a checkpointed program 66,35 
retrieving a book from the source statement 
library 44,45 

BASIS card 48,49 

COPY statement 44,45 

modifying using INSERT and DELETE 
cards 49,50 
retrieving a direct file 111 

sample job deck 241, 242 
retrieving an indexed file 130 

sample job deck 241,244 
retrieving a program phase 41-42 
REWRITE statement subroutines 211 
root phase 18 

in overlay structure 87 
root phase overlay 18 
root segment 99,100,101 
RSTRT control statement 35,66 
RO (record zero) 109 

S-mode records 157-162 
sample program output 187-199 
save area 84 

SEARCH ALL statement 183,186 
SEARCH statement 185-186 

subroutine 215 
segment descriptor field 157 
segment limit 99,100 
Segmentation Feature 99-103 

subroutine 214 
segmentation subroutine 214 
segments 99-101 
SELECT clause 

ASSGN control statement 23 

DLBL control statement 26 

EXTENT control statement 27 

programming technique 165 

TLBL control statement 25 

VOL control statement 29 
SELECT OPTIONAL clause 23 
SEQ option 36 

sequence-check source statements 36 
sequence of job control statements 22 
sequential organization 107,109 
service function of Librarian 41 
SET command 25, 67 
SET statement 183-184 
7-track tape, restriction when used as sort 

work files 96 
sign usage 168 
single-program mode 12 
SKIPl 67,165 
SKIP2 67,165 
SKIP3 67,165 
slash ampersand (/£) 15 
slash asterisk (/*) 15 
sort diagnostic messages 
Sort Feature 95-97 

machine requirements 

in a segmented program 
sort interface subroutine 
sort job control requirements 
sort work files 96 
sorting an unlabeled tape file 241, 244 

sample job deck 244 
SORT-RETURN 97 
source statement library 43-48 

directory 43 



96 

237-238 
101-103 
214 

95-96 



space allocation 

EXTENT control statement 27-28 

XTENT control statement 30-31 
SPACEn option 36 
spacing of source program listing 

36,67,165 
spanned records 157-162 

on directly organized files 159-161 

on sequentially organized files 
161-162 

and Sort Feature 96 
special registers 

COM- REG 239 

CURRENT-DATE 25, 239 

NSTD-REELS 149 

SORT- RETURN 97 
spill file 234 
standard file labels 

format 1 203-207 

mass storage 149-150 

tape 144,148-149,201-202 
START statement 130 
statement formats 21-22 
STDLABEL option 34 
STOP statement 78 

siibroutines 212 
STXIT option 36 
subordinate phases 18 
subscripts 163 
SUM counters 177,178 
SUM routines 178-179 
summing techniques 177,178 
Supervisor 11 
SUPMAP option 36 
suppressing messages 

FLAGE option 36 

NOERRS option 33 
SYM option 33 
symbolic names 

of input/output devices 19-20 

of phases 39 
SYNCHRONIZED Clause 172 
synonyms 112 
SYSIN 19,20 
SYSIPT 19,20 
SYSLNK 19,20,38 
SYSLOG 19,20 
SYSLST 19,20,67 
SYSOUT 19,20,23 
SYSPCH 19,20 
SYSRDR 19,20 

on same device as SYSIPT 15,17,19 
SYSRES 19,20,48 
SYSRLB 19,20,48 
SYSSLB 19,20,48 
system logical units 19 
system message identification codes 79 
system-name restriction for RERUN on a sort 

file 97 
system output 79 
system service programs 11-12 
SYSOOO through SYS221 19,20 



table element 182 
Table Handling Feature 181-186 
tape file labels 144-149 
Task Global Table (TGT) 73 



~^ 



\, 



250 



V. 



TLBL control statement 25-26 

standard tape file labels 141,142 
TPLAB control statement 30 

standard tape file labels 140 
TRACE statement 51,177 
track 107 
track addressing 109-1^27 

actual 111-115, 125- 1\27 
sample program 115-119 

relative 111-113 

sample program 120-124 
track formats for direct-access storage 

devices 209-210 
track index 128 
TRANSFORM Statement 177 

subroutine 215 
transient area 101,102,103 
TRUNC option 37 
truncation of COMPUTATIONAL items 37 



UPSI byte 36 

UPSI control statement 35 

Communication Region 239 
UPSI switches 239 
UPSI-0 through UPSI-7 36 
USAGE clause 169-171 
user labels 

mass storage files 150,151 

tape files " 144,148 
user program switch indicators 239 
USING option 

of CALL statement 81 

of ENTRY Statement 82 

on Procedxire Division header 8 2 
USRLABEL option 34 
utility data sets 

required by compiler 237 

required by sort program 238,96 



h" 



U-mode records 152-153 
undefined records 152-153 
Tonlabeled files 151 

sorting 244 
unnumbered messages 235 
unresolved external references 40 
unsigned items 168 
UPDATE function 45-48 

ADD statement 46 

control statement placement 47 

DEL statement 46 

END statement 47 

invalid operand defaults 47-48 

logical unit assignment 47 

REP statement 46 

UPDATE statement 45-46 
UPDATE statement 45-46 
updating a. book in the source statement 

library 45-48 
updating a direct file 111 

sample job deck 242 
updating an indexed file 130-131 

sample job deck 244 



V-mode records 154-157 
variable-length records 154-157 
VOL control statement 28-29 
volume labels 

mass storage 149 

tape 144 



WITH CODE clause 179-180 

work files 

required by compiler 237 
required by sort program 238,96 

Working- Storage Section, locating in a 
dump 166-167 

WRITE FROM statement 176-177 

WRITE statement siibroutines 211 



74 



XREF dictionary 

XREF option 33 

XTENT control statement 



30 



7-track tape, restriction when used as sort 
work files 96 



Index 251 



r 



, ;, READER'S COMMENTS 



TITLE: IBM System/360 Disk Operating System FORM: GC28-6398-1 

American National Standard COBOL 
Programmer's Guide 



Your comments assist us in improving the usefulness of our publications; they are an important part 
of the input used in preparing updates to the pubUcations. All comments and suggestions become 
the property of IBM. 

Please do not use this form for technical questions about the system or for requests for additional 
publications; this only delays the response. Instead, direct your inquiries or requests to your IBM 
representative or to the IBM Branch Office serving your locality. 

Corrections or clarifications needed: 
Page Comment 



( V 



Please include your name and address in the space below if you wish a reply. 






Thank you for your cooperation. No postage necessary if mailed in the U.S.A. 



GC28-6398-1 






fold 



fold 



FIRST CLASS 
PERMIT NO. 33504 
NEW YORK, N.Y. 



BUSINESS REPLY MAIL 

NO POSTAGE NECESSARY IF MAILED IN THE UNITED STATES 



POSTAGE WILL BE PAID BY . . . 

IBM CORPORATION 
1271 Avenue of the Americas 
New York, New York 10020 



Attention: PUBLICATIONS 




fold 



fold 



International Business Machines Corporation 

Data Processing Division 

112 East Post Road, White Plains, N.Y. 10601 

lUSAOnly) 

^Id Trade Corporation 

'•'tions Plaza, New York, New York 10 017 



/" 



V 



GC28-6398-1 



f 



ft 

c 
en 

> 



o 
o 

00 

I 

<T\ 
CO 
VO 
00 

I 



International Business Machines Corporation 
Data Processing Division 
112 East Post Road, White Plains, N.Y. 10601 
[USA Only] 

IBM World Trade Corporation 

B21 United Nations Plaza, New York, New York 10 017 

(International] 



iC