Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Object Oriented Programming With Cobol pptx
PREMIUM
Số trang
238
Kích thước
1.7 MB
Định dạng
PDF
Lượt xem
1179

Tài liệu Object Oriented Programming With Cobol pptx

Nội dung xem thử

Mô tả chi tiết

&2%2/

Issue 2b, March 2004

REMHFWRULHQWHG

SURJUDPPLQJZLWKFRERO

2EMHFWRULHQWHG

oppubb.book Page 1 Tuesday, March 16, 2004 12:23 PM

Copyright © 2004 Micro Focus International Limited.

All rights reserved.

Micro Focus International Limited has made every effort to ensure that this book is

correct and accurate, but reserves the right to make changes without notice at its sole

discretion at any time. The software described in this document is supplied under a

license and may be used or copied only in accordance with the terms of such license,

and in particular any warranty of fitness of Micro Focus software products for any

particular purpose is expressly excluded and in no event will Micro Focus be liable for

any consequential loss.

Animator®, COBOL Workbench®, EnterpriseLink®, Mainframe Express®,

Micro Focus®, Net Express®, REQL® and Revolve® are registered trademarks, and

AAI™, Analyzer™, Application to Application Interface™, AddPack™, AppTrack™,

AssetMiner™, CCI™, DataConnect™, Dialog System™, EuroSmart™, FixPack™,

LEVEL II COBOL™, License Management Facility™, License Server™,

Mainframe Access™, Mainframe Manager™, Micro Focus COBOL™, Object COBOL™,

OpenESQL™, Personal COBOL™, Professional COBOL™, Server Express™,

SmartFind™, SmartFind Plus™, SmartFix™, SourceConnect™, Toolbox™, WebSync™,

and Xilerator™ are trademarks of Micro Focus International Limited. All other

trademarks are the property of their respective owners.

No part of this publication, with the exception of the software product user

documentation contained on a CD-ROM, may be copied, photocopied, reproduced,

transmitted, transcribed, or reduced to any electronic medium or machine-readable

form without prior written consent of Micro Focus International Limited.

Licensees may duplicate the software product user documentation contained on a CD￾ROM, but only to the extent necessary to support the users authorized access to the

software under the license agreement. Any reproduction of the documentation,

regardless of whether the documentation is reproduced in whole or in part, must be

accompanied by this copyright statement in its entirety, without modification.

U.S. GOVERNMENT RESTRICTED RIGHTS. It is acknowledged that the Software and the

Documentation were developed at private expense, that no part is in the public

domain, and that the Software and Documentation are Commercial Computer

Software provided with RESTRICTED RIGHTS under Federal Acquisition Regulations

and agency supplements to them. Use, duplication or disclosure by the U.S.

Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The

Rights in Technical Data and Computer Software clause at DFAR 252.227-7013 et. seq.

or subparagraphs (c)(1) and (2) of the Commercial Computer Software Restricted

Rights at FAR 52.227-19, as applicable. Contractor is Micro Focus, 9420 Key West

Avenue, Rockville, Maryland 20850. Rights are reserved under copyright laws of the

United States with respect to unpublished portions of the Software.

20040316122346

oppubb.book Page 2 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

3

Table of Contents

About this Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Command Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Side Headings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Part 1: Overview

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Object-oriented COBOL syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Developing OO Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

What to Read Next. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Object-oriented Analysis and Design . . . . . . . . . . . . . . . . . . . . . . . . 19

2 OO Programming Concepts . . . . . . . . . . . . . . . . . . . 21

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

oppubb.book Page 3 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

4

Part 2: Object-oriented COBOL Programming

3 Using Objects in Programs . . . . . . . . . . . . . . . . . . . . 33

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Declaring Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

Using Object References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Declaring Object References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Manipulating Object References . . . . . . . . . . . . . . . . . . . . . . . . . 36

Object Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Sending Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

Using the INVOKE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Inline Method Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Invocation Using Object Properties . . . . . . . . . . . . . . . . . . . . . . . 40

Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

Creating a New Instance Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

Destroying Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

Object Destruction Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

Finalized Object References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

4 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Class Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Method Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

Data Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

Files in OO Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Programming Factory Object Behavior . . . . . . . . . . . . . . . . . . . . . . . 56

Factory Object Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Class Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

Factory Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

Programming Instance Object Behavior . . . . . . . . . . . . . . . . . . . . . . 58

Instance Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Instance Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

Instance Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

oppubb.book Page 4 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

5

Parameterized Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

5 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Method Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Predefined Object Reference Names . . . . . . . . . . . . . . . . . . . . . . . . 67

Instance Creation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Get and Set Property Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

