Book Read Free

Michael Coughlan

Page 68

by Beginning COBOL for Programmers-Apress (2014) (pdf)

combination)

  symbols editing, 185

  key references, 464

  Elementary data item, 40

  reading an indexed file ( See Reading an

  Encapsulation, 528

  indexed file)

  END-IF vs. period, 82

  SELECT and ASSIGN clause, 463

  EVALUATE

  verbs ( see Index file verbs)

  Acme Book Club example, 99

  sequential file, 455

  amusement park example, 98

  index file organization, 449

  decision tables, 94

  alternate-key index, 450

  metalanguage, 95

  data buckets, 449

  objects, 97

  primary-key index, 449

  payment totals example, 97

  processing relative files, 437

  subjects, 97

  Reads ( see Reading a relative file)

  WHEN branch rules, 97

  sequential file, 439

  transactions ( see Relative file transaction)

  � F

  �

  �

  relative file

  SELECT and ASSIGN clause, 444

  Field, 132

  verbs ( see Relative file verbs)

  Figurative constants, 39

  relative files organization

  File(s), 131

  one-dimensional table, 436

  definition, 131–132

  records, 437

  field, 132

  single numeric key, 436

  practical exercise, 147, 150

  sparsely populated, 436

  processing of, 133

  vs.sequential files, 435

  record, 132

  DISPLAY verb, 55

  buffer, 133–134

  Divisions, COBOL program, 23

  buffer declaration, 135

  CONFIGURATION SECTION, 24–25

  creation, 135

  DATA DIVISION, 25

  declarations, 134

  FILE SECTION, 25

  occurrence, 132

  WORKING-STORAGE SECTION, 25

  template, 132

  ENVIRONMENT DIVISION, 24

  record-based files, 131

  hierarchical data declaration, 26

  direct-access file organization, 131

  IDENTIFICATION DIVISION, 23–24

  serial file organization, 131

  PROCEDURE DIVISION, 27

  SELECT and ASSIGN clause, 136

  ShortestProgram, 27

  declarations, 137–138

  Domain-independent languages, 2

  extension, 138

  549

  ■ index

  File(s) ( cont. )

  KeyName, 464

  syntax, 137

  READ NEXT RECORD format, 464

  usage, 137

  START verbs, 465

  sequential ( see Sequential files)

  WRITE, REWRITE and DELETE verbs, 465

  File-update problem, 224

  Inline execution, 117

  multiple record types, 226

  Insertion, 185

  mapping transcations, 227

  fixed insertion

  schematic representation, 226

  CR and DB, 188

  program implementation, 227

  currency symbol, 188

  test data file, 231

  examples, 190

  update stock file, 224

  Plus and Minus Symbols, 188

  change record, 225

  floating-insertion, 192

  deletion, 225

  simple-insertion, 185

  insertion, 225

  examples, 185

  transaction file, 225

  working principle, 185

  Fourth-generation languages (4GLs), 8

  special-insertion, 187

  Fujitsu NetCOBOL compiler, 35

  INSPECT Verb, 393, 395

  CONVERTING format, 368

  formats, 361

  � G

  �

  �

  program, 361–362

  GIVING phrase, 61

  reference modification, 380

  Gravity-driven programming, 111

  REPLACING format

  metalanguage, 366

  phrases, 366

  � H

  �

  �

  statements, 367–368

  TALLYING format

  Hierarchical data description, 50

  counting vowels and consonants, 364–365

  Hierarchical program structure, 21

  metalanguage, 363

  divisions ( see Divisions, COBOL program)

  phrases, 363

  paragraph, 22

  programmatic detour, 365

  sections, 21

  statements, 364

  sentence, 22

  UPPER-CASE function, 362

  statements, 23

  Intrinsic functions, 383

  date functions

  � I, J

  �

  � , K

  program, 390–392

  types, 389

  IF statement, 73

  definition, 383

  condition types, 74

  parameters/arguments, 384

  class conditions, 75

  string

  complex conditions, 78

  CHAR and ORD, 386

  relation conditions, 74

  LENGTH function, 387

  sign conditions, 78

  ORD-MAX function, 385, 387

  END-IF vs. period, 82

  ORD-MIN function, 386

  nested IF statements, 81

  REVERSE function, 387

  Implied subjects, 80

  types, 384

  INDEXED BY clause, 304

  working principle, 388

  Index file combination

  IS EXTERNAL Clause

  DirectorId-DF, 458

  common coupling, 423

  index file used, 456

  data-sharing mechanism, 422

  Index file verbs

  naming dependency problem, 423

  file manipulation, 464

  IS EXTERNAL Data Items

  READ verb

  data flow, tramp data, 424

  ACCESS MODE IS DYNAMIC, 464

  IS EXTERNAL phrase, 423

  ACCESS MODE IS SEQUENTIAL, 464

  tramp data, 424

  550

  ■ index

  Iteration constructs, 109

  � O

  �

  �

  PERFORM, 109–110

  closed subroutines, 112

  OCCURS clause metalanguage, 304

  COBOL subroutines, 112

  Online compiler, 35

  format 1, 113

  ON SIZE ERROR phrase, 62

  inline execution, 117

  OO-COBOL, 519

  open subroutines, 110, 112

  class, 528

  out-of-line execution, 118

  CLASS clause, 529

  PERFORM..THRU, 115

  class program, 537–538

  PERFORM..TIMES, 116

  scoping issues, 534–535

  PERFORM..UNTIL, 118

  structure, 533

  PERFORM..VARYING, 120

  template, 533

  PERFORM..VARYING UNTIL, 109

  ThisInstanceNum-ows, 539

  PERFORM WITH TEST AFTER UNTIL, 109

  WORKING-STORAGE SECTION vs.

  PERFORM WITH TEST BEFORE UNTIL, 109

  LOCAL-STORAGE SECTION, 536

  working principle, 113

  destroying objects, 531

  dictionary class, 525

  acronym dictionary creation, 527

  � L

  �

  �

  creation, 523–524

  Level number relationships govern hierarchy, 50

  END OBJECT, 527

  Level sixty-sixes, 284

  FACTORY, 527

  Linear search, 303<
