COBOL Programmers Guide

  • View
    4.415

  • Download
    2

Embed Size (px)

Transcript

WebSphere Development Studio

ILE COBOL Programmers GuideVersion 5SC09-2540-05

WebSphere Development Studio

ILE COBOL Programmers GuideVersion 5SC09-2540-05

Note! Before using this information and the product it supports, be sure to read the general information under Notices on page 663.

Sixth Edition (February 2006) This edition applies to Version 5, Release 4, Modification Level 0, of IBM WebSphere Development Studio for iSeries (5722-WDS) and to all subsequent releases and modifications until otherwise indicated in new editions. This edition applies only to reduced instruction set computer (RISC) systems. This edition replaces SC09-2540-04. Order publications through your IBM representative or the IBM branch office serving your locality. Publications are not stocked at the address that is given below. IBM welcomes your comments. You can send your comments to: IBM Canada Ltd. Laboratory Information Development 8200 Warden Avenue Markham, Ontario, Canada L6G 1C7 You can also send your comments by facsimile (attention: RCF Coordinator), or you can send your comments electronically to IBM. See How to Send Your Comments for a description of the methods. When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. Copyright International Business Machines Corporation 1993, 2006. All rights reserved. US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

ContentsAbout This Guide . . . . . . . . . . xiWho Should Use This Guide . . . . . . . . . xi Prerequisite and Related Information . . . . . . xii How to Send Your Comments . . . . . . . . xii | What's New This Release? . . . . . . . . . xiii | Changes to this Guide Since V5R2 and V5R3 . . . xiii # What's New in V5R3? . . . . . . . . . . xiv What's New in V5R2? . . . . . . . . . . . xv What's New in V5R1? . . . . . . . . . . xvi What's New in V4R4? . . . . . . . . . . xvii What's New in V4R2? . . . . . . . . . . xviii What's New in V3R7? . . . . . . . . . . . xix What's New in V3R6/V3R2? . . . . . . . . xxi What's New in V3R1? . . . . . . . . . . . xxi Industry Standards . . . . . . . . . . . xxiv An Acknowledgment . . . . . . . . . . . xxv ILE COBOL Syntax Notation . . . . . . . . xxv Reading Syntax Diagrams . . . . . . . . xxvi Identifying Documentary Syntax . . . . . xxviii Interpreting Control Language (CL) Entry Codes . . . . . . . . . . . . . . xxviii Setting the CCSID for the COBOL Syntax Checker in SEU . . . . . . . . . . . Assigning a CCSID to a Locale . . . . . . Runtime CCSID Considerations . . . . . Handling Different CCSIDs with the ILE Source Debugger . . . . . . . . . . . . . . 18 . 18 . 18 . 20

Chapter 3. Compiling Source Programs into Module Objects . . . . . . . . . 21Definition of a Module Object . . . . . . . Using the Create COBOL Module (CRTCBLMOD) Command . . . . . . . . . . . . . . Using Prompt Displays with the CRTCBLMOD Command . . . . . . . . . . . . . Syntax for the CRTCBLMOD Command . . . Parameters of the CRTCBLMOD Command . Example of Compiling a Source Program into a Module Object . . . . . . . . . . . . Specifying a Different Target Release . . . . . Specifying National Language Sort Sequence in CRTCBLMOD . . . . . . . . . . . . Collecting Profiling Data . . . . . . . . . Specifying Date, Time, and Timestamp Data Types Using the PROCESS Statement to Specify Compiler Options. . . . . . . . . . . . . . . PROCESS Statement Options . . . . . . Compiling Multiple Source Programs . . . . Using COPY within the PROCESS Statement . Understanding Compiler Output . . . . . . Specifying the Format of Your Listing . . . Browsing Your Compiler Listing Using SEU . A Sample Program and Listing . . . . . . . 21 . 24 . 24 . 25 . 28 . 46 . 46 . 47 . 48 49 . . . . . . . . 50 56 58 58 59 60 60 61

Part 1. Compiling, Running, and Debugging ILE COBOL Programs . . 1Chapter 1. Introduction . . . . . . . . 3Integrated Language Environment . . . . . . . Major Steps in Creating a Runnable ILE COBOL Program Object . . . . . . . . . . . . . Designing Your ILE COBOL Source Program . . Entering Source Statements into a Source Member Compiling a Source Program into Module Objects Creating a Program Object . . . . . . . . . Running a Program Object . . . . . . . . . Debugging a Program . . . . . . . . . . Other Application Development Tools . . . . . . IBM WebSphere Development Studio for iSeries . WebSphere Development Studio Client for iSeries 3 3 4 6 7 7 7 7 8 8 9