PROPERTY Clause in a Data Item Definition . . . . . . . . . . . . . . . 72

PROPERTY Clause in a Method Definition . . . . . . . . . . . . . . . . . 72

Coding the Object Property Syntax . . . . . . . . . . . . . . . . . . . . . . 73

6 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Interface Source Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Interface Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Parameterized Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

7 Compiling and Debugging OO COBOL Applications 81

Compiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Compiler Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Directly Inherited Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

Preventing Reallocation of Object Handles . . . . . . . . . . . . . . . . 84

Finding Memory Leaks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

Object Data Guard Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

Message Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

Troubleshooting Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Memory Exceptions and Protection Violations on Method

Invocations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Symbol Redefined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

Program Not Found . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

oppubb.book Page 5 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

6

Part 3: Tutorials

8 Objects and Messages Tutorial. . . . . . . . . . . . . . . . . 95

The Stopwatch Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

Sending Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

9 Simple Class Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . 101

Structure of a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

Identifying a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

Identifying Classes Used by a Program . . . . . . . . . . . . . . . . . . . . 102

The Factory Object Source Element . . . . . . . . . . . . . . . . . . . . . . . 103

Factory Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

The Instance Object Source Element . . . . . . . . . . . . . . . . . . . . . . 104

Instance Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

Animating the Stopwatch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

10 More Complex Class Tutorial . . . . . . . . . . . . . . . . . . 111

The Personnel Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

Exploring the Personnel Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Animating the Personnel Application . . . . . . . . . . . . . . . . . . . . . . . . 114

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

11 Interfaces and Parameterized Class Tutorial . . . . . . 119

The PClass Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

Exploring the Pclass Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Animating the Pclass Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

oppubb.book Page 6 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

7

Part 4: Micro Focus OO COBOL Alternatives and

Extensions

12 Micro Focus OO COBOL Alternative Syntax . . . . . . 127

Summary of Syntax Alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Shared Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

Working-Storage Section in a Method . . . . . . . . . . . . . . . . . . . . . . . 129

Working Storage and Object Storage . . . . . . . . . . . . . . . . . . . . . . . . 129

Data Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

Direct Data Inheritance in Source Code . . . . . . . . . . . . . . . . . . . 130

Direct Data Inheritance at Run Time . . . . . . . . . . . . . . . . . . . . . 132

Extending a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

13 Requirements-based Vocabulary . . . . . . . . . . . . . . . 137

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

Defining a Vocabulary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

External Class Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

Method Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

User-defined Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Using Vocabulary-defined Verbs and Functions . . . . . . . . . . . . . . . . 141

Part 5: Micro Focus Class Libraries

14 Introduction to the Class Libraries . . . . . . . . . . . . . . 145

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

Public and Private Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

Class Library Method Parameter Types . . . . . . . . . . . . . . . . . . . . . . . 147

Class Library Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

Frameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

Animating the Class Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

oppubb.book Page 7 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

8

15 Collection Frameworks . . . . . . . . . . . . . . . . . . . . . . . 151

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

Different Categories of Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

Creating Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

Creating Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

Working with CharacterArray Objects. . . . . . . . . . . . . . . . . . . . . 156

Creating a CharacterArray Object . . . . . . . . . . . . . . . . . . . . . . . . 156

Querying a CharacterArray Object. . . . . . . . . . . . . . . . . . . . . . . . 157

Comparison Between Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Equality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Relative Value of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Hashing Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

Display Mechanisms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

Using the display Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

Display on a Listbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

Collection Sort Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

Iterator Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

16 Intrinsic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

Using Intrinsic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Cloning an Intrinsic Data Class . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Sending a Message to an Intrinsic Data Type . . . . . . . . . . . . . . . 167

Writing New Intrinsic Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

Code for an Intrinsic Class Object. . . . . . . . . . . . . . . . . . . . . . . . . 168

Code for an Intrinsic Instance Object. . . . . . . . . . . . . . . . . . . . . . 169

17 Callback Frameworks . . . . . . . . . . . . . . . . . . . . . . . . 173

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Using Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Creating a Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

Invoking a Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

oppubb.book Page 8 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

9

18 Exception Handling Frameworks . . . . . . . . . . . . . . . 177

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

Creating an Error Message File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

Registering an Exception Message File . . . . . . . . . . . . . . . . . . . . . . . 179

Raising an Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

Providing Your Own Exception Handlers . . . . . . . . . . . . . . . . . . . . . 182

Writing Exception Handler Methods . . . . . . . . . . . . . . . . . . . . . 183

Registering an Object with the Exception Handler . . . . . . . . . . 185

Canceling an Exception Registration . . . . . . . . . . . . . . . . . . . . . 185

