ebook img

Structured Cobol PDF

437 Pages·1986·377.572 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Structured Cobol

Ec. RL Vav:h) i _coBol | THIRD EDITION THIRD EDITION A.S. PHILIPPAKIS : Arizona State University LEONARD J. KAZMIER Arizona State University McGRAW-HILL BOOK COMPAN New York St. Louis San Francisco Auckland Bogota Joha esburg ‘London Madrid MexicoM em Paris SaesPalic: Singapore STRUCTURED COBOL Copyright © 1986, 1981, 1977 by McGraw-Hill, Inc. All rights reserved. A majorrevision of COBOL FOR BUSINESS APPLICATIONS, copyright © 1973 by McGraw-Hill, Inc. All rights reserved. Printed in the United States of America. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a data base orretrieval system, without the prior written permission of the publisher. 1234567890 WEBWEB 898765 ISBN 0-07-049809-1 This book was set in Times Roman by Monotype Composition Company, Inc. The editors were Christina Mediate and Joseph F. Murphy; the designer was Rafael Hernandez; the production supervisor was Marietta Breitwieser. The drawings were done by Accurate Art, Inc. The cover photograph was taken by R. Wickham. Webcrafters, Inc., was printer and binder. See Acknowledgment on page xv. Copyrights included on this page by reference. Library of Congress Cataloging-in-Publication Data Philippakis, Andreas S. Structured COBOL. Includes index. 1. COBOL (Computer program language) 2. Business— Data processing. |. Kazmier, Leonard J. Il. Title. HF5548.5.C2P54 1986 005.133 85-17083 ISBN 0-07-049809-1 CONTENTS PREFACE xiii ACKNOWLEDGMENT XV OVERVIEW OF COBOL PROGRAMMING = Introduction = Levels of Computer Languages Overall Structure of COBOL Programs COBOL Characters and Words UTI Data-Names Constants Sample COBOL Program The COBOL Coding Form 14 An Outline for Your COBOL Programs 18 The Operating System and the Execution of COBOL Programs 18 Exercises 21 AN ELEMENTARY SET OF COBOL INSTRUCTIONS 23 Introduction 28 IDENTIFICATION DIVISION 23 ENVIRONMENT DIVISION 27 DATA DIVISION 28 The PICTURE Clause 31 PROCEDURE DIVISION 33 Input-Output Verbs 35 The MOVE Instruction 37 Arithmetic Verbs 38 Vil viii CONTENTS Conditional Expressions 40 Control Verbs 43 Debugging and Testing a Program 47 Exercises 50 PROGRAM STRUCTURE 54 Introduction 54 Characteristics of Good Programs 54 Flowcharting the Program Logic 56 Basic Forms of Structured Programming 60 Program Structure Charts Pseudocode 66 An Illustration of Developing the Program Structure 67 Exercises 72 DATA DIVISION FEATURES 74 Introduction 74 Data Structure and Relationships 74 Record Layout 77 FILE SECTION 79 WORKING-STORAGE SECTION 80 The PICTURE Clause for Data Description 81 The PICTURE Clause for Data Editing 85 The BLANK WHEN ZERO Clause 92 Condition-Names 92 The VALUE Clause 94 Sample DATA DIVISION 94 Exercises 98 PROCEDURE DIVISION STATEMENTS 102 COBOL Language Formats 102 Arithmetic Verbs 104 The COMPUTE Verb Aid File Input and Output 114 ACCEPT and DISPLAY Verbs 117 Data Transfer 121 The PERFORM Verb 124 The GO TO Verb 130 Sample Program 130 Exercises 134 CONDITIONS AND CONDITIONAL STATEMENTS 138 Introduction 138 Relation Conditions 138 Nested Conditions 141 Class Conditions 51 Using Conditionals to Check Input Data 153 Sign Conditions 156 Condition-Name Conditions 157 The SET Verb for Condition-Names 158 Complex Conditions 160 Exercises 161 CONTENTS ix / PROGRAM DESIGN 167 Introduction 167 Partitioning 167 The Black Box Concept for Cohesive Modules 168 Levels of Abstraction 171 Formatting Rules for Programs 175 Program Design for Control-Break Logic 179 Sample Program with Control Breaks 181 Exercises 187 ADDITIONAL LANGUAGE FEATURES 189 Introduction 189 IDENTIFICATION DIVISION 189 ENVIRONMENT DIVISION 189 The USAGE Clause 192 The SIGN Clause 194 The SYNCHRONIZED Clause 196 The JUSTIFIED RIGHT Clause 197 Qualification 198 Multiple Data Records 200 The REDEFINES Clause 202 The RENAMES Clause 203 Reference Modification 204 WRITE with the LINAGE Clause 206 The MOVE CORRESPONDING Option 208 The STRING and UNSTRING Verbs 209 The INSPECT Verb 214 The INITIALIZE Verb 217 The COPY Verb 218 Exercises 219 SEQUENTIAL FILE PROCESSING 225 File Organization 225 File Storage Devices 226 File Labels 230 COBOL Instructions for Sequential Files 232 The FILE-CONTROL Specification 232 The File-Description Entry 236 The OPEN and CLOSE Verbs 239 The READ, WRITE, and REWRITE Verbs 241 Sample Program to Create a Sequential File 242 Sequential File Updating 244 Sample Sequential File Update Program 246 Exercises 252 10 SORTING AND MERGING SEQUENTIAL FILES 257 COBOL Sort Feature 257 Sort Statement Formats 265 File Merging 268 Exercises 270 X CONTENTS 11 BASIC TABLE HANDLING 273 Introduction 273 Subscripting and the OCCURS Clause 273 Reading Values into a Table 276 Entering Constant Values into a Table 277 The OCCURS .. DEPENDING ON Option 279 . The PERFORM Verb and Table Handling 281 Sample Forecasting Program 286 Sample Program with Graphic Output 288 Internal Sorting 290 Exercises 294 12 ADDITIONAL TABLE-HANDLING FEATURES 296 Two-Dimensional and Higher-Dimensional Tables 296 The PERFORM Verb and Table Handling 299 Sample Program with a Two-Dimensional Table 304 Sample Program with a Three-Dimensional Table 306 Table Searching with COBOL 309 COBOL Language Options in Table Searching 312 Sample Program with Indexing and Searching 315 Exercises 318 13 INDEXED SEQUENTIAL FILE PROCESSING 322 Introduction 322 Indexed Sequential File Organization 322 An Example of the Creation of an Indexed File 325 COBOL Language Instructions for Indexed Files 328 An Example of Processing an Indexed File 336 Exercises 340 14 RELATIVE FILE PROCESSING 342 Relative File Organization 342 The Division Remainder Method 344 Other Key-to-Address Transformation Methods 346 COBOL Statements for Relative Files 348 An Example of Creating a Relative File 352 An Example of Updating a Relative File 356 Exercises 362 15 SUBPROGRAMS AND NESTED PROGRAMS 364 Introduction 364 Calling and Called Programs 365 Sample Program with a Subprogram 369 COBOL Statements for Subprograms 372 Nested COBOL Programs 374 Exercises 379 APPENDIX A COBOL RESERVED WORDS 383

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.