IBM Application System/400 System/38-Compatible COBOL User's Guide and Reference

IBM Application System/400 System/38-Compatible COBOL User's Guide and Reference

IBM IBM Application System/400 SC09-1814-00 System/38-Compatible COBOL User’s Guide and Reference Note! Before using this information and the product it supports, be sure to read the general information under “Notices” on page xv. First Edition (June 1994) This edition applies to the System/38-Compatible feature of the IBM* ILE* COBOL/400* licensed program, (Program 5763-CB1), Version 3 Release 0 Modification 5, and to all subsequent releases and modifications until otherwise indi- cated in new editions. Make sure you are using the proper edition for the level of the product. Order publications through your IBM representative or the IBM branch serving your locality. Publications are not stocked at the address given below. A form for readers’ comments is provided at the back of this publication. If the form has been removed, you may address your comments to: IBM Canada Ltd. Laboratory Information Development 2G/345/1150/TOR 1150 Eglinton Avenue East, North York, Ontario, Canada M3C1H7 You can also send your comments by facsimile (attention: RCF Coordinator), or you can send your comments elec- tronically to IBM. See "Communicating your Comments to IBM" for a description of the methods. This page imme- diately precedes the Readers' Comment Form at the back of this publication. When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. Copyright International Business Machines Corporation 1994. All rights reserved. Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. IBM is a registered trademark of International Business Machines Corporation, Armonk, N.Y. Contents Notices . xv Trademarks and Service Marks ........................... xv About This Manual .................................. xvii Who Should Use this Manual ............................. xvii What You Should Know ................................ xvii Extensions . xviii Chapter 1. Introduction . 1 General Description . 1 The Major Features of System/38-Compatible COBOL ............... 1 Language Level Supported by System/38-Compatible COBOL .......... 1 Federal Information Processing Standard Flagger .................. 2 How the COBOL Program is Organized ........................ 4 The COBOL Divisions ................................ 5 Section and Paragraphs ............................... 5 Entries and Sentences ................................ 5 Clauses and Statements ............................... 5 Phrases . 6 Characters and Character Strings ........................... 6 Characters . 6 Character Strings . 7 Literals . 7 COBOL Words . 8 PICTURE Character Strings .......................... 12 Comments . 12 Separators . 13 Format Notation . 14 Methods of Referencing Data and Procedures ................... 15 Qualification . 15 Qualification Rules . 17 Subscripting and Indexing ............................. 18 Identifier . 18 Condition-Name . 19 Explicit and Implicit References .......................... 19 Data Attribute Specification ........................... 19 Procedure Division Data References ..................... 19 Transfers of Control ............................... 20 Chapter 2. Coding and Entering Your Program ................ 21 System/38 Environment . 21 Entering the Source Program into the System ................... 21 Using SEU and the System/38-Compatible COBOL Syntax Checker to Enter Source Programs . 22 Standard COBOL Format Used When Entering Code ............... 24 Sequence Numbers (Columns 1-6) ...................... 24 Continuation Area (Column 7) ......................... 25 Area A (Columns 8-11) and Area B (Columns 12-72) ............ 25 Special Considerations . 27 Division Header . 27 Copyright IBM Corp. 1994 iii Section Header . 27 Paragraph Header, Paragraph-Name ..................... 28 Data Division Entries .............................. 28 DECLARATIVES and END DECLARATIVES ................ 28 Program Spacing . 28 Indentation . 28 Continuation of Lines .............................. 29 Comment Lines . 29 Debugging Lines . 29 Blank Lines . 30 Overall Punctuation Rules ............................. 30 Identification Division . 30 Environment Division . 30 Data Division . 30 Procedure Division . 30 COPY Statement . 30 REPLACING Phrase . 32 COPY Statement Example ........................... 34 Chapter 3. Compiling Your Program ...................... 37 Compiler Options . 37 Create COBOL Program Command ......................... 37 Completing the CRTCBLPGM Prompt Screens ................. 38 PROCESS Statement . 46 Batch Compiles . 47 Using COPY within the PROCESS Statement ................ 48 Using SEU to Browse through a Compiler Listing ................. 48 Compiler Output . 49 Command Summary . 49 Listing of Compiler Options ............................ 49 Source Listing . 50 Verb Usage by Count Listing ........................... 52 Data Division Map .................................. 52 FIPS Messages . 55 Cross-Reference List . 56 Messages . 57 Chapter 4. Running and Debugging Your Program .............. 59 If the Program Ends Abnormally ........................... 60 Requesting Data from Job Stream .......................... 60 Debugging Your Program ............................... 60 Using a Test Library .................................. 61 Testing a Program ................................ 62 Running a Program Normally .......................... 62 Using the Same Program in Several Jobs .................. 63 Using Breakpoints . 63 Example of Using Breakpoints ........................... 63 Considerations for Using Breakpoints ...................... 69 Using a Trace ...................................... 71 Example of Using a Trace ............................. 72 Considerations for Using a Trace ......................... 73 Using a Debug Run-Time Switch ........................... 74 File Status . 74 Using a COBOL Formatted Dump .......................... 74 iv System/38-Compatible COBOL User’s Guide and Reference Reply Modes and System Reply List ........................ 75 Example of Using a Dump ............................. 75 Identifying COBOL Problems ............................. 86 Calling for Help ..................................... 88 Chapter 5. Interactive Processing Considerations and Example Programs 89 Externally Described Transaction File ........................ 90 Processing an Externally Described TRANSACTION File ........... 92 Indicators . 92 Indicators in the Record Area ........................... 93 Indicators in a Separate Indicator Area ...................... 93 ASSIGN Clause with Separate Indicator Area Attribute ............ 93 Data Description Entry–Boolean Data ...................... 94 Special Considerations . 94 INDICATORS Phrase . 95 Indicators in the Record Area ........................... 95 Indicators in a Separate Indicator Area ...................... 96 Indicators Example Programs ........................... 96 Subfiles . 106 Use of Subfiles .................................. 108 Multiple Device Files and Single Device Files ................. 112 Program Described Transaction Files ....................... 122 Environment Division . 122 File-Control Entry . 122 ASSIGN Clause . 122 ORGANIZATION Clause . 123 ACCESS MODE Clause ........................... 123 RELATIVE KEY Clause ............................ 124 FILE STATUS Clause ............................. 124 CONTROL-AREA Clause . 124 Data Division . 125 File Description Entry ............................... 125 Boolean Data Facilities .............................. 126 Procedure Division . 126 ACCEPT Statement . 126 Attribute Data Formats ............................ 127 ACQUIRE Statement . 127 CLOSE Statement . 128 DROP Statement . 129 OPEN Statement . 129 Common Processing Facilities .......................... 130 FORMAT Phrase . 130 DB-FORMAT-NAME Special Register .................... 130 INDICATORS Phrase . 130 SUBFILE Phrase . 131 TERMINAL Phrase . 131 READ Statement . 131 REWRITE Statement . 138 WRITE Statement . 140 USE Statement . 145 Work Station Example Programs .......................... 145 Chapter 6. Example Programs . 185 Sequential File Creation ............................. 185 Contents v Sequential File Updating and Extension .................... 188 Indexed File Creation ............................... 190 Indexed File Updating .............................. 192 Relative File Creation ............................... 197 Relative File Updating .............................. 199 Relative File Retrieval .............................. 201 Chapter 7. System/38-Compatible COBOL Programming Considerations 205 Device Independence/Device Dependence .................... 206 Spooling . 207 Output Spool . 208 Input Spool . 208 System Override Considerations .......................... 209 File and Record Locking by COBOL ........................ 209 Releasing a Record Read for Update .................... 210 Unblocking Input Records and Blocking Output Records ............ 210 Externally Described/Program Described Files .................. 211 COBOL Specifications for Externally Described Files ........... 216 Format 2 COPY Statement, DDS or DD Formats ................ 219 Data Structures Generated .......................... 221 Format (Record) Level Structures ...................... 221 Data Field Structures ............................. 222 Indicator Structures . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    646 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us