Upload
kanna-tripuraneni
View
236
Download
2
Embed Size (px)
Citation preview
8/6/2019 About Cobal
1/188SG24-5359
International Technical Support Organization
http://www.redbooks.ibm.com
Client/Server Implementation
Using TXSeries, UDB, and VisualAge COBOLon Windows NT
Andrea Conzett
8/6/2019 About Cobal
2/188
8/6/2019 About Cobal
3/188
Client/Server Implementation
Using TXSeries, UDB, and VisualAge COBOLon Windows NT
June 1999
SG24-535
International Technical Support Organization
8/6/2019 About Cobal
4/188
Copyright International Business Machines Corporation 1999. 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.
First Edition (June 1999)
This edition applies to:
VisualAge COBOL Enterprise Version 2.2
DB2 Universal Database Version 5.2
TXSeries Version 4.2
for use with the Windows NT operating system.
Comments may be addressed to:IBM Corporation, International Technical Support OrganizationDept. QXXE Building 80-E2650 Harry RoadSan Jose, California 95120-6099
When you send information to IBM, you grant IBM a non-exclusive right to use or distribute theinformation in any way it believes appropriate without incurring any obligation to you.
Before using this information and the product it supports, be sure to read the general information Appendix B, Special Notices on page 161.
Take Note!
8/6/2019 About Cobal
5/188 Copyright IBM Corp. 1999
Contents
Figures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Team That Wrote This Redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Comments Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Part 1. Remote DB2 Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 1. Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 2. Setting Up the Server for DB2 . . . . . . . . . . . . . . . . . . . . . .
2.1 Introducing DB2 Universal Database . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Installing DB2 Universal Database . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 DB2 Post-Installation and Configuration . . . . . . . . . . . . . . . . . . . . . .
2.3.1 Installing the DB2 Nodelock File . . . . . . . . . . . . . . . . . . . . . . . .
2.3.2 Creating the Sample Database . . . . . . . . . . . . . . . . . . . . . . . . .
2.3.3 DB2 Universal Database Configuration. . . . . . . . . . . . . . . . . . .
2.3.4 Creating a DB2 User Group . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 3. Setting Up the Clients for DB2 . . . . . . . . . . . . . . . . . . . . .
3.1 Installing the DB2 Software Developers Kit . . . . . . . . . . . . . . . . . . .
3.1.1 Basic Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.2 Client Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Installing DB2 Client Application Enabler . . . . . . . . . . . . . . . . . . . . .
3.3 Installing VisualAge COBOL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.1 Basic Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.2 FixPak Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 4. Developing the DB2 Sample Application . . . . . . . . . . . . .
4.1 Creating a VisualAge COBOL Project. . . . . . . . . . . . . . . . . . . . . . . .
4.2 Designing the Graphical User Interface . . . . . . . . . . . . . . . . . . . . . .
4.2.1 Adding Visual Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.2 Make the Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.3 Generate the Basic Application Files . . . . . . . . . . . . . . . . . . . .
4.3 Coding the Feature Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.1 DB2 Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.2 GUI Parts Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.3 Additional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Building the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8/6/2019 About Cobal
6/188iv VisualAge COBOL Client/Server on Windows NT
Chapter 5. Packaging the Sample Application . . . . . . . . . . . . . . . . . .
Part 2. Two-Tier Client/Server with TXSeries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 6. Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 7. Setting Up TXSeries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1 Introducing TXSeries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1 TXSeries Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.2 TXSeries Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2 Installing CICS for Windows NT . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.1 CICS Server Runtime Component . . . . . . . . . . . . . . . . . . . . . .
7.2.2 CICS Server Development Component. . . . . . . . . . . . . . . . . . .
7.3 CICS for Windows NT Configuration. . . . . . . . . . . . . . . . . . . . . . . . .
7.3.1 Configuring DCE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.2 Setting Up a Queue Manager . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.3 Configuring a CICS Region. . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.4 Configuring a Listener Process. . . . . . . . . . . . . . . . . . . . . . . . . 7.3.5 Starting the CICS Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 8. Setting Up CICS Client. . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1 Installing CICS Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 CICS Client Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2.1 Modifications on the Client . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2.2 Modifications on the Server . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
8.3 Starting a CICS Terminal on the Client . . . . . . . . . . . . . . . . . . . . . . .
Chapter 9. Developing the CICS Sample Server Application. . . . . . .9.1 Creating the WorkFrame Project . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 Coding the Program Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.1 CICS Communication Area . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.2 SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.3 CICS Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.4 Additional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3 Building the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4 Installing the Program on the Server . . . . . . . . . . . . . . . . . . . . . . . . 1
9.5 Defining the Resources in CICS . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.5.1 Program Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9.5.2 XA Product Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 10. Developing the CICS Sample 3270 Client Application . .
10.1 Creating the WorkFrame Project . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2 Coding the Program Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8/6/2019 About Cobal
7/188
10.2.1 CICS Communication Area . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.2 CICS Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.3 Additional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.3 Coding the BMS Map Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
10.4 Building the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.4.1 Creating the BMS Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.4.2 Creating the Program DLL . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.5 Installing the Program on the Server . . . . . . . . . . . . . . . . . . . . . . . 110.6 Defining the Resources in CICS . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.6.1 Program Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.6.2 BMS Map Set Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.6.3 Transaction Definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.7 Running the Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 11. Developing the CICS Sample GUI Client Application . . .
11.1 Non-CICS Programs Running under CICS Client . . . . . . . . . . . . . . 1
11.1.1 The External Presentation Interface (EPI). . . . . . . . . . . . . . . .
11.1.2 The External Call Interface (ECI) . . . . . . . . . . . . . . . . . . . . . .11.2 Creating the WorkFrame Project . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3 Designing the Graphical User Interface . . . . . . . . . . . . . . . . . . . . .
11.4 Coding the Feature Source. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.4.1 CICS Communication Area . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.4.2 Using Transaction Assistant . . . . . . . . . . . . . . . . . . . . . . . . . .
11.4.3 ECI Call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.4.4 GUI Parts Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.4.5 Additional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.5 Building the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.6 Running the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix A. Files Used in This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
A.1 Salary Increase Application (DB2 Only) . . . . . . . . . . . . . . . . . . . . . . . . .
A.2 Employee Lookup CICS/DB2 Server Program . . . . . . . . . . . . . . . . . . . .
A.3 Employee Lookup 3270 Client Program . . . . . . . . . . . . . . . . . . . . . . . . .
A.4 Employee Lookup GUI Client Program. . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix B. Special Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Appendix C. Related Publications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1C.1 International Technical Support Organization Publications . . . . . . . . . .
C.2 Redbooks on CD-ROMs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3 Other Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How to Get ITSO Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
IBM Redbook Fax Order Form. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8/6/2019 About Cobal
8/188vi VisualAge COBOL Client/Server on Windows NT
List of Abbreviations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ITSO Redbook Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8/6/2019 About Cobal
9/188 Copyright IBM Corp. 1999
Figures
1. Windows NT LAN-Based Environment with UDB . . . . . . . . . . . . . . . . . .
2. Select Products Window (DB2 Universal Database) . . . . . . . . . . . . . . . .
3. Select Installation Type Window (DB2 Universal Database) . . . . . . . . . .
4. Select Destination Directory Window (DB2 Universal Database) . . . . . .
5. Enter Username and Password for the Administration Server Window. .
6. Start Copying Files Window (DB2 Universal Database) . . . . . . . . . . . . .
7. New Product Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8. Nodelock Administration Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9. First Steps Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10. Control Center Showing Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11. Sample Contents Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12. DB2 TCP/IP Configuration Information . . . . . . . . . . . . . . . . . . . . . . . . . .
13. TCP/IP Services File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14. Control Center Showing TCP/IP Configuration . . . . . . . . . . . . . . . . . . . .
15. Services Window (Windows NT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16. Service Window (Windows NT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17. User Manager Window (Windows NT). . . . . . . . . . . . . . . . . . . . . . . . . . . .
18. New Local Group Window (Windows NT) . . . . . . . . . . . . . . . . . . . . . . . .
19. Add Users and Groups Window (Windows NT). . . . . . . . . . . . . . . . . . . .
20. DB2 Control Center (DB Groups) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21. Add Group Window (Database Tab) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22. Add Table Window (DB2 UDB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23. Add Group Window (Table Tab) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24. Complete Setup Window (SDK). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25. Client Configuration Assistant - Welcome Window . . . . . . . . . . . . . . . . . 26. Add Database SmartGuide Window . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27. Add Database SmartGuide - Target Database . . . . . . . . . . . . . . . . . . . .
28. Connect To DB2 Database Window . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29. Client Configuration Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30. Installation Type Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31. Select VisualAge COBOL Enterprise Components Window . . . . . . . . . .
32. Setup Complete Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33. Project Smarts - COBOL Visual Builder Project - Projects Page. . . . . . .
34. Project Smarts - COBOL Visual Builder Project - Location Page . . . . . .
35. IBM VisualAge COBOL Project - Employees Salaries Increase . . . . . . . 36. SALINC - Composition Editor (Initial Setting) . . . . . . . . . . . . . . . . . . . . .
37. SALINC - Composition Editor (Basic Parts). . . . . . . . . . . . . . . . . . . . . . .
38. SALINC - Part Interface Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39. SALINC - System Interface Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40. SALINC - Composition Editor (Final Status) . . . . . . . . . . . . . . . . . . . . . .
8/6/2019 About Cobal
10/188viii VisualAge COBOL Client/Server on Windows NT
41. Reorder Connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42. Database Mapping Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43. SQL Construction Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44. Employees Salaries Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45. Windows NT LAN-Based Environment with UDB and TXSeries . . . . . . .
46. Select Product to Install Window (CICS Server) . . . . . . . . . . . . . . . . . . .
47. Select Product to Install Window (CICS Production System) . . . . . . . . . .
48. CICS Server Production System Components Window . . . . . . . . . . . . . 49. Create Database SmartGuide Window . . . . . . . . . . . . . . . . . . . . . . . . . .
50. Client Settings (TP Monitor Name) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51. Client Setting (Transaction Manager DB Name) . . . . . . . . . . . . . . . . . . .
52. New CICS Region Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53. Listener Definition Window (Local Terminal) . . . . . . . . . . . . . . . . . . . . . .
54. Sample cicslcli.ini File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55. Transaction Server Administration Window. . . . . . . . . . . . . . . . . . . . . . .
56. Start CICS Region Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57. Setup Type (CICS Client) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
58. Install Option Window (CICS Client) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59. CICSCLI.INI File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60. Listener Definition Window (Remote Terminal) . . . . . . . . . . . . . . . . . . . .
61. TCP/IP Services File (After CICS Setup). . . . . . . . . . . . . . . . . . . . . . . . .
62. Change Profile Window (LPEX Editor) . . . . . . . . . . . . . . . . . . . . . . . . . .
63. LPEX Editor Initial Ruler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64. LPEX Editor COBOL Ruler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65. CICS Communication Area Definition . . . . . . . . . . . . . . . . . . . . . . . . . . .
66. Defining DFHCOMMAREA in the Server Program . . . . . . . . . . . . . . . . .
67. Data Structure Mapping View Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . .
68. Module Definition File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69. Transaction Server Programs Window . . . . . . . . . . . . . . . . . . . . . . . . . .
70. Transaction Server Program Definition Notebook (Program) . . . . . . . . .
71. Transaction Server Product Definition Notebook. . . . . . . . . . . . . . . . . . .
72. New Part Window (BMS Editor). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73. Map Workspace Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74. Map Editor Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
75. CICSMAP Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76. Transaction Server Program Definition Notebook (Map Set). . . . . . . . . .
77. Transaction Server Transaction Definition Notebook (General Page). . .
78. Transaction Server Transaction Definition Notebook (Transaction Page)
79. CICS Client 3270 Terminal Emulator. . . . . . . . . . . . . . . . . . . . . . . . . . . .
80. EMPLLUGU - Composition Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81. Transaction Assistant (Required Parameters) . . . . . . . . . . . . . . . . . . . . .
82. Transaction Assistant (Optional Fields) . . . . . . . . . . . . . . . . . . . . . . . . . .
83. Employee Lookup GUI Client Application . . . . . . . . . . . . . . . . . . . . . . . .
8/6/2019 About Cobal
11/188 Copyright IBM Corp. 1999
Preface
This redbook details the configuration of a client/server environment
consisting of IBM VisualAge COBOL, DB2 Universal Database, and TXSe
products on Windows NT. Installation and customization details as well as
some application development techniques are covered.
The book was written for those interested in the interaction of the abovefamily of products when the applications are written in COBOL. Technical
marketing, application development, and local area networking personnel
find this information particularly useful.
The book guides the reader, step by step, in creating a working client/serv
environment, for both application development as well as application
execution. This environment can be used for demonstration or as a refere
when setting up a similar environment for productive use.
Several practical examples are used throughout the book. Because the mfocus of the book is on the environment and the interaction of the product
the program samples are kept as simple as possible.
First, we provide the setup of an environment that only includes remote d
access. Once the sample program is running, you know that your DB2
Universal Database (UDB) is installed and configured correctly. You can th
go on to the next step, in which we add TXSeries to this scenario. We exp
the environment by means of a CICS server program that accesses a DB
database. This server program is called by a 3270 CICS client program a
well as an external call interface (ECI) cl ient program with a graphical useinterface (GUI).
The Team That Wrote This Redbook
This redbook was written by Andrea Conzett, an Advisory Information
Technology Specialist at IBMs International Technical Support Organizati
San Jose Center. He writes extensively and teaches IBM classes worldwi
on all areas of COBOL and PL/I application development as well as on al
application development related issues of the Year 2000 challenge. He ha
13 years of experience in application development from both IBM internal a
customer projects. Before joining the ITSO, Andrea worked in IBM
Switzerland as Product Manager for all application development tools.
Thanks to the following people for their invaluable contributions to this
project:
8/6/2019 About Cobal
12/188x VisualAge COBOL Client/Server on Windows NT
Joerg Reinschmidt
International Technical Support Organization, San Jose Center
Luis Ennser
International Technical Support Organization, San Jose Center
Pat McCarthy
International Technical Support Organization, San Jose Center
Hanspeter Nagel
International Technical Support Organization, San Jose Center
Wilbert Kho
IBM Santa Teresa Laboratory
Comments Welcome
Your comments are important to us!
We want our redbooks to be as helpful as possible. Please send us your
comments about this or other redbooks in one of the following ways:
Fax the evaluation form found in ITSO Redbook Evaluation on page
to the fax number shown on the form.
Use the online evaluation form found at http://www.redbooks.ibm.com
Send your comments in an internet note to [email protected]
8/6/2019 About Cobal
13/188 Copyright IBM Corp. 1999
Part 1. Remote DB2 Acce
8/6/2019 About Cobal
14/1882 VisualAge COBOL Client/Server on Windows NT
8/6/2019 About Cobal
15/188 Copyright IBM Corp. 1999
Chapter 1. Overview
Our first sample environment only includes DB2 as a subsystem. We wan
make sure that the DB2 installation and configuration is correct before we
introduce CICS as the next subsystem.
The sample program is a COBOL program that selects some rows from a
DB2 table, performs some calculations, and displays the results through agraphical user interface. The DB2 table is in a UDB server database on a
different workstation than the one where the program is running. The serv
is accessed through TCP/IP.
Our setup includes three workstations:
The server workstation holds the DB2 Universal Database and the sam
database, used for the development of the application as well as durin
the execution of it.
One client workstation is used for the development of the application.VisualAge COBOL has to be installed on it.
One client workstation is only used for the execution of the application
Only some COBOL runtime files have to be copied along with the actu
program executables and DLLs.
The Windows NT LAN-based client/server environment includes the follow
products:
Microsoft Windows NT Server Version 4.0
Microsoft Windows NT Workstation Version 4.0
IBM DB2 Universal Database for Windows NT Version 5.2
IBM VisualAge COBOL Version 2.2
Figure 1 on page 4 shows which products and features we installed on wh
workstations to create our first sample environment.
8/6/2019 About Cobal
16/1884 VisualAge COBOL Client/Server on Windows NT
Figure 1. Windows NT LAN-Based Environment with UDB
This is just one example of how to install the products on different machin
The environment does not have to look like that in Figure 1. Therefore we
the following comments:
Windows NT Server
Your workstations may already be connected to a local area
network (LAN). If so, you do not need to install Windows NT
Server again. You may, however, want to install the server on o
of your workstations in order to define a domain you control. Y
could then, for example, use the hard disk of the server machi
to store common COBOL copy books and share them among y
developers.
DB2 UDB Workgroup EditionThis is the server version of the DB2 database. It provides the
function to create and manage DB2 databases that can be
accessed by many clients in a LAN. You can install the DB2 ser
on any workstation in your LAN; it does not have to be the
workstation where your Windows NT Server is installed. Howe
Server Workstation
Client Workstation 1 Client Workstation 2
Windows NT Server
DB2 UDB Workgroup Edition
Windows NT Workstation
DB2 Software Developers Kit
VisualAge COBOL
Windows NT Workstation
DB2 Client Access Enabler
TCP/IP
8/6/2019 About Cobal
17/188Overview
UDB Workgroup Edition and CICS for Windows NT have to be
the same workstation if used in the configuration as described
Part 2, Two-Tier Client/Server with TXSeries on page 67.
Client Workstation 1
We use this client workstations as an application development
workstation. The application development environment itself as
set it up is also a client/server environment because the DB2 p
or co-compiler is requesting the database definitions from the D
server. However, if you do not want to use DB2 UDB Workgrou
Edition in the application development environment, you can
install DB2 UDB Personal Edition instead on the workstation
where you have VisualAge COBOL installed. DB2 UDB Person
Edition provides the function to create and manage DB2
databases that can only be accessed locally, which means by
workstation where it resides. It does not accept requests from
remote clients. But it can act as a client to a remote server
database.
Client Workstation 2
We use this workstation only to execute a client program which
accesses a database on the server workstation.
DB2 Client Application Enabler (CAE)
You have to install this feature on all the workstations where yo
execute a program which accesses a DB2 database on a
database server. The DB2 Software Developers Kit includes C
DB2 Software Developers Kit (SDK)
You have to install this product on all the workstations where ywant to develop DB2 applications. SDK includes the DB2 Clien
Application Enabler. The DB2 pre-compiler or co-compiler can
therefore access the DB2 server databases when precompiling
DB2 program.
VisualAge COBOL
You have to install VisualAge COBOL on all the workstations
where you want to develop COBOL applications. But it is not
needed for the execution of a COBOL program. You can packa
your application files together with some COBOL runtime files a
copy them on every workstation you like for execution.
8/6/2019 About Cobal
18/1886 VisualAge COBOL Client/Server on Windows NT
8/6/2019 About Cobal
19/188 Copyright IBM Corp. 1999
Chapter 2. Setting Up the Server for DB2
On our server workstation we installed Windows NT Server. In this book w
do not describe how to install and configure this product. Its configuration
depends not only on DB2 UDB but also on all the other services which yo
server may have to provide. However, it is not the purpose of this book to
explain how you would use Windows NT Server, for example, as a file or p
server. Refer to the product documentation if you have to install and config
the operating system and need assistance.
However, make sure that TCP/IP is configured on your Windows NT Serv
2.1 Introducing DB2 Universal Database
DB2 Universal Database is a relational database management system
(RDBMS) that is available for Intel and UNIX environments. Together with
DB2 on OS/400, VSE/VM, and OS/390, it makes up what is known as theDB2 Family.
DB2 provides seamless database connectivity using the most popular
network communications protocols, including NetBIOS, TCP/IP, IPX/SPX
Named Pipes, and APPC. The infrastructure (but not the protocol) within
which DB2 database clients and DB2 database servers communicate is
provided by DB2.
There are three main DB2 products:
1. DB2 Universal Database (UDB) There are four versions of the DB2Universal Database:
DB2 Personal Edition An RDBMS engine that will not accept
incoming database requests from remote clients (available on the In
platform only). But it can act as a client to access a remote databas
DB2 Workgroup Edition An RDBMS engine that will accept incom
database requests from remote clients (available on the Intel platfo
only).
DB2 Enterprise Edition Similar to Workgroup Edition, but also allo
remote client applications to access data on a host database. Itcontains DB2 Workgroup Edition plus DB2 Connect (see below).
DB2 Enterprise-Extended Edition Similar to the Enterprise Editio
with additional support for clusters of database servers in a partition
database environment.
8/6/2019 About Cobal
20/1888 VisualAge COBOL Client/Server on Windows NT
In our sample environment we would like to access a database on a
remote server, and we do not have to access a database on a host
system. Therefore we need to install DB2 UDB Workgroup Edition.
2. DB2 Connect Provides the ability to access a host database with th
Distributed Relational Database Architecture (DRDA). There are two
versions of the product:
DB2 Connect Personal Edition Provides access to host databaseonly from the workstation where it is installed (available on the Inte
platform only).
DB2 Connect Enterprise Edition Provides the ability for multiple
clients (CAE) to access host data through a gateway.
In our sample environment we do not need to access a database on a h
system. Therefore we do not have to install DB2 Connect.
3. DB2 Developer's Edition Provides the ability to develop and test a
database application for one user. There are two versions of the produ
DB2 Personal Developer's Edition Contains the following tools a
products:
DB2 UDB Personal Edition
DB2 Connect Personal Edition
Software Developers Kit (SDK) Provides the environment an
tools you need to develop applications that access DB2 databas
using embedded SQL or the DB2 call level interface (CLI).
Extender Support Provides the ability to define large object d
types.
VisualAge for Java Professional Edition A suite of application
development tools for building Java-compatible applications,
applets, servlets, and JavaBean components.
Lotus Approach Provides a graphical interface to perform
queries, develop reports and analyze data.
DB2 Universal Developer's Edition Contains all the same tools a
products as the Personal Developers Edition, plus:
DB2 UDB Workgroup Edition
DB2 UDB Enterprise Edition
DB2 Connect Enterprise Edition
Lotus Domino Go WebServer A scalable, high-performance W
server that runs on a broad range of platforms.
8/6/2019 About Cobal
21/188Setting Up the Server for DB2
Net.Data A comprehensive World Wide Web (WWW)
development environment to create dynamic Web pages or comp
Web-based applications that can access DB2 databases.
In order to develop our sample COBOL application, the only product of
DB2 Developers Edition we need to install is the Software Developer
Kit.
All DB2 products have a common component called the DB2 ClientApplication Enabler (CAE). Once a DB2 application has been developed,
DB2 Client Application Enabler component must be installed on each
workstation executing the application.
The Client Application Enabler provides functions other than the ability to
communicate with a DB2 UDB server or DB2 Connect gateway machine.
From the CAE, you can do any of the following:
Issue an interactive SQL statement using the CAE on a remote client t
access data on a remote UDB server.
Graphically administer and monitor a UDB database server
Run applications that were developed to comply with the open databas
connectivity (ODBC) standard.
Run Java applications that access and manipulate data in DB2 UDB
databases using Java database connectivity (JDBC).
There is a different CAE for each supported DB2 client operating system.
complete set of CAEs is provided with DB2 UDB Workgroup Edition,
Enterprise Edition, Enterprise-Extended Edition, and DB2 Connect EnterpEdition. DB2 UDB Personal Edition provides the CAE for the same platfor
as it runs itself.
2.2 Installing DB2 Universal Database
On our server workstation we only have to install DB2 Universal Database
Workgroup Edition in terms of DB2 products. We are accessing the serve
database through DB2 clients and we do not access data on host system
Make sure that you have enough disk space on your system. A typical DBUDB Workgroup installation requires about 140MB of disk space.
To install DB2 Universal Database on your workstation, follow these steps
1. Insert the DB2 UDB CD in the CD drive or run setup.exe if there are DB
UDB install disk images anywhere on your LAN that you can access.
8/6/2019 About Cobal
22/18810 VisualAge COBOL Client/Server on Windows NT
2. Click on Next on the Welcome window. On the Select Products window
select the check box for the DB2 Universal Database Workgroup Editio
(Figure 2). This is the product that allows us to use remote clients to
access its databases, but does not include DB2 Connect. Click on Nex
Figure 2. Select Products Window (DB2 Universal Database)
3. On the next window (Figure 3 on page 11) you can choose from three
different installation types:
Typical installation A typical set of DB2 components will be
installed, and DB2 will be configured for the protocols on the system
Besides the East Asian conversion support, all the components will
installed. All the communication protocols that are configured on th
workstation will be configured in DB2.
Compact installation Only required DB2 files will be installed, a
minimal configuration will be performed. No graphical tool and no
documentation will be installed.
Custom installation You can select the components that you wa
installed and specify configuration options for DB2. For instance, yo
can install the graphical tools but not the documentation. For examp
you can configure only TCP/IP but not NetBIOS, even if NetBIOS is
configured on the workstation.
We selected the typical installation. It requires more disk space than th
other options, but we have enough space on our system.
8/6/2019 About Cobal
23/188Setting Up the Server for DB2
Figure 3. Select Installation Type Window (DB2 Universal Database)
4. If you selected the typical installation, the Destination Directory window
appears (Figure 4). Accept the default drive and directory. Or, if you do
want applications to be installed on your Windows partition or if there i
not enough space on the C-drive, you can change the drive. But do no
change the directory name (SQLLIB) if possible. It is easier to find the
product and your databases if you keep the default name. Click on Ne
Figure 4. Select Destination Directory Window (DB2 Universal Database)
5. The Username and Password window appears (Figure 5 on page 12).
8/6/2019 About Cobal
24/18812 VisualAge COBOL Client/Server on Windows NT
Figure 5. Enter Username and Password for the Administration Server Window
When the DB2 Administration Server (DAS) instance is started, you hato log on (or be logged on) with a user ID that has the following proper
It must have administrator privilege on your Windows NT system.
It must be eight characters long or less.
It has to comply with DB2 naming rules, which means
Valid characters are A through Z, a through z, 0 through 9, #, @
and $.
It must not begin with SYS, sys, IBM, ibm, SQL or sql.
The DB2 Administration Server is a special DB2 instance for managing
local and remote DB2 servers. The DAS instance provides a remote cli
with the ability to administer and detect the instances and databases o
UDB database server.
In general, the tasks performed by the DAS instance are:
Query the operating system for configuration information
Query the operating system for user and group information
Start/Stop DB2 instances
Attach to a DB2 instance to perform administration at the database
level, such as altering values in the database manager configuratio
create/drop, backup, or recover a database
Provide a scheduler that is used to execute jobs locally and remote
8/6/2019 About Cobal
25/188Setting Up the Server for DB2
Provide a mechanism for DB2 Discovery to return DB2 UDB server
information to remote clients
The DB2 Administration Server instance can be used to perform
administrative tasks for the database server from a remote client. All
remote DB2 administration tasks will be sent to the DAS instance for lo
execution at the server.
The Windows NT built-in default administrator ID is Administrator. Thisname has more than eight characters and is therefore not valid as a D
Administrator ID. Therefore, the setup program fills the Username,
Password and Confirm Password fields on the Username and Passwo
window with db2admin.
You can accept these values or provide your own. The installation
program checks if the specified user name is valid in terms of naming
conventions and if it exists. If it does not, the DB2 setup program create
as belonging to the administrator group. If it does exist, the installation
program checks if the user has administrator authority and if the passw
is valid.
6. The Start Copying Files window as shown in Figure 6 on page 14 lists
of the:
Installation options you specified Assumed installation options based on the installation type
Configuration specifications for one DB2 instance and the DAS
instance, based on the selected or detected communication protoco
The user ID you specify as DB2 administrator ID is a regular Window
NT administrator ID. It has no specific function or privilege in regard
DB2. This has two consequences:
You do not have to use the administrator ID you specified during t
DB2 installation to perform a DB2 or database administrator functio
You can use any Windows NT user ID with administrator privilege Every Windows NT user ID on your system with administrator
privilege can act as DB2 or database administrator. Therefore, if f
security reasons, you want to limit database administrator functio
to a specific person, you have to install DB2 UDB on a system whe
this person is also the Windows NT administrator.
Attention
8/6/2019 About Cobal
26/18814 VisualAge COBOL Client/Server on Windows NT
Click on Install to perform the actual installation. A progress window is
displayed while the installation process copies the files to the destinati
directory, and configures DB2 for communication.
After the installation you have to restart your system.
Figure 6. Start Copying Files Window (DB2 Universal Database)
2.3 DB2 Post-Installation and Configuration
After restarting your Windows NT Server you may want to configure some
elements to your needs. You can also verify if your installation and basic
communication configuration was successful. And, for our sampleapplication, you have to create the sample database.
2.3.1 Installing the DB2 Nodelock File
If you have a license for your DB2 UDB Workgroup Edition (or whatever
version you installed), you have to install the license key. In DB2 this is ca
the Nodelock File. If you do not have a license, you may use the product
60 days. After this evaluation period you either have to get a license and
install it, or you have to remove DB2 from your workstation.
To install the license key do the following:
1. Stop DB2 if the service is started. To stop DB2 simply type db2stop in a
Windows command prompt window and press enter.
2. Select Programs => License Use Runtime => Nodelock
Administration Tool from the Windows NT Start menu.
8/6/2019 About Cobal
27/188Setting Up the Server for DB2
3. On the Nodelock Administration Tool window (Figure 8 on page 16) se
New... from the Products menu.
4. Click on Import... on the New Product window. On the Import window
select the file Db2work.lic from the drive and directory where it is store
for example, the floppy drive (A:) and click on OK. The New Product
window is displayed again with the license information filled in (Figure
Click on OK.
Figure 7. New Product Window
5. The Nodelock Administration Tool window is displayed again showing D
UDB as installed and licensed product (Figure 8 on page 16).
8/6/2019 About Cobal
28/18816 VisualAge COBOL Client/Server on Windows NT
Figure 8. Nodelock Administration Tool
6. Start DB2 again by typing db2start in a Windows command prompt
window.
2.3.2 Creating the Sample Database
If you restart your system the first time after you installed DB2 UDB, the F
Steps window is displayed automatically (Figure 9). Click on Create the
SAMPLE database. The creation of the database may take several minut
You will be notified when the creation has finished.
Figure 9. First Steps Window
8/6/2019 About Cobal
29/188Setting Up the Server for DB2
2.3.3 DB2 Universal Database Configuration
After the installation, DB2 should be configured correctly. There should be
need to configure anything manually. However, you can check the
configuration and see where you can find the parameters in case you have
change something later. We also found it useful to change settings for so
services.
2.3.3.1 Using the Control Center
To check if DB2 UDB and the SAMPLE database have been installedcorrectly, you can use the Control Center. The Control Center is the centr
point of administration for DB2 Universal Database Version 5. It provides
user with the tools necessary to perform typical database administration
tasks. It allows easy access to all server administration tools, gives a clea
overview of the entire system, enables remote database management, an
provides step-by-step assistance for complex tasks.
If you performed a typical installation, by default the Control Center is star
when Windows NT is started. If you are not a database administrator you
not need the Control Center all the time. Therefore you may not want it tostart automatically. If so, just delete it from the startup folder at the follow
location:
C:\WINNT\Profiles\All Users\Start Menu\Programs\Startup
You can always start the Control Center by selecting Programs => DB2 f
Windows NT => Administration Tools => Control Center from the
Windows NT Start menu.
On the Control Center window expand all the system and instance levels
clicking on the + signs. The SAMPLE database should show up. Click on Tables icon to get a list of all the tables in your database on the right half
the Control Center as shown in Figure 10 on page 18.
DB2 uses the user ID, with which you are logged on to your Windows N
system, as CREATOR for the user tables of the sample database. You
have to remember this name when you develop your applications which
access these tables.
Note
8/6/2019 About Cobal
30/18818 VisualAge COBOL Client/Server on Windows NT
Figure 10. Control Center Showing Tables
Click on any table with the right mouse button and select Sample content
from the popup menu. If you get a list with the content of the rows of the ta
you selected, your installation was successful. Figure 11 shows the conten
the EMPLOYEE table.
Figure 11. Sample Contents Window
8/6/2019 About Cobal
31/188Setting Up the Server for DB2
2.3.3.2 Checking TCP/IP Configuration
If you want to access a database from a remote client through TCP/IP, so
parameters have to be configured on the server system. When you config
the client you have to know these parameters. The Client Access Enabler
needs them to find the correct database server.
If the DB2 installation program detects TCP/IP as one of the installed
communication protocols on your system, it configures it automatically forDB2. It adds the corresponding information to the Database Manager
configuration file and to the TCP/IP services file.
You can find the information you need for the DB2 client configuration in
C:\Sqllib\db2cfg.txt. It looks as shown in Figure 12:
Figure 12. DB2 TCP/IP Configuration Information
The TCP/IP services file is located in the following directory:
C:\WINNT\system32\drivers\etc
The DB2 installation program adds the following lines at the end of the file
called services (Figure 13 on page 20):
The following protocol settings have been made for this servers DB2instance.
Refer to this information when configuring remote clients manually orusing the Client Configuration Assistant.
NetBIOSWorkstation Name:N00B9B68Adapter Number:1
TCP/IPService Name:db2cDB2Port Number:50000
Named PipesNamed Pipes
The following protocol settings have been made for the Administrationserver.
NetBIOSWorkstation Name:N01B9B68Adapter Number:1
TCP/IPService Name:db2cDB2adminPort Number:523
Named PipesDISCOVER_COMM NETBIOS,TCPIP
8/6/2019 About Cobal
32/188
8/6/2019 About Cobal
33/188Setting Up the Server for DB2
The DB2 Security Server is not started automatically by default. This serv
is needed when you want to access data through an application. And that
what we are going to do with our sample program. We therefore change t
service to be automatically started.
To change service settings, do the following:
1. Select Settings => Control Panel from the Windows NT Start menu.
2. Double click on the Services icon.
3. Select DB2 - DB2DAS00 from the list and click on Startup... as shown
Figure 15.
Figure 15. Services Window (Windows NT)
4. Select Manual on the Service window (Figure 16) and click on OK.
Figure 16. Service Window (Windows NT)
8/6/2019 About Cobal
34/18822 VisualAge COBOL Client/Server on Windows NT
5. Click on Stop on the Services window to stop the DAS immediately.
6. Repeat these steps for the DB2 Security Server. On the Service windo
select Automatic instead of Manual, and on the Services window click
Start instead of Stop.
If you need the DB2 Administration Server, for example, to create a DB2 u
group as described in Chapter 2.3.4, Creating a DB2 User Group on pag
22, you can start and stop the DAS service manually. To do this you can uthe services interface as described above, or you can type the following
commands in a Windows command prompt window:
db2admin start to start the DB2 Administration Server
db2admin stop to stop the DB2 Administration Server
2.3.4 Creating a DB2 User Group
The Windows NT administrators have all the DB2 privileges for all the
databases on their systems. By default, regular users have no DB2 privilegat all. Therefore, if a user has to access a database or run a program that
accesses a database, you have to grant the corresponding privileges to th
user.
Using the DB2 Control Center you can create DB2 users and grant all the
necessary privileges to each individual user. The users you define in DB2
must exist as Windows NT users. The Windows NT user manager facility
the only place where you can define a password for a user.
If you have several users which should have the same DB2 privileges, yo
can define a user group in DB2. You can then grant all the necessary DB2
privileges to the group. Using the Windows NT user manager facility you c
assign individual users to the user group. Every user that belongs to the
group gets the privileges defined for the group.
In our sample environment we have two client workstations. The user IDs t
are usually used on these client workstations are defined as users on the
server. Both clients should be able to access the sample database. We
therefore created a DB2 group and added the clients to this group.
To create a DB2 group on your server, do the following:
1. Select Programs => Administrative Tools (Common) => User Mana
for Domains from the Windows NT Start menu on your server.
2. Select New Local Group... from the User menu as shown in Figure 17
page 23.
8/6/2019 About Cobal
35/188Setting Up the Server for DB2
Figure 17. User Manager Window (Windows NT)
3. On the New Local Group window (Figure 18) enter a Group Name.
Because this group will be defined in DB2 too, make sure that the nam
you choose complies with the DB2 naming conventions:
It must be eight characters long or less.
Valid characters are A through Z, a through z, 0 through 9, #, @ an
It must not begin with SYS, sys, IBM, ibm, SQL or sql.
Click on Add... to add the users that you want to belong to this group.
Figure 18. New Local Group Window (Windows NT)
8/6/2019 About Cobal
36/18824 VisualAge COBOL Client/Server on Windows NT
4. On the Add Users and Groups window (Figure 19) select all the users y
want and click on Add. Press and hold the control or the shift key whil
clicking on the user names if you want to select more than one user.
Click on OK. The New Local Group window now contains all the users y
selected. Click on OK.
Figure 19. Add Users and Groups Window (Windows NT)
5. Start the DB2 Control Center and expand all levels including database
On the bottom of the SAMPLE database list there is a folder called Us
and Group Objects. Expand this folder. Click on DB Groups with the r
mouse button as shown in Figure 20 on page 25 and select Add....
8/6/2019 About Cobal
37/188Setting Up the Server for DB2
Figure 20. DB2 Control Center (DB Groups)
6. On the Add Group window select the group that you just created throu
the Windows NT User Management. The Group combo box contains a
the Windows NT user groups which you created yourself.
Select the necessary authorities on the database level for this group a
shown in Figure 21 on page 26. For our sample environment the client
need to be able to access the database (CONNECT authority) and to
create packages in the database (BINDADD). This is required if you w
to develop a program that accesses the database.
8/6/2019 About Cobal
38/18826 VisualAge COBOL Client/Server on Windows NT
Figure 21. Add Group Window (Database Tab)
7. Select the Table tab and click on Add Table.... Select all the table of th
SAMPLE database on the Add Table window (Figure 22) and click on A
Figure 22. Add Table Window (DB2 UDB)
Close the Add Table window.
8. The Add Group window now contains a table with all the DB2 tables y
selected. Select all the rows and then select yes from the combo box lat the bottom of the table for the following privileges:
SELECT
INSERT
UPDATE
DELETE
8/6/2019 About Cobal
39/188Setting Up the Server for DB2
These are all the privileges our sample users may need. The other
privileges are intended for database administrators. Figure 23 shows t
Add Group window (Table tab) after we selected all the privileges for a
the tables. Click on Apply and then Close.
Figure 23. Add Group Window (Table Tab)
DB2 Universal Database is now installed and configured on your server
workstation. The database that we use in the sample application is create
and the necessary authorizations are set. You can go on and install the cli
workstations that are going to use the SAMPLE database on the server.
8/6/2019 About Cobal
40/18828 VisualAge COBOL Client/Server on Windows NT
8/6/2019 About Cobal
41/188 Copyright IBM Corp. 1999
Chapter 3. Setting Up the Clients for DB2
On our client workstations we installed Windows NT Workstation. In this bo
we do not describe how to install and configure this product. Refer to the
product documentation if you have to install and configure the operating
system and need assistance.
However, make sure that TCP/IP is configured on your Windows NTWorkstation.
In our sample environment we have two clients: one application developm
client and a pure execution client. In this chapter we describe in detail how
install and configure all the system software needed on both client
workstations.
On the application development client:
DB2 Software Developers Kit (SDK)
VisualAge COBOL
On the execution client:
DB2 Client Application Enabler (CAE)
3.1 Installing the DB2 Software Developers Kit
On the application development client machine we need to install the DB2
Software Developers Kit (SDK). DB2 SDK is a collection of tools that are
designed to meet the needs of database application developers. It includelibraries, header files, documented APIs, and sample programs to build
character-based, multimedia, or object-oriented applications.
You can install DB2 SDK on the server with the DB2 Universal Database,
on a remote workstation. If you install it on the server, the DB2 SDK can
access both remote and local databases. If you install it on a client, the D
SDK can access only remote databases. DB2 SDK includes DB2 Client
Application Enabler.
There is a platform-specific version of the DB2 SDK available for each of
supported operating systems. Applications developed with the DB2 SDK w
run on any platform where the equivalent DB2 Client Application Enabler
component is installed. Through the DB2 Client Application Enabler, these
applications can access all DB2 servers and, by using DB2 Connect, they
also access other database servers that support DRDA.
8/6/2019 About Cobal
42/18830 VisualAge COBOL Client/Server on Windows NT
The DB2 SDK allows you to develop applications that use the following
interfaces:
Embedded SQL
Call level interface (CLI) development environment (which is compatib
with ODBC from Microsoft)
Java Database Connectivity (JDBC)
Application programming interfaces to access database utilities
DB2 SDK supports several programming languages (including COBOL, C
and C++) for application development, and provides precompilers for the
supported languages. However, VisualAge COBOL provides its own DB2
co-compiler.
The SDK installation consists of two parts:
The basic installation of the software
The client configuration
3.1.1 Basic Installation
The installation of DB2 Software Developers Kit is similar to the DB2
Universal Database installation. Refer toSection 2.2, Installing DB2
Universal Database on page 9 for the pictures as well as some further
explanations. To install DB2 Software Developers Kit on your workstation
follow these steps:
1. Insert the DB2 Application Developers Kit CD in the CD drive or run
setup.exe if the corresponding install disk images are anywhere on yoLAN.
2. Click on Next on the Welcome window. Select the check box on the
Enable Remote Administration window. This will install the Control Cen
on your client machine. When you are developing applications, you mi
have to create tables or views. Or maybe you want to check some tab
and column names. The Control Center helps you to do this from your
development client workstation.
Click on Next.
3. As with the Universal Database installation (see item 3 on page 10) yocan choose from three different installation types:
Typical installation
Compact installation
Custom installation
8/6/2019 About Cobal
43/188Setting Up the Clients for DB2
We selected the typical installation, which requires about 116 MB of di
space.
4. If you selected the typical installation, the Destination Directory window
appears. Accept the default drive and directory. Click on Next.
5. The Start Copying Files window lists all the settings that you selected
the installation. Click on Install to perform the actual installation. A
progress window is displayed while the installation process copies the fto the destination directory, and configures DB2 for communication.
6. When the installation has finished, the Complete Setup window appea
(Figure 24). Select Reboot and start the Client Configuration Assist
and click on Finish. You can also just reboot and configure the client a
later time. But the client has to be configured, otherwise it does not fin
the databases on the DB2 server.
Figure 24. Complete Setup Window (SDK)
3.1.2 Client Configuration
When you reboot your system after you installed DB2 SDK, the Client
Configuration Assistant is automatically started.
The Client Configuration Assistant (CCA) can be used to configure your cliworkstation to access remote DB2 Universal Database servers. The Clien
Configuration Assistant provides three methods of configuration:
Search the local network for databases by using DB2 Discovery
This option allows you to automate the configuration the most. You do
have to know communication-specific details.
8/6/2019 About Cobal
44/18832 VisualAge COBOL Client/Server on Windows NT
Use an access profile Your database or system administrator can
provide you with a file that contains all the information needed to config
connections to databases. If you use this option you just have to select
database you wish to connect to.
Enter the database name and the communication protocol for the
DB2 server You can enter all the information needed to configure
connections to databases manually. This is the most complex option.
SmartGuide will guide you step by step until all the needed information
entered.
The Client Configuration Assistant can be started any time from the DB2 f
Windows NT start menu. When you start CCA the Welcome window appe
as shown in Figure 25. Click on Add Database.
Figure 25. Client Configuration Assistant - Welcome Window
The Add Database SmartGuide window appears (Figure 26 on page 33). T
SmartGuide helps you add databases to the list of databases to which yo
applications can connect. It catalogs nodes and databases while shielding
you from the inherent complexities of these tasks. After you finish defining
connection between your workstation and a database server, the SmartGu
8/6/2019 About Cobal
45/188Setting Up the Clients for DB2
saves the information and creates an entry in the list of available databas
Each entry is identified by a unique name (alias) that is used by your
applications when connecting to a database.
Figure 26. Add Database SmartGuide Window
Select the Search the network radio button. The notebook in the Add
Database SmartGuide window gets additional pages. You have to go throu
these pages and add the required information. To do this you can click on
Next button on the bottom of the window.
Note: If you use the Search the network option, you have to make sure t
the DB2 Administration Server service is started on the host where you w
to get the database information from. See Section 2.3.3.3, Changing Serv
Settings on page 20 for information about how to start this service manu
Open the Target Database page and expand the Other Systems. When th
list of systems in your neighborhood (host names) shows up, expand the
system where the database you want to access is located, and select the
database. This is shown in Figure 27 on page 34.
As you might remember from Section 2.3.3, DB2 Universal Database
Configuration on page 17, we installed DB2 UDB and the Sample databa
on a machine with the host name SICILY.
8/6/2019 About Cobal
46/18834 VisualAge COBOL Client/Server on Windows NT
After you configured a remote database on your client, the host where thi
database resides will show up under Known Systems.
Figure 27. Add Database SmartGuide - Target Database
On the Alias page you have to provide a unique name as an alias for the
database. The alias is the name that is used by applications running on y
workstation to identify a database. The alias can be 1 to 8 alphanumeric
characters. Because most likely the sample database is on every machine
the network where DB2 is installed, we use SAMP5359 as alias for oursample environment.
For our sample environment the database does not have to be registered
ODBC. Therefore, on the ODBC page you can un-check the Register thi
database for ODBC check box.
After you selected a database and specified an alias for it, you can click o
Done at the bottom of the window. The configuration is being added and
confirmation window shows up. Click on Test Connection to check if the
configuration is correct. Make sure that the database manager is started o
your server. On the Connect To DB2 Database window (Figure 28 on pag
35) enter the user ID and password that you defined for this client in Sect
2.3.4, Creating a DB2 User Group on page 22.
A message window will show up telling you if the connection was success
8/6/2019 About Cobal
47/188Setting Up the Clients for DB2
Figure 28. Connect To DB2 Database Window
The Client Configuration Assistant window now contains an entry for the
database you just configured (Figure 29). From this window you can addadditional databases or change the communication properties manually if
necessary.
Your environment is now ready to develop DB2 applications.
Figure 29. Client Configuration Assistant
3.2 Installing DB2 Client Application Enabler
Within the DB2 client/server environment, application processing is carrie
out by both the client and the server workstations. The DB2 server produc
8/6/2019 About Cobal
48/18836 VisualAge COBOL Client/Server on Windows NT
contains the necessary communications support to allow requests from
remote DB2 clients to be accepted. Database client functions are provided
the DB2 Client Application Enabler.
The CAE is a common component to all DB2 products and is included in D
UDB Workgroup Edition and the DB2 Software Developers Kit. The CAE
allows application programs to access DB2 data stored on any IBM DB2 U
relational database. On the execution client we do not have a databasemanager or SDK installed. Therefore we have to install CAE separately o
the execution client workstation.
Run the setup.exe from your DB2 UDB Workgroup Edition CD. Select the D
Client Application Enabler check box from the Select Products window
(Figure 2 on page 10).
The CAE installation is similar to the installation of the SDK as described
Section 3.1.1, Basic Installation on page 30. But if you really just run the
application from this workstation and do not perform any administrator tas
you do not have to install the Control Center. Therefore do not select the
check box on the Enable Remote Administration window.
Select the typical installation. It requires about 55 MB of disk space. Whe
you select the typical installation, the installation program also configures
DB2 for all the protocols that are installed on your system.
After the installation you have to configure the database you want to acce
This is exactly the same procedure as described for the SDK. When the C
installation is complete, you can select to reboot and automatically start th
Client Configuration Assistant.
Refer to Section 3.1.2, Client Configuration on page 31 for instructions o
how to configure the DB2 client. Select the same database and use the sa
alias as in this section.
Once you installed and configured the corresponding DB2 components on
server, the development client, and the execution client, you do not have
use DB2 anymore. You can now start to develop your sample application.
first you have to install VisualAge COBOL.
3.3 Installing VisualAge COBOL
IBM VisualAge COBOL Enterprise is a powerful application development
environment. It includes many tools that support the development and
maintenance of all kinds of COBOL programs.
8/6/2019 About Cobal
49/188Setting Up the Clients for DB2
Some of the features are:
IBM COBOL Compiler
Based on COBOL for MVS and VM
32-bit direct-to-SOM compiler
Standards conforming
ANSI 85 COBOL
ANSI OO COBOL (Draft) Millennium Language Extensions
Enhanced Editor
Live parsing editor
Data Assistant for DB2 access
Transaction Assistant for CICS ECI calls
Visual application builder
VisualAge family Visual Builder
Library of GUI parts
Program logic parts
OO COBOL code generator
Language Environment Date/Time Callable Services
Additional 4-digit year support
Interactive debug tool
Source-level debugging
Local and remote data access
VSAM via SMARTdata Utilities DB2
BTrieve
Record-oriented local file access
Performance Analyzer
Provides COBOL paragraph support
Visual optimization and tuning of complex applications
Developer's toolkit
Linker and make utilities DB2 Co-Processor
Remote development
Remote Edit/Compile/Debug with OS/390 and MVS from a Window
NT workstation
8/6/2019 About Cobal
50/18838 VisualAge COBOL Client/Server on Windows NT
WorkFrame
Full Workplace Shell integration
Project organizer
Open and configurable tool integration framework
Host data type support
EBCDIC data
Hex floating point data
Native database support
IBM DB2; Oracle; Sybase
ODBC support
Middleware support
TXSeries
MQSeries
BMS - Editor Visual builder for CICS basic mapping support source generation
Re-development tools
Application Understanding
Program Conversion and Structuring (PCS)
Program Understanding
Year 2000 Impact Analysis Tool
Millennium Language Extensions Wizard
For our sample application we do not need all of the features and tools.Therefore, when you install the product, you only have to select the
components needed for the sample application. However, if you have eno
space on your workstation, you can install the entire product and just play
around with all the great powerful tools.
The current version of VisualAge COBOL Enterprise is 2.2. Some feature
have been made available through a FixPak.
3.3.1 Basic Installation
To install VisualAge COBOL Enterprise, follow these steps:
1. Log on to your development workstation with a user ID that has
administrator authority.
2. Close all running Windows programs on your system.
8/6/2019 About Cobal
51/188Setting Up the Clients for DB2
3. Insert the VisualAge COBOL CD into the CD drive. Read the install.t
file in the root directory of the CD.
4. Run setup.exe from the root directory of the CD. Click on Next on the
VisualAge COBOL for Windows welcome window.
5. The Installation Type window appears (Figure 30). There are two types
you can choose from:
Personal Installation This is for a single user on one workstatioFor a Personal Install, environment variables are in the user area.
Administrator authority is not required for Personal Installation.
Common Installation This allows an administrator to install, an
one different user to use, the same workstation. VisualAge COBOL
does not support multiple users. If CICS for Windows NT is on the
system you must use Common Install. For Common Install, your
environment variables are put in the system environment area. To
install in the system area requires administrator authority. The user
must run the utility IWZWUPDT on his user account once afterinstallation. Otherwise he cannot see the VisualAge COBOL produc
the start menu.
Because you are going to develop CICS programs on this workstation
later in the book, you need to install CICS for Windows NT here. Theref
you have to select Common Installation. Click on Next.
Figure 30. Installation Type Window
6. The Select VisualAge for COBOL Enterprise Components window
appears (Figure 31). Deselect all the components you do not want to
install. Some of the components depend on others. Application
8/6/2019 About Cobal
52/18840 VisualAge COBOL Client/Server on Windows NT
Understanding, for example, requires the Remote Edit/Compile/Debug
feature. Therefore, as long as Application Understanding is selected, y
cannot deselect Remote Edit/Compile/Debug.
The components needed for the sample application of this book are:
Visual Builder
Program Editor
Workframe Transaction Assistant
Data Assistant
We recommend additionally installing at least:
Documentation
Debugger
Samples
Keep the default destination folder. You cannot install VisualAge COBO
in a directory structure that has a blankas part of the directory name,
example:
D:\VisualAge COBOL\PRODUCT
The install itself works; however, some components do not run correct
Click on Next.
Figure 31. Select VisualAge COBOL Enterprise Components Window
7. The Start Copying Files window lists all the settings that you selected
the installation. Click on Install to perform the actual installation. A
8/6/2019 About Cobal
53/188Setting Up the Clients for DB2
progress window is displayed while the installation process copies the f
to the destination directory.
8. After the installation has completed, an information window appears
reminding you to run IWZWUPTD if you want to use VisualAge COBO
with another user ID than the administrator ID used to install the produ
Click on OK. Because we are installing the products ourselves, we are
using the administrator ID also to use the products. Therefore we do n
have to run IWZWUPTD.
9. When the installation has finished, you have to reboot your system. Yo
can select the corresponding option from the Setup Complete window
(Figure 32) and click on Finish.
Figure 32. Setup Complete Window
10.If, before installing VisualAge COBOL, you had an LPATH or LPATH2
environment variable that pointed to private LPEX macros, you need to
append the contents of the LPATH or LPATH2 environment variable to
contents of the COBLPATH4 environment variable (which is created by
VisualAge COBOL).
For example, if LPATH or LPATH2 contained:
D:\MYMACROS
As a result of installing VisualAge COBOL, assume the COBLPATH4
environment variable was set to:
E:\IBMCOBW\MACROS
Then you should update the COBLPATH4 environment variable to:
E:\IBMCOBW\MACROS;D:\MYMACROS
8/6/2019 About Cobal
54/18842 VisualAge COBOL Client/Server on Windows NT
3.3.2 FixPak Installation
You can find the latest FixPak for VisualAge COBOL Enterprise Version 2
on the Internet at
http://www.software.ibm.com/ad/cobol/cobofix.htm
At the time this book is being published, FixPak 2 is the current service le
You can download either a ZIP file or an executable file. If you choose the
file you can open it using WINZIP or PKZIP. Run setup.exe. If you choose
file cobf2win.exe, save it to a temporary directory on your workstation and
execute it.
The installation of the FixPak is similar to the basic installation. On the
Installation Type window, select Typical Installation. This will install the fi
for all the VisualAge COBOL components that are installed on the system
8/6/2019 About Cobal
55/188 Copyright IBM Corp. 1999
Chapter 4. Developing the DB2 Sample Application
The first sample scenario is now set up. In order to verify this installation a
configuration we will develop a small sample program that runs on the clie
workstation and accesses the sample database on the server. Refer to
Appendix A, Files Used in This Book on page 157 for information on how
get the code of the sample application.
The sample application consists of one window. You can specify a salary
increase in percent and click on a button. The window then displays a list w
all the employees, their initial, and their increased salary.
The program logic includes accessing the EMPLOYEE table of the sampl
database and calculating the new salary.
In order to develop the sample application you have to:
Create a project
Design the graphical user interface
Code the feature source
Build the application
4.1 Creating a VisualAge COBOL Project
To create a WorkFrame project in VisualAge COBOL follow these steps:
1. Select Programs => VisualAge COBOL for Windows => Accessing
COBOL Projects from the Windows NT Start menu. On the next wind
select Create new project.
2. On the Project Smarts window select COBOL Visual Builder Project
shown in Figure 33 on page 44 and click on Next. There are four pages
a Visual Builder project.
8/6/2019 About Cobal
56/18844 VisualAge COBOL Client/Server on Windows NT
Figure 33. Project Smarts - COBOL Visual Builder Project - Projects Page
3. On the Location page you have to provide the following information:
The title of the project as it will appear in WorkFrame when you ope
the project.
The directory where you want to store the source code and all the
generated files.
By default this is a subdirectory of the IBMCOBW directory whereVisualAge COBOL is installed. We recommend using a different
directory for the program source of your application programs. This
way it is easier to install a new version of VisualAge COBOL in the
future.
VisualAge COBOL automatically creates the directory for you if you
specify one that does not exist yet.
The location where you want the project file being created. The pro
file is generated and contains all the information about the project t
WorkFrame needs, for example, the source file directory and thecompiler options.
By default VisualAge COBOL creates a folder on your desktop calle
COBOL_Projects. We use this folder to store the project file. If you
want to open an existing project, the COBOL_Projects folder is a
convenient place to look for the projects.
8/6/2019 About Cobal
57/188Developing the DB2 Sample Application
The name of the project as it will show up in the COBOL_Projects
folder.
Figure 34 shows the values we specified on the Location page for the f
sample application.
Figure 34. Project Smarts - COBOL Visual Builder Project - Location Page
4. On the Target page you only have to specify the name that you want t
target executable to be called. This name will also be used for the projmakefile and as a default for the project source files. The name can be
to eight alphanumeric characters. For our sample we specify SALINC as
target name.
5. VisualAge COBOL automatically creates a help facility for every windo
you create for your application. On the Help page of the Project Smart
notebook you can specify which format you want to use for the help, IB
Information Presentation Facility (IPF) or Microsofts Rich Text Format
(RTF). This is important because you have to write the source for the h
texts. The default is IPF, which is fine for us.
6. Click on Done in the lower right corner of the Project Smarts notebook
The project you just created opens as shown in Figure 35 on page 46.
8/6/2019 About Cobal
58/18846 VisualAge COBOL Client/Server on Windows NT
Figure 35. IBM VisualAge COBOL Project - Employees Salaries Increase
4.2 Designing the Graphical User Interface
If you do not want to develop the application, you can just copy the files fo
this project to the source file directory you specified when you created the
project. Refer to Appendix A, Files Used in This Book on page 157 to fin
out what files you need for the first sample and where to find them.
But if you want to develop the sample yourself using VisualAge COBOL, a
the visual parts, make the connections, and generate all the necessary fil
4.2.1 Adding Visual Parts
In the WorkFrame project window, double click on the file with the extens
VCB (in our case SALINC.VCB) to start the Visual Builder. The Composit
Editor window appears with a default window as shown in Figure 36 on pa47.
The first step is to graphically design the window we need and the fields a
buttons on this window. If you are not familiar with the VisualAge GUI build
please refer to the manual VisualAge COBOL, Getting Started on Window
Version 2.2. Go through the chapter "Creating a Simple Visual Builder
Application" to learn how to add parts to a window and the free-form surfa
and how to make simple connections. You will also learn how to resize an
align the parts.
8/6/2019 About Cobal
59/188Developing the DB2 Sample Application
Figure 36. SALINC - Composition Editor (Initial Setting)
Add the following parts on the window:
Static text as a label for the entry field.
Text entry field Limit the length to 5. We do not want to increase the
salary by more than 99.99 percent. In the program we will add more in
validation. We named this part efIncrease. This name is used in the
program.
Static text as heading for the list box Use a monospaced font, like
Courier.
List box Use a monospaced font, like Courier. The rows contain ma
spaces. With a proportional font, the columns will not be aligned. We
named this part SalaryList. This name is used in the program.
Static text as a message line We named this part ErrMsg. This name
used in the program.
An additional push button to execute the program logic Make this p
button the default button (on the Styles page of the settings notebook
this part), instead of the Close push button.
8/6/2019 About Cobal
60/18848 VisualAge COBOL Client/Server on Windows NT
Change the title of the window and the label of the push button and align
the parts as you like. You can also rename the parts, but you have to
remember the names of the entry field, list box, and message line (static
text), when you code the program.
Figure 37 shows the Composition Editor with all the visual parts.
Figure 37. SALINC - Composition Editor (Basic Parts)
The list box is not the best visual part to display the content of a table. T
use of a container with columns would be more appropriate. But the
emphasis of this book is not on the use of the Visual Builder. We therefo
chose the list box, which is simpler to handle.
A word about the list box
8/6/2019 About Cobal
61/188Developing the DB2 Sample Application
4.2.2 Make the Connections
Initially there is one connection on the window: close the window when th
Close push button is pressed. You need at least one additional connectio
When the Get New Salaries push button is pressed, the program logic sho
be executed.
Before you can add this connection you have to add an action. Click on th
button in the lower right corner of the window to get to the Part InterfaceEditor. Click on the Action page. Type an Action name and the Action met
and click on Add. You can use the action name that you specify here in th
Composition Editor to make the connection. We specified getSalary as act
The action method is used by the code generator for the COBOL source
code.
After you clicked on Add, the USING parameter you specified in the actio
method shows up in the Parameters and their types list. The type should
VarLengthString. If it is anything else, change it and click on Update.
Figure 38 shows the Part Interface Editor Action page.
Figure 38. SALINC - Part Interface Editor
Click on the middle button in the lower right corner of the window to get to
System Interface Editor and go to the Generation Options page. Select th
User declaration file (.cpv) and the User code file (.cbv) check boxes a
specify the file names as shown in Figure 39 on page 50.
8/6/2019 About Cobal
62/18850 VisualAge COBOL Client/Server on Windows NT
Figure 39. SALINC - System Interface Editor
Go back to the Composition Editor by clicking on the leftmost button in th
lower right corner of the window. Draw a connection from the Get New
Salaries push button (press) to the free-form surface, that is the area outs
the Employees Salaries window. Select the action (getSalary) that you jus
created.
The connection line is dotted because you specified a USING parameter
when you defined the action method. This parameter that is being passed
the program is the content of the input field on the window (increase
percentage).
Therefore draw a connection from the input field (content) to the dotted lin
and select the parameter that you specified in the Part Interface Editor, in
case efIncrease.
Figure 40 on page 51 shows the final status of the GUI design in the
Composition Editor, including all the visual parts and the connections. Theare four additional connections which do not affect the business logic of th
application, but make using it a l ittle easier for the user:
Connection from the free form surface to the entry field to enable the fo
on the entry field when the application is ready to start.
8/6/2019 About Cobal
63/188Developing the DB2 Sample Application
Connection from the Get New Salaries push button to the list box to
initially remove all items from the list box when the button is pressed,
before the list box is filled by the getSalary action.
Connection from the Get New Salaries push button to the entry field to
enable the focus on the entry field after the action is executed and the
results are displayed. By doing this, the user can enter a new percenta
without having to click on the entry field first.
Connection from the Get New Salaries push button to the entry field to
cause the content of the entry field being selected from the end of the t
With this connection there is also a parameter required, which is the te
length of the entry field. In this manner, the user can enter a new
percentage without having to erase the previous one first.
Figure 40. SALINC - Composition Editor (Final Status)
Make sure that you create the connections in the correct sequence. You
should, for example, remove all items from the list box before you execute
action which populates the list box. You can always rearrange the
connections by clicking with the right mouse button on the push button an
selecting Reorder Connections From. From the list of your connections ju
drag and drop them in the correct place. The correct sequence of the
connections in our sample is shown in Figure 41 on page 52.
8/6/2019 About Cobal
64/18852 VisualAge COBOL Client/Server on Windows NT
Figure 41. Reorder Connections
4.2.3 Generate the Basic Application Files
Select Save and generate from the File menu and run all the th