******************************************************************************
* (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 COBOL Samples on Windows
*
* The <install_path>\sqllib\samples\cobol 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 cobol sample code for DB2 9.7.
* The DB2 9.7 sample code and build files for cobol are located in the
* following directory:
*
* <install_path>\sqllib\samples\cobol
*
* 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\* to a working
* directory and ensure that directory has write permission.
*
* 2) Add '\usr\lpp\cobol\bin' in your $PATH and
* '\usr\lpp\cobol\lib' in your $LIBPATH.
*
* 3) Start the Database Manager with the following command:
* db2start
*
* 4) Create the sample database with the following command:
* db2sampl -v8
*
* 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 nmake utility or using the
* build files that are included with the DB2 sample programs.
*
* o To build samples using the nmake utility see
* 'BUILDING SAMPLES USING nmake UTILITY'.
*
* o To build samples using the build files or when you do not have a
* compatible nmake utility see
* 'BUILDING SAMPLES USING BUILD FILES'.
*
******************************************************************************
*
* *** BUILDING SAMPLES USING nmake UTILITY ***
*
* If you have a compatible nmake utility on your system, you can use
* the makefile provided. Such a nmake utility may be provided by another
* language compiler.Modify the PATH variable to include the directory
* containing the nmake 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 'nmake' command in your working directory:
*
* o nmake <program name>- builds the sample identified by <program name>
* Do not include the file extension for the
* program name. E.g. nmake DbAuth
* For any dependencies refer to the individual
* sample.
* o nmake srv - builds only samples that can be run on the
* server, including routines (stored procedures
* and User Defined Functions).
* o nmake rtn - builds only routines.
* o nmake call_rtn - builds only client programs that call
* routines.
* o nmake client_run - builds only programs that run completely on
* the client (not ones that call routines).
* o nmake all_client - builds all client samples (all programs in
* the 'call_rtn' and 'client_run' categories).
* o nmake all - builds all supplied sample programs
*
* NOTE: Create a database with name SAMPLE2 before running 'nmake 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 cobol programs.
*
* Building Standalone Samples:
*
* o bldapp.bat <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.bat <prog_name>
* <prog_name> - Name of the sample program without the
* .sqb/cbl extension.
*
* o Catalog stored procedures with the following command:
* SpCat.bat
*
* o Build stored procedure client with the following command:
* bldapp.bat <prog_name>
* <prog_name> - Name of the sample program without the
* .sqb/cbl extension.
*
******************************************************************************
*
* Common file Descriptions
*
* The following are the common files for COBOL samples. For more
* information on these files, refer to the program source files.
*
******************************************************************************
*
* Common files
*
* README - this file
* makefile - makefile for all files
*
******************************************************************************
*
* Batch files
*
* bldapp.bat - Builds application programs
* bldrtn.bat - Builds routines (stored procedures)
* embprep.bat - Precompiles and binds embedded SQL programs
*
******************************************************************************
*
* COBOL Sample Descriptions
*
* The following are the COBOL sample files included with DB2. For more
* information on the sample programs, refer to the program source
* files.
*
******************************************************************************
*
* Cobol Sample
*
* 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.
*
******************************************************************************