Chapter 4. Creating a Program ObjectDefinition of a Program Object . . . . . . . . The Binding Process . . . . . . . . . . Using the Create Program (CRTPGM) Command . . Example of Binding Multiple Modules to Create a Program Object . . . . . . . . . . . . . Using the Create Bound COBOL (CRTBNDCBL) Command . . . . . . . . . . . . . . . Using Prompt Displays with the CRTBNDCBL Command . . . . . . . . . . . . . . Syntax for the CRTBNDCBL Command . . . . Parameters of the CRTBNDCBL Command . . . Invoking CRTPGM Implicitly from CRTBNDCBL Example of Binding One Module Object to Create a Program Object . . . . . . . . . . . . . Specifying National Language Sort Sequence in CRTBNDCBL . . . . . . . . . . . . . . Reading a Binder Listing . . . . . . . . . . A Sample Binder Listing . . . . . . . . . Modifying a Module Object and Binding the Program Object Again . . . . . . . . . . . Changing the ILE COBOL Source Program . . .

7575 75 77 79 79 80 80 83 86 87 88 88 88 94 94

Chapter 2. Entering Source Statements into a Source Member . . . . . . . . 11Creating a Library and Source Physical File . . . . Entering Source Statements Using the Source Entry Utility . . . . . . . . . . . . . . . . COBOL Source File Format . . . . . . . . Starting SEU . . . . . . . . . . . . . Using the COBOL Syntax Checker in SEU . . . Example of Entering Source Statements into a Source Member . . . . . . . . . . . . . Using Coded Character Set Identifiers . . . . . Assigning a CCSID to a Source Physical File . . Including Copy Members with Different CCSIDs in Your Source File . . . . . . . . . . . 11 12 12 13 13 15 16 17 17

Copyright IBM Corp. 1993, 2006

iii

Changing the Optimization Levels . Removing Module Observability . . Enabling Performance Collection . . Collection Levels . . . . . . Procedures . . . . . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

95 98 99 99 99

Chapter 5. Creating a Service Program 101Definition of a Service Program . . . . . . Using Service Programs . . . . . . . . . Writing the Binder Language Commands for an ILE COBOL Service Program . . . . . . . Using the Create Service Program (CRTSRVPGM) Command . . . . . . . . . . . . . Example of Creating a Service Program . . Using the Retrieve Binder Source (RTVBNDSRC) Command as Input . . . . . . . . . . Calling Exported ILE Procedures in Service Programs . . . . . . . . . . . . . . Sharing Data with Service Programs . . . . . Canceling an ILE COBOL Program in a Service Program . . . . . . . . . . . . . . . 101 . 101 . 102 . 102 . 103 . 104 . 104 . 104 . 105

Chapter 6. Running an ILE COBOL Program . . . . . . . . . . . . . 107Running a COBOL Program Using the CL CALL Command . . . . . . . . . . . . . Passing Parameters to an ILE COBOL Program Through the CL CALL Command . . . . Running an ILE COBOL Program Using a HLL CALL Statement . . . . . . . . . . . Running an ILE COBOL Program From a Menu-Driven Application . . . . . . . . Running an ILE COBOL Program Using a User Created Command . . . . . . . . . . Ending an ILE COBOL Program . . . . . . Replying to Run Time Inquiry Messages . . . . 107 . 107 . 108 . 109 . 110 . 110 . 111

Setting and Removing Unconditional Thread Breakpoints . . . . . . . . . . . . . Setting and Removing Conditional Job Breakpoints . . . . . . . . . . . . . Setting and Removing Conditional Thread Breakpoints . . . . . . . . . . . . . Removing All Breakpoints . . . . . . . . Setting and Removing Watch Conditions . . . . Characteristics of Watches . . . . . . . . Setting Watch Conditions . . . . . . . . Displaying Active Watches . . . . . . . . Removing Watch Conditions . . . . . . . Example of Setting a Watch Condition . . . . . Running a Program Object or ILE Procedure After a Breakpoint . . . . . . . . . . . . . . Resuming a Program Object or ILE Procedure Stepping Through the Program Object or ILE Procedure . . . . . . . . . . . . . Displaying Variables, Constant-names, Expressions, Records, Group Items, and Arrays . . . . . . Displaying Variables and Expressions . . . . Displaying Records, Group Items, and Arrays Changing the Value of Variables . . . . . . . Equating a Name with a Variable, Expression, or Command . . . . . . . . . . . . . . National Language Support for the ILE Source Debugger. . . . . . . . . . . . . . . Changing and Displaying Locale-Based Variables Support for User-Defined Data Types . . . . .

127 128 130 130 130 131 132 134 134 135 136 136 136 139 139 142 144 145 146 146 147

Part 2. ILE COBOL Programming Considerations . . . . . . . . . . 149Chapter 8. Working with Data ItemsGeneral ILE COBOL View of Numbers (PICTURE Clause) . . . . . . . . . . . . . . Defining Numeric Items . . . . . . . . Separate Sign Position (For Portability) . . . Extra Positions for Displayable Symbols (Numeric Editing) . . . . . . . . . . Computational Data Representation (USAGE Clause) . . . . . . . . . . . . . . External Decimal (USAGE DISPLAY) Items . Internal Decimal (USAGE PACKED-DECIMAL or COMP-3) . . . . . . . . . . . . Binary (USAGE BINARY or COMP-4) Items . Internal Floating-Point (USAGE COMP-1 and COMP-2) Items . . . . . . . . . . . External Floating-Point (USAGE DISPLAY) Items . . . . . . . . . . . . . . Creating User-Defined Data Types .