Replacing the System Exception Method . . . . . . . . . . . . . . . . . . . . . 185

19 Component Frameworks. . . . . . . . . . . . . . . . . . . . . . 187

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

Defining Output Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188

Defining Input Sockets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

Connecting Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

Sending Signals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

Part 6: Micro Focus OO COBOL Tutorials

20 Inheritance Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . 197

The Account Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

Simple Account Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

21 Collections, Intrinsics and Dictionaries Tutorial. . . . 203

Collections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

Using Intrinsics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

Iterator Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

oppubb.book Page 9 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

10

22 Exception Handling Tutorial . . . . . . . . . . . . . . . . . . . 215

Raising an Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

Registering an Exception Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

Writing an Exception Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

23 Requirements-based Vocabulary Tutorial . . . . . . . . 223

Introducing the Vocabulary Example . . . . . . . . . . . . . . . . . . . . . . . . . 223

Using Requirements-based Vocabulary . . . . . . . . . . . . . . . . . . . . . . . 225

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

Part 7: Appendices

A Descriptions of OO Run-time Switches . . . . . . . . . . 229

List of Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

oppubb.book Page 10 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

11

About this Book

This book explains how to do object-oriented programming in COBOL,

using ISO 2002 COBOL, Micro Focus OO extensions or a mixture of

both. It includes explanations of concepts, programming tutorials,

programming documentation and information about the Micro Focus

class libraries.

Audience

You should be familiar with the COBOL language and with your

operating system. You should read the Getting Started book and be

familiar with the COBOL development cycle described in your

documentation.

Notation

The notation used in the books is as follows:

• Enter refers to the carriage-return or Enter key. Where commands

to be typed are shown, the Enter key is not shown. It is treated as

implicit that the Enter key must be pressed at the end of the line.

• Hexadecimal numbers are enclosed in quotation marks and

preceded by a lower-case "x" or "h"; for example, x"9D", h"03FF".

The "x" is used when the hexadecimal number represents a

character string; the "h" when it represents a numerical value.

• With COMP-X and COMP-5, PIC X is used rather than PIC 99. Unlike

PIC 99, PIC X shows the length of the data item directly and so

demonstrates more clearly the use of COMP-X, which is to define a

binary item of the specified number of bytes.

oppubb.book Page 11 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

12 About this Book

Command Lines

The notation used to describe the format of command lines is as

follows:

• Words printed in italics are generic terms representing names to be

devised by you.

• Words printed in nonitalic characters are the actual words you must

enter.

Windows: On Windows you can type them in upper, lower, or mixed case

except where otherwise stated.

UNIX: On UNIX you must type them in upper or lower case as shown.

• Square brackets [ ] mean the material inside them is optional.

• Braces { } mean you must choose from the options inside them. If

there is only one option in the braces, they mean repetition.

• An ellipsis (...) following { } or [ ] means you can repeat the material

inside them. The number of repetitions allowed is unlimited unless

otherwise stated. Square brackets [ ] with an ellipsis mean you can

omit the material altogether.

• If a command line does not fit across the page, it is continued on the

next line; the continuation line is indented.

Server Express: • On UNIX, all command line formats and examples are for the

standard UNIX shell, the Bourne shell. If you are using another shell,

see your UNIX documentation for the appropriate formats.

Server Express: • Where examples showing environment variables do not specifically

show them being exported to the shell, it is treated as implicit that

they are exported.

Server Express: • Some keystrokes using function keys or the Alt or Ctrl keys are not

available on all UNIX platforms. The User’s Guide contains a UNIX

Key Usage Chart, listing how the keystrokes shown in the books

map onto actual keystrokes.

oppubb.book Page 12 Tuesday, March 16, 2004 12:23 PM

Notation 13

Object-oriented Programming with COBOL

Side Headings

In a generic book or chapter, text that does not apply to all supported

environments and COBOL systems is marked by a side heading in the

left margin. A side heading applies to the paragraph it is next to, unless

it is next to the first paragraph in a section, in which case it applies to

that whole section.

The following examples of side headings show what they mean:

Server Express: This text applies to Server Express on UNIX.

Net Express: This text applies to Net Express on Windows.

oppubb.book Page 13 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

14 About this Book

oppubb.book Page 14 Tuesday, March 16, 2004 12:23 PM

Object-oriented Programming with COBOL

15

Part 1: Overview

This part contains the following chapters:

• Chapter 1, “Introduction”

• Chapter 2, “OO Programming Concepts”

oppubb.book Page 15 Tuesday, March 16, 2004 12:23 PM

Tải ngay đi em, còn do dự, trời tối mất!