-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathREADME
381 lines (381 loc) · 18.2 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
******************************************************************************
* (c) Copyright IBM Corp. 2007 All rights reserved.
*
* The following sample of source code ("Sample") is owned by International
* Business Machines Corporation or one of its subsidiaries ("IBM") and is
* copyrighted and licensed, not sold. You may use, copy, modify, and
* distribute the Sample in any form without payment to IBM, for the purpose of
* assisting you in the development of your applications.
*
* The Sample code is provided to you on an "AS IS" basis, without warranty of
* any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR
* IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do
* not allow for the exclusion or limitation of implied warranties, so the above
* limitations or exclusions may not apply to you. IBM shall not be liable for
* any damages you suffer as a result of using, copying, modifying or
* distributing the Sample, even if IBM has been advised of the possibility of
* such damages.
*
******************************************************************************
*
* README for IBM MFCOBOL Samples on Linux
*
* The <install_path>/sqllib/samples/cobol_mf directory contains this README
* file where <install_path> is the location of DB2 9.7 on your hard drive.
* The default location for <install_path> is $HOME.
*
* This README describes how to build and run MFcobol sample code for DB2 9.7.
* The DB2 9.7 sample code and build files for MFcobol are located in the
* following directory:
*
* <install_path>/sqllib/samples/cobol_mf
*
* Copy the sample files from this directory to a working directory prior to
* building the sample programs. The sample program directories are typically
* read-only on most platforms and some samples produce output files that
* require write permissions on the directory.
*
* WARNING: Some of these samples may change your database or database manager
* configuration. Execute the samples against a test database
* only, such as the DB2 SAMPLE database.
*
******************************************************************************
*
* Prepare your DB2 sample development environment
*
* 1) Copy the files in <install_path>/sqllib/samples/cobol_mf/* to a working
* directory and ensure that directory has write permission.
*
* 2) Add '/usr/lpp/mfcobol/bin' in your $PATH and
* '/usr/lpp/mfcobol/lib' in your $LIBPATH.
*
* 3) Start the Database Manager with the following command:
* db2start
*
* 4) Create the sample database with the following command:
* db2sampl
*
* 5) Connect to the database with the following command:
* db2 connect to sample
*
* 6) To build Stored Procedures, ensure that you have write permission on the
* <install_path>/sqllib/function directory.
*
* 7) cd to the directory containing the files copied in Step 1.
*
******************************************************************************
*
* Building DB2 Samples
*
* There are two ways to build DB2 samples:using a make utility or using the
* build files that are included with the DB2 sample programs.
*
* o To build samples using the make utility see
* 'BUILDING SAMPLES USING make UTILITY'.
*
* o To build samples using the build files or when you do not have a
* compatible make utility see
* 'BUILDING SAMPLES USING BUILD FILES'.
*
******************************************************************************
*
* *** BUILDING SAMPLES USING make UTILITY ***
*
* If you have a compatible make utility on your system, you can use
* the makefile provided. Such a make utility may be provided by another
* language compiler.Modify the PATH variable to include the directory
* containing the make utility.
*
* Depending on your environment, the makefile might have to be modified.
* For more details refer to the 'VARIABLES' section in the makefile.
*
* Execute the appropriate 'make' command in your working directory:
*
* o make <program name> - builds the sample identified by <program name>
* Do not include the file extension for the
* program name. E.g. make DbAuth
* For any dependencies refer to the individual
* sample.
* o make srv - builds only samples that can be run on the
* server,including routines (stored procedures
* and User Defined Functions).
* o make rtn - builds only routines.
* o make call_rtn - builds only client programs that call routines.
* o make client_run - builds only programs that run completely on the
* client (not ones that call routines).
* o make all_client - builds all client samples (all programs in the
* 'call_rtn' and 'client_run' categories).
* o make all - builds all supplied sample programs
*
* NOTE: Create a database with name SAMPLE2 before running 'make all' as
* some of the samples require two databases. Create second database
* with the following commands:
*
* db2 connect reset -- To disconnect from sample database
* db2 create database sample2 -- Create second database
* db2 connect to sample -- Reconnect to sample database
*
******************************************************************************
*
* *** BUILDING SAMPLES USING BUILD FILES ***
*
* As an alternative to the makefile, the build files included with the
* DB2 samples can be used to build the MFcobol programs.
*
* Building Standalone Samples:
*
* o bldapp <prog_name>
* <prog_name> - the name of the sample program without the
* .sqb/cbl extension.
* For any additional dependencies refer to the individual sample.
*
* Building and Executing Stored Procedures:
*
* o Build stored procedure server and copy the resulting .class file
* to the sqllib/function directory with the following command:
* bldrtn <prog_name>
* <prog_name> - Name of the sample program without the
* .sqb/cbl extension.
*
* o Catalog stored procedures with the following command:
* SpCat
*
* o Build stored procedure client with the following command:
* bldapp <prog_name>
* <prog_name> - Name of the sample program without the
* .sqb/cbl extension.
*
******************************************************************************
*
* Common file Descriptions
*
* The following are the common files for MF COBOL samples. For more
* information on these files, refer to the program source files.
*
*******************************************************************************
*
* Common file
*
* README - this file
* makefile - makefile for all files
*
******************************************************************************
*
* Batch files
*
* bldapp - Builds application programs
* bldrtn - Builds routines (stored procedures)
* embprep - Precompiles and binds embedded SQL programs
*
******************************************************************************
*
* MF cobol samples files descriptions
*
* The following are the common files for MF cobol samples. For more
* information on these files, refer to the program source files.
*
******************************************************************************
*
* MFcobol Sample Descriptions
*
* The following are the MFcobol sample files included with DB2. For more
* information on the sample programs, refer to the program source files.
*
* advsql.sqb - An example using advanced SQL expressions like
* CASE, CAST, and scalar fullselects.
* checkerr.cbl - Demonstrates the use of the following APIs:
* GET ERROR MESSAGE
* INSTALL SIGNAL HANDLER
* INTERRUPT
* This program also contains code to output
* information from an SQLDA.
* client.cbl - Demonstrates the use of the following APIs:
* SET CLIENT
* QUERY CLIENT
* cursor.sqb - Demonstrates the use of a "CURSOR" using static
* SQL.
* d_dbconf.cbl - Demonstrates the use of the following API:
* GET DATABASE CONFIGURATION DEFAULTS
* d_dbmcon.cbl - Demonstrates the use of the following API:
* GET DATABASE MANAGER CONFIGURATION DEFAULTS
* db_udcs.cbl - Demonstrates the use of the following APIs to
* simulate the collating behavior of a DB2 for
* MVS/ESA CCSID 500 (EBCDIC International)
* collating sequence:
* CREATE DATABASE
* DROP DATABASE
* dbauth.sqb - Demonstrates the use of the GRANT
* (Database Authorities) SQL statement
* dbcat.cbl - Demonstrates the use of the following APIs:
* CATALOG DATABASE
* CLOSE DATABASE DIRECTORY SCAN
* GET NEXT DATABASE DIRECTORY ENTRY
* OPEN DATABASE DIRECTORY SCAN
* UNCATALOG DATABASE
* dbcmt.cbl - Demonstrates the use of the following API:
* CHANGE DATABASE COMMENT
* dbconf.cbl - Demonstrates the use of the following APIs:
* CREATE DATABASE
* DROP DATABASE
* GET DATABASE CONFIGURATION
* RESET DATABASE CONFIGURATION
* UPDATE DATABASE CONFIGURATION
* dbinst.cbl - Demonstrates the use of the following APIs:
* ATTACH TO INSTANCE
* DETACH FROM INSTANCE
* GET INSTANCE
* dbmconf.cbl - Demonstrates the use of the following APIs:
* GET DATABASE MANAGER CONFIGURATION
* RESET DATABASE MANAGER CONFIGURATION
* UPDATE DATABASE MANAGER CONFIGURATION
* dbsnap.cbl - Demonstrates the use of the following API:
* DATABASE MONITOR SNAPSHOT
* dbstart.cbl - Demonstrates the use of the following API:
* START DATABASE MANAGER
* dbstat.sqb - Demonstrates the use of the following APIs:
* REORGANIZE TABLE
* RUN STATISTICS
* dbstop.cbl - Demonstrates the use of the following APIs:
* FORCE USERS
* STOP DATABASE MANAGER
* dcscat.cbl - Demonstrates the use of the following APIs:
* ADD DCS DIRECTORY ENTRY
* CLOSE DCS DIRECTORY SCAN
* GET DCS DIRECTORY ENTRY FOR DATABASE
* GET DCS DIRECTORY ENTRIES
* OPEN DCS DIRECTORY SCAN
* UNCATALOG DCS DIRECTORY ENTRY
* delet.sqb - Uses static SQL to delete items from a database.
* dynamic.sqb - Demonstrates the use of a "CURSOR" using dynamic
* SQL.
* ebcdicdb.cbl - Demonstrates the use of the following APIs to
* simulate the collating behavior of a DB2 for
* MVS/ESA CCSID 037 (EBCDIC US English)
* collating sequence:
* CREATE DATABASE
* DROP DATABASE
* expsamp.sqb - Demonstrates the use of the following APIs:
* EXPORT
* IMPORT
* in conjunction with a DRDA database.
* impexp.sqb - Demonstrates the use of the following APIs:
* EXPORT
* IMPORT
* inpcli.sqb - Demonstrates how to call a parameter style GENERAL
* stored procedure. This is the client program of a
* client/server example. (The server program is
* called "inpsrv".) The SQLCA status is returned
* to the client program. This program uses an
* embedded SQL CALL statement to call the stored
* procedure.
* inpsrv.sqb - Demonstrates parameter style GENERAL stored
* procedures. This is the server program of a
* client/server example. (The client program is
* called "inpcli".) The procedure in this file
* inserts a row into the ORG table in the SAMPLE
* database. The server program does all the
* database processing and returns the SQLCA
* status to the client program.
* joinsql.sqb - An example using advanced SQL join expressions.
* loadqry.sqb - Demonstrates how APIs are implemented in order
* to query the current status of a LOAD being
* invoked on the table "TABLE" in the database
* SAMPLE".
* lobeval.sqb - Demonstrates the use of deferring the evaluation
* of a LOB within a database.
* lobfile.sqb - Demonstrates the use of LOB file handles.
* lobloc.sqb - Demonstrates the use of LOB locators.
* dbupgrade.cbl - Demonstrates the use of the following API:
* UPGRADE DATABASE
* monreset.cbl - Demonstrates the use of the follwing API:
* RESET DATABASE SYSTEM MONITOR DATA AREAS.
* monsz.cbl - Demonstrates the use of the following APIs:
* ESTIMATE DATABASE SYSTEM MONITOR BUFFER SIZE
* DATABASE SYSTEM MONITOR SNAPSHOT.
* nodecat.cbl - Demonstrates the use of the following APIs:
* CATALOG NODE
* CLOSE NODE DIRECTORY SCAN
* GET NEXT NODE DIRECTORY ENTRY
* OPEN NODE DIRECTORY SCAN
* UNCATALOG NODE.
* openftch.sqb - Uses static SQL to fetch rows and then UPDATE
* or DELETE them.
* outcli.sqb - Demonstrates stored procedures using the SQLDA
* structure. This is the client program of a
* client/server example. (The server program is
* called outsrv.sqb) This program allocates and
* initializes a one variable SQLDA, and passes it
* to the server program for further processing.
* The filled SQLDA is returned to the client
* program along with the SQLCA status. This
* uses an embedded SQL CALL statement to call
* a stored procedure.
* outsrv.sqb - Demonstrates stored procedures using the SQLDA
* structure. This is the server program of a
* client/server example. (The client program is
* called outcli.sqb) The program fills the SQLDA
* with the median "SALARY" of the employees in the
* "STAFF" table of the "SAMPLE" database. The
* server program does all the database processing
* (finding the median). The server program returns
* the filled SQLDA and the SQLCA status to the
* client program.
* prepbind.sqb - Demonstrates the use of the following APIs:
* BIND
* PRECOMPILE PROGRAM.
* qload.sqb - Demonstrates the use of the LOAD QUERY API.
* rebind.sqb - Demonstrates the use of the REBIND API.
* restart.cbl - Demonstrates the use of the following API:
* RESTART DATABASE MANAGER.
* setact.cbl - Demonstrates the use of the following API:
* SET ACCOUNTING STRING.
* spcat - Script to uncatalog/catalog stored procedures by
* calling spdrop.db2 and spcreate.db2. This script
* must be used for inpsrv, but is not required for outsrv.
* spcreate.db2 - CLP script to catalog the stored procedure called by
* inpcli. This is not required for outsrv.
* spdrop.db2 - CLP script to uncatalog the stored procedure called by
* inpcli. This is not required for outsrv.
* static.sqb - Uses static SQL to retrieve information.
* sws.cbl - Demonstrates the use of the following API:
* DATABASE MONITOR SWITCH.
* tabscont.sqb - Demonstrates the use of the following APIs:
* TABLESPACE CONTAINER QUERY
* OPEN TABLESPACE CONTAINER QUERY
* FETCH TABLESPACE CONTAINER QUERY
* CLOSE TABLESPACE CONTAINER QUERY
* SET TABLESPACE CONTAINER QUERY
* tabspace.sqb - Demonstrates the use of the following APIs:
* TABLESPACE QUERY
* SINGLE TABLESPACE QUERY
* OPEN TABLESPACE QUERY
* FETCH TABLESPACE QUERY
* GET TABLESPACE STATISTICS
* CLOSE TABLESPACE QUERY
* tabsql.sqb - An example using advanced SQL table expressions.
* tload.sqb - Demonstrates the use of the following APIs:
* EXPORT
* QUIESCE TABLESPACES FOR TABLE
* LOAD
* trigsql.sqb - An example using advanced SQL triggers and
* contraints.
* tspace.sqb - Demonstrates the use of the following APIs:
* COPY MEMORY
* FREE MEMORY
* TABLESPACE QUERY
* TABLESPACE CONTAINER QUERY
* SINGLE TABLESPACE QUERY
* OPEN TABLESPACE QUERY
* FETCH TABLESPACE QUERY
* CLOSE TABLESPACE QUERY
* OPEN TABLESPACE CONTAINER QUERY
* FETCH TABLESPACE CONTAINER QUERY
* CLOSE TABLESPACE CONTAINER QUERY
* SET TABLESPACE CONTAINERS
* GET TABLESPACE STATISTICS
* updat.sqb - Uses static SQL to update a database.
* varinp.sqb - An example of variable input to Embedded Dynamic
* SQL calls using parameter markers.
*
******************************************************************************