CA-Metacobol+ Structured Programming Guide
Total Page:16
File Type:pdf, Size:1020Kb
CA-MetaCOBOL™ + Structured Programming Guide Release 1.1 R203M+11DRP Intra-module Control Structures -- PROPRIETARY AND CONFIDENTIAL INFORMATION -- This material contains, and is part of a computer software program which is, proprietary and confidential information owned by Computer Associates International, Inc. The program, including this material, may not be duplicated, disclosed or reproduced in whole or in part for any purpose without the express written authorization of Computer Associates. All authorized reproductions must be marked with this legend. RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the United States Government ("the Government") is subject to restrictions as set forth in A) subparagraph (c) (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, and/or B) subparagraphs (c) (1) (ii) of the Rights in Technical Data and Computer Software clause of DFAR 252.227-7013. This software is distributed to the Government by: Computer Associates International, Inc. One Computer Associates Plaza Islandia, NY 11788-7000 Unpublished copyrighted work - all rights reserved under the copyright laws of the United States. This material may be reproduced by or for the United States Government pursuant to the copyright license under the clause at DFAR 252.227-7013 (October 1988). Release 1.1, January, 1992 Updated March, 1992, May, 1992 Copyright © 1992 Computer Associates International, Inc. All rights reserved. CA LIBRARIAN®, and CA PANVALET® are registered trademarks of Computer Associates, Inc. CA-MetaCOBOLTM + is a trademarks of Computer Associates, Inc. All product names referenced herein are trademarks of their respective companies. Contents _______________________________ 1. About this Manual 7 1.1 Purpose 7 1.2 Organization 7 1.3 Publications 8 1.4 Notation Conventions 9 1.5 Summary of Revisions 9 2. Introduction 11 2.1 What is Structured Programming? 11 2.2 What is the SP Facility? 12 2.3 The SP Facility versus Conventional COBOL and VS COBOL II 15 2.4 Getting Started 16 2.4.1 SP Facility Macro Sets 17 2.4.2 Sample JCL for Executing CA-MetaCOBOL+ 17 3. Module Definition and Invocation 21 3.1 Module Definition 22 3.2 Module Invocation 22 3.3 Use of the COBOL ENTRY Statement 24 4. Intra-module Control Structures 25 4.1 GO TO Alternative 26 4.2 SP Facility Control Structures 26 4.3 Selection 27 4.3.1 The IF Construct 27 4.3.2 The SELECT Constructs 29 4.3.3 The SELECT FIRST ACTION Construct 33 4.3.4 SEARCH Constructs 39 4.4 Repetition 43 4.4.1 The LOOP Construct 45 4.4.2 The LOOP...TIMES Construct 46 4.4.3 The LOOP VARYING/FOR Construct 48 4.4.4 ESCAPE 50 4.5 The Emergency EXIT 51 4.6 Standardized COBOL Conditions 52 4.7 The IS FALSE Condition Modifier 54 4.8 CICS Command Level Coding 55 5. Local Data Definitions and Control Variables 57 5.1 START DATA/END DATA and Local Data Definitions 58 5.2 Control Variables 59 5.2.1 The FLAG Statement 59 5.2.2 The SET-TRUE/SET-FALSE Statement 60 6. Structured Programming Support Macros 61 6.1 Structured Programming Documentor (SPD & SPDCOB) 61 6.1.1 Reports Produced 61 6.1.2 Raw Data Extraction 62 6.1.3 Generating Reports 63 6.2 High-Level Formatter (HLF) 64 6.3 Structured Programming Stub (SPS) Generator 65 7. Reading, Verifying, and Maintaining Structured Programs 67 7.1 A Comparison of Structured and COBOL Source 67 7.2 Correlation of Generated COBOL to Structured Source 70 7.3 Verification at the Structured Source Level 73 8. General Programming Verbs (GPV) 75 8.1 The ARRANGE Verb 75 8.2 The COLLATE Verb 77 8.3 The JCL-PARAMETERS Verb 81 8.4 FAIR Verbs 83 8.4.1 The OPEN-FAIR Verb 83 8.4.2 The START-FAIR Verb 85 8.4.3 The READ-FAIR Verb 86 8.4.4 The CLOSE-FAIR Verb 86 8.4.5 FAIR Verbs Example 87 8.5 Initialization Verbs 88 8.5.1 The CLEAR Verb 88 8.5.2 The RESET Verb 90 8.6 Bit Manipulation Verbs 91 8.6.1 The COMPRESS Verb 91 8.6.2 The EXPAND Verb 91 8.6.3 The SET-BITS Verb 92 8.6.4 The IF-BITS Verb 92 8.6.5 Bit-Manipulation Verbs Example 93 Appendix A - Structured Programming Facility Example 95 A.1 Problem Statement 95 A.2 Program 97 Appendix B - SPP-Generated Data-Names and Procedure-Names 101 B.1 SPP-Generated Data-Names 101 B.2 SPP-Generated, Module-Oriented Procedure-Names 102 B.3 SPP-Generated, Construct-Oriented Procedure-Names 103 Appendix C - Diagnostics 105 C.1 GPV Diagnostics 106 C.2 HLF Diagnostics 113 C.3 SPD Diagnostics 115 C.4 SPP Diagnostics for Structured Programming Processor (SPP) 117 C.5 SSPS Diagnostics 121 C.6 SSPV Diagnostics for Structured Programming Using VS COBOL II (SP2) 122 C.6.1 General 122 C.6.2 Module 123 C.6.3 Start/End Data 123 C.6.4 Flags Set-True/Set-False 124 C.6.5 Control Structures 125 C.6.6 IF/ELSE/ENDIF 126 C.6.7 SELECT/ENDSELECT and SEARCH/ENDSEARCH 127 C.6.8 LOOP/ENDLOOP 129 Index 131 1. About this Manual _______________________________ 1.1 Purpose This manual is both a guide and reference for using the CA-MetaCOBOL+ Structured Programming (SP) Facility. 1.2 Organization Chapter Description 1 Discusses the purpose of the manual, gives a list of CA-MetaCOBOL+ documentation, and explains notation conventions for CA-MetaCOBOL+. 2 Introduces the CA-MetaCOBOL+ Structured Programming (SP) Facility, including the support of the structured programming macro sets. 3 Describes how to define modules and invoke subordinate modules to create single entry, single exit modules. 4 Describes structured programming sequence, selection, and repetition constructs implemented in CA-MetaCOBOL+. 5 Discusses local data definition and unique control variables. 6 Discusses macro sets of the SP Facility. 7 Compares generated COBOL to structured source code. 8 Describes ways to access CA LIBRARIAN, manipulate bits, and sort tables. Appendix A Provides and describes a sample CA-MetaCOBOL+ SP program. Structured Programming Guide 7 About This Manual Appendix B Describes various categories of generated data names and procedure names. Appendix C Contains the diagnostics for the Structured Programming Facility. 1.3 Publications In addition to this manual, the following publications are supplied with CA-MetaCOBOL+. Title Contents Introduction to CA-MetaCOBOL+ Introduces the CA-MetaCOBOL+ Work Bench, Structured Programming Facility, Quality Assuranc Facility, CA-DATACOM/DB Facility, Macro Facility, Panel Definition Facility, and the Online Programming Language. Installation Guide - MVS Explains how to install CA-MetaCOBOL+ in the MVS environment. CA ACTIVATOR Installation Explains how to install CA-MetaCOBOL+ in the Supplement - MVS MVS environment using CA-ACTIVATOR. Installation Guide - VSE Explains how to install CA-MetaCOBOL+ in the VSE environment. Installation Guide - CMS Explains how to install CA-MetaCOBOL+ in the VM environment. User Guide Explains how to customize, get started, and use CA MetaCOBOL+. Includes information on keyword expansion, the CA-MetaCOBOL+ translator, and CA macro sets and programs. Structured Programming Guide Introduces the Structured Programming Facility. Includes information on creating, testing, and maintaining structured programs. Macro Facility Tutorial Introduces the Macro Facility. Includes information on writing basic macros, model programming, macro writing techniques, and debugging. Macro Facility Reference Includes detailed information on the program flow o the CA-MetaCOBOL+ macro translator, macro format, definition of comments, macro nesting, macro prototypes, symbolic words, and model programming. Quality Assurance Guide Introduces the Quality Assurance Facility. Includes all the necessary information to perform quality assurance testing on COBOL source programs. Program Development Guide CA- Includes all the information necessary to develop DATACOM/DB programs that make full use of the functions and features of the CA-DATACOB/DB environment. Program Development Reference Contains all CA-DATACOM/DB Facility constructs CA-DATACOM/DB and statements. Panel Definition Facility Command Contains all Panel Defintion Facility commands. Reference 8 CA-MetaCOBOL+ Publications Panel Definition Facility User GuideIncludes all the information necessary to create, edit, duplicate, rename, delete, index, and print panel definitions and members. Also describes how to generate BMS source. Online Programming Language Contains all Online Programming Language Reference statements. All manuals are updated as required. Instructions accompany each update package. 1.4 Notation Conventions The following conventions are used in the command formats throughout this manual: UPPERCASE is used to display commands or keywords you must code exactly as shown. lowercase italic is used to display information you must supply. For example, DASD space parameters may appear as xxxxxxx xxxxxxx xxxxxxx. Underscores either show a default value in a screen image, or represents the highlighting of a word in a screen image. Brackets [ ] mean that you can select one of the items enclosed by the brackets; none of the enclosed items is required. Braces { } mean that you must select one of the items enclosed by the braces. Vertical Bar | separates options. One vertical bar separates two options, two vertical bars separate three options, and so on. You must select one of the options. Ellipsis . means that you can repeat the word or clause that immediately precedes the ellipsis. 1.5 Summary of Revisions Minor technical and editorial revisions have been made throughout the manual. Structured Programming Guide 9 2. Introduction _______________________________ This chapter introduces structured programming with the Structured Programming (SP) Facility. It also disusses the benefits of using the SP Facility over IBM's VS COBOL II and standard COBOL. 2.1 What is Structured Programming? Structured programming is a discipline that helps programmers develop programs efficiently.