CONTENTS
PREFACE = ix
ACKNOWLEDGMENT = xi
1 PROGRAM STRUCTURE = 1
Introduction = 1
Characteristics of Good Programs = 2
Partitioning = 4
Hierarchies and Networks = 5
Structure Charts = 15
Exercises = 19
2 PROGRAM COHESION = 21
The Black Box Concept = 21
Cohesion in Programs = 23
Functional Cohesion = 24
Coincidental Cohesion = 25
Class-Oriented Cohesion = 27
Time-Related Cohesion = 30
Procedural Cohesion = 31
Data-Related Cohesion = 33
Sequential Cohesion = 33
Levels of Cohesion = 35
Exercises = 36
3 PROGRAM DESIGN = 37
Introduction = 37
Content Coupling = 38
Module Size = 40
Span of Control = 44
Fan-In = 46
Levels of Decision = 50
Inversion of Authority = 54
Control Based on Physical Contiguity = 55
Top-Down Design = 57
Example of Top-Down Design = 60
Exercises = 64
4 ELEMENTS OF COBOL = 67
COBOL Characters and Words = 67
Data-Names = 69
Level Numbers = 74
Variables and Constants = 76
Statements and Sentences = 80
COBOL Format specifications = 81
The Divisions of a COBOL program = 84
The COBOL Coding Form = 87
The COPY Verb = 88
The Operating System and the Execution of COBOL Programs = 92
Summary of Common COBOL Statements = 94
Sample Program = 103
Exercises = 106
5 DATA DIVISION FEATURES = 111
Introduction = 111
The PICTURE Clause for Data Description = 114
The PICTURE Clause for Data Editing = 121
The BLANK WHEN ZERO Clause = 130
Condition-Names = 130
The VALUE Clause = 132
Qualification = 133
Mulitple-Data Records = 136
The REDEFINES Clause = 138
The RENAMES Clause = 140
The CURRENCY and DECIMAL-POINT Clauses = 142
Exercises = 143
6 IMPERATIVE STATEMENTS = 149
Introduction = 149
File Input and Output = 149
WRITE with the LINAGE Clause = 153
The ACCEPT and DISPLAY Verbs = 156
Arithmetic Verbs = 158
The COMPUTE Verb = 163
Arithmetic Precision = 167
Data Transfer = 176
The MOVE CORRESPONDING = 178
The PERFORM Verb = 180
Exercises = 185
7 CONDITIONAL STATEMENTS = 193
Introduction = 193
Relation Conditions = 194
Nested Conditions = 196
Class Conditions = 207
Using Conditionals to Check Input Data = 209
Sign Conditions = 212
Condition-Name Conditions = 213
Complex Conditions = 214
Exercises = 216
8 NUMERIC AND CHARACTER DATA = 221
Data Representation = 221
The USAGE Clause = 226
The SYNCHRONIZED Clause = 230
Alphabets and Collating Sequences = 232
The JUSTIFIED RIGHT Clause = 240
The STRING and UNSTRING Verbs = 241
The INSPECT Verb = 248
Exercises = 252
9 SUBPROGRAMS = 255
Introduction = 255
Calling and Called Programs = 257
Subprogram Data Linkage = 262
Transfer of Control = 269
Sample main and Subprogram Structure = 272
Exercises = 281
10 STRUCTURED PROGRAMMING = 283
Introduction = 283
Three Basic Program Structures = 284
Additional Program Structures = 287
Formatting Rules for Programs = 290
Program Layout = 294
Converting Unstructured Programs to Structured Form = 299
Exercises = 309
11 PROGRAM TESTING = 313
Introduction = 313
Top-Down Program Development and Testing = 316
Bottom-Up Program Development and Testing = 320
Top-Down vs. Bottom-Up Approaches to Testing = 322
Testing Procedures = 323
Common Errors = 328
COBOL Debugging Feature = 334
Exercises = 341
12 REPORT GENERATION = 343
Introduction = 343
Control Breaks in Report Writing = 345
Logic of Report Programs = 347
The Report Writer Feature - A Basic Example = 350
Report Writer with Control Breaks = 364
Report Writer using Declaratives = 376
Language Specifications for the COBOL Report Writer = 380
Exercises = 386
13 TABLE HANDLING = 389
Table Definitions in COBOL = 389
An Example of a Table of Constant Values = 397
The OCCURS…DEFENDING ON Option = 398
The PERFORM Verb and Table Handling = 400
Sample Program with a Two-Dimensional Table = 403
Sample Program with Graphic Output = 405
Table Searching = 408
COBOL Language Options in Table Searching = 414
Sample Program with Indexing and Searching = 421
Exercises = 424
14 SEQUENTIAL FILES = 433
File Organization = 435
File Labels = 433
Record Blocking = 439
COBOL Instructions for Sequential Files = 444
Sample Program to Create a Sequential File = 454
I/O Exception Processing = 454
Master File Maintenance = 461
A General Programming Model for Updating Sequential Files = 467
Transaction Records and File Maintenance = 472
Activity Ratios and File Maintenance = 476
Exercises = 479
15 SORTING AND MERGING = 489
Introduction = 489
Internal Sorting = 489
COBOL File-Sort Feature = 498
SORT Statement Formats = 505
File Merging = 509
File Merging in COBOL = 513
Exercises = 516
16 INDEXED SEQUENTIAL FILES = 521
Introduction = 521
Indexed Sequential File Organization = 521
Adding Records to an Indexed Sequential File = 526
Sequential and Random Access with an Indexed Sequential File = 530
VSAM - An Alternate Index Structure = 532
An Example of the Creation of an Indexed File = 537
COBOL Language Instructions for Indexed Files = 540
An Example of Processing an Indexed File = 548
Exercises = 549
17 RELATIVE FILES = 555
Relative File Organization = 555
The Division Remainder Method = 558
Other Key-to-Address Transformation Methods = 561
COBOL Statements for Relative Files = 564
An Example of Creating A Relative File = 567
An Example of Updating A Relative File = 570
Exercises = 576
APPENDIX A ANS COBOL RESERVED WORDS = 579
APPENDIX B COMPLETE ANS COBOL LANGUAGE FORMATS = 583
INDEX = 603