br />
  IDENTIFICATION DIVISION, 527

  Literals, 37

  PROCEDURE DIVISION, 525

  alphanumeric literals, 37

  USAGE OBJECT REFERENCE clause, 524

  numeric literals, 38

  encapsulation, 528

  exercise program, 540

  informational-strength modules

  � M

  �

  �

  AddWordToDictionary, 521

  creation, 521

  Master file (MF), 219

  DictionaryModule, 522

  Metalanguage syntax, 19

  instance object, 530

  COMPUTE statement, 20

  INVOKE verb, 530

  diagram, 19

  module coupling, 520

  notation, 19

  module dictionary module, 521

  operand suffixes, 20

  module strength, 520

  Micro Focus Visual compiler, 34

  object, 528–529

  Multidimensional, 256

  OBJECT REFERENCE, 528

  definition, 256

  predefined object identifiers, 532

  granular data, 256

  USAGE OBJECT REFERENCE, 529

  hierarchical structure, COBOL, 257

  Open source COBOL compiler, 35

  program, 257

  OPEN statement, 139

  record description, 256

  Open subroutines, 110, 112

  Ordered sequential file

  � N

  �

  �

  delete records, 223

  insert records, 219–220

  Nested IF statements, 81

  master file (MF), 219

  Nonconforming arithmetic verbs, 63

  partial record description, 221

  Add verb, 65

  transaction file (TF), 219

  COMPUTE Verb, 63

  update records, 221–222

  DIVIDE Verb, 68

  master file, 222

  MULTIPLY Verb, 67

  transaction file, 222

  SUBTRACT Verb, 66

  OR truth table, 79

  Numeric literals, 38

  Out-of-line execution, 118

  551

  ■ index

  � P, Q

  �

  �

  programming structure, 69

  TERMINATE verb, 509

  Paragraphs, PROCEDURE DIVISION, 109

  transaction-processing software, 55

  PERFORM, 109–110

  closed subroutines, 112

  COBOL subroutines, 112

  � R

  �

  �

  format 1, 113

  inline execution, 117

  Raincode compiler, 35

  open subroutines, 110, 112

  RANDOM intrinsic function, 420

  out-of-line execution, 118

  Reading an indexed file

  PERFORM..THRU, 115

  data division, 451

  correct usage, 115

  environment division, 451

  GO TO and Skip statements, 116

  GetFilmByDirectorId, 454

  IF and Skip statements, 115

  procedure division, 451

  PERFORM..TIMES, 116

  RELATIVE KEY entry, 453

  examples, 117

  working-storage section, 451

  format 2, 116

  Reading a Relative File

  PERFORM..UNTIL, 118

  data division, 437

  format 3, 118

  display record, 438

  post-test loop, 120

  environment division, 437

  pre-test loop, 119

  FILE STATUS clause, 439

  terminating condition, 120

  procedural division, 438

  WITH TEST AFTER, 119

  READ verb, 439

  WITH TEST BEFORE, 119

  READ statement, 140

  PERFORM..VARYING

  data storage, 141–142

  counting, 122

  employee.dat file, 140

  counting iteration, 121

  syntax description, 140

  format 4, 120

  test data file, 140–141

  odometer simulation, 123–124

  with records display, 142

  syntax description, 121

  Record, 132

  WITH TEST AFTER, 121–122

  buffer, 133–134

  PERFORM..VARYING UNTIL, 109

  buffer declaration, 135

  PERFORM WITH TEST AFTER UNTIL, 109

  creation, 135

  PERFORM WITH TEST BEFORE UNTIL, 109

  declarations, 134

  PRACTICAL EXERCISES, 124

  occurrence, 132

  working principle, 113

  template, 132

  Procedure division, 55

  REDEFINES clause, 273

  ACCEPT and DISPLAY program, 59

  Aromamora PLC specification ( see Aromamora Base

  ACCEPT verb, 57

  Oil Sales report)

  rules, 58

  data items, 282

  system variables format, 58

  percentages, 282

  arithmetic verbs, 60

  semantic rules, 280

  GIVING phrase, 61

  syntax metalanguage, 280

  metalanguage, 60

  time conversions, 283

  ON SIZE ERROR phrase, 62

  UNSTRING statement, 281

  ROUNDED phrase, 62

  Registers, 507

  statements, 61

  LINE-COUNTER, 507

  DISPLAY verb, 55

  PAGE-COUNTER, 507

  GENERATE verb, 508

  Relation conditions, 74

  INITIATE verb, 508

  metalanguage, 75

  nonconforming arithmetic verbs, 63

  samples, 75

  Add verb, 65

  Relative file organization

  COMPUTE Verb, 63

  advantages, 468

  DIVIDE Verb, 68

  disadvantages, 467

  MULTIPLY Verb, 67

  indexed file, 468

  SUBTRACT Verb, 66

  one-dimensional table, 467

  552

  ■ index

  Relative file transaction

  GENERATE verb, 508

  content, 441

  INITIATE verb, 508

  DisplayVehicleRecords, 444

  TERMINATE verb, 509

  file processing verbs, 444

  program creation, 514

  sequential file to, 441

  CONTROL FOOTING group, 487, 492

  Relative file verbs

  DATA DIVISION, 489

  DELETE verb, 448

  DETAIL group, 487

  INVALID KEY clause, 445

  features, 493

  OPEN/CLOSE syntax, 446

  PAGE FOOTING group, 487–488

  read verb

  PAGE HEADING group, 487, 491

  ACCESS MODE, 446

  PROCEDURE DIVISION, 488, 492

  direct read, metalanguage, 447

  REPORT HEADING group, 487

  sequential read, metalanguage, 446

  REPORT SECTION, 490

  REWRITE verb, 447

  specification modification, 483

  START verb

  SUM clause, 492

  metalanguage for, 448

  WORKING-STORAGE SECTION, 489

  position controller, 448

  publisher file, 513

  write verb, 447

  registers, 507

  RENAMES clause, 284

  LINE-COUNTER, 507

  identification division, 285

  PAGE-COUNTER, 507

  procedure division, 285

  solace solar, 477

  semantic rules, 284

  first page, 478–479

  syntax metalanguage, 284

  PROCEDURE DIVISION, 480

  working-storage section, 285

/>   specification, 478

  REPLACING phrase, 426

  tasks, 479

  Report writer, 477

  ROUNDED Phrase, 62

  book file, 513

  control-break processing, 477

  � S

  �

  �

  declaratives

  COLUMN NUMBER clause, 505

  SEARCH ALL verb, 303, 314

  control-break register, 511

  binary search algorithm, 315

  crossfooting, 506

  KEY IS clause, 314

  elementary print items, 504

  metalanguage, 317

  ENVIRONMENT DIVISION, 499

  SEARCH verb, 303

  FILE SECTION, 500

  advantages, 303

  group definition, 501

  American states, 307

  GROUP INDICATE clause, 505

  letter position, 306

  handle unexpected file errors, 511

  metalanguage, 305

  LINE NUMBER clause, 502

  two-dimensional table

  NEXT GROUP clause, 503

  declarations, 312

  print lines, 504

  graphical depiction, 312

  Report Description (RD), 500–501

  JeansSalesTable, 313

  RESET ON clause, 507

  SELECT and ASSIGN clause, 136

  rolling forward, 506

  declarations, 137–138

  SOURCE clause, 505

  extension, 138

  structure of, 509

  syntax, 137

  subtotaling, 505

  usage, 137

  SUM clause, 505

  Selection constructs, 73

  SUPPRESS PRINTING statement, 510

  condition names, 83

  TYPE clause, 503

  correct use of, 88

  version of USE, 509, 511

  Date-Validation Error Message, 93

  group types, 481

  design patterns, 91

  layout requirement, 482

  example program, 89

  print specification, 514

  group item, 92

  PROCEDURE DIVISION

  multiple names, 85

  553

  ■ index

  Selection constructs ( cont. )

  Report Writer, 167

  numeric or alphabetic values, 87

  select and assign, 167

  overlapping and multiple-value names, 86

  WRITE statement, 169

  rules, 84

  reading, 91

  set to true, 90

  READ statement, 140

  SET verb examples, 90

  data storage, 141–142

  SET verb metalanguage, 90

  employee.dat file, 140

  single name and value, 84

  syntax description, 140

  whole word values, 88

  test data file, 140–141

  EVALUATE, 94

  with records display, 142

  Acme Book Club example, 99

  update files, 218

  amusement park example, 98

  file-update problem ( see File-update problem)

  decision tables, 94

  key field, 219

  metalanguage, 95

  ordered sequential file ( see Ordered

  objects, 97

  sequential file)

  payment totals example, 97

  record matching, 219

  subjects, 97

  transaction file, 219

  WHEN branch rules, 97

  variable-length records, 174

  IF statement, 73–74

  FD entries, 174

  class conditions, 75

  program implementation, 175

 

‹ Prev