README file for C++ Samples
DB2 Universal Database for Windows 32-bit Operating Systems 
===========================================================
Last update : November, 1999.

The following is a table of sample programs that are supplied with DB2.
                                                     
These programming examples are for the "C++" programming language, and can be
found in the "sqllib\samples\cpp" directory. Copy these files to your working 
directory prior to building the sample programs.

WARNING: Some of these samples will change your database manager
         configuration.  Execute the samples in a test instance only.

For more information on Programming in C and C++, refer to the:
   -  "Programming in C and C++" section of the Application Development Guide.

For more information on Building C++ Applications, refer to the:
   - "Building C++ Applications" section of the Application Building Guide.

For more information on the SQL language, refer to the SQL Reference.

For the latest information on programming, compiling, and running DB2 
applications, refer to the DB2 application development website at:
   - http:// www.software.ibm.com/data/db2/udb/ad 

   .--------------------------------------------.                        
.--|How to build the SAMPLE programs using make |-----------------------------.
|  '--------------------------------------------'                             |
|  Before building the sample programs, you require:                          |
|                                                                             |
|    - Your environment initialized to a valid db2 instance.                  |
|    - The sample database (created with the db2sampl commmand).              |
|    - The database manager must be started (with the db2start command).      |
|    - Write permission to the the "sqllib\function" directory of             |
|      the database instance prior to building the following programs:        |
|                                                                             |
|         spserver                                                            |
|         udf                                                                 |
|                                                                             |
|  Using the makefile in this directory, you can build any of the supplied    |
|  sample programs in one step by entering the following command:             |
|                                                                             |
|    nmake <prog_name>  (eg. make client)                                     |
|                                                                             |
|  You can also use the makefile to build all the supplied sample programs    |
|  in one step by entering the following command:                             |
|                                                                             |
|    nmake all                                                                |
|                                                                             |
|  To remove the intermediate files, enter:                                   |
|                                                                             |
|   nmake clean                                                               |
|                                                                             | 
|  To remove all intermediate files and the resulting executables, enter:     |
|                                                                             |
|   nmake cleanall                                                            |
|                                                                             | 
|  Although the makefile is easier to use, it may be more difficult to        | 
|  understand, so script files are also included, as described below.         |
'-----------------------------------------------------------------------------' 
                                                    
   .----------------------------------------------.
.--|How to build the SAMPLE programs using SCRIPTs|---------------------------.
|  '----------------------------------------------'                           |
| To compile the following programs, you need to invoke the proper build      |
| scripts. The supplied scripts are listed near the end of this README file.  |
| For detailed information on these scripts, and for additional setup         |
| information, see the book "Application Building Guide".                     |
'-----------------------------------------------------------------------------'


Table Legend:
=============
  NOTES:  CLI    A client application, which calls a stored procedure or 
                 declares and calls a user-defined function on the server.
          SRV    You must run this sample locally on the server.
          STP    A stored procedure, which must be stored on the server,
                 and must be called by a corresponding client application.
          UDF    A library of user-defined functions. The library must be 
                 stored on the server, and the functions are declared
                 and called by a corresponding client application.

---------------+------+---------------------------------------------------
 SAMPLE        |NOTES | PROGRAM DESCRIPTION
 PROGRAM       |      |
 NAME          |      |
---------------+------+--------------------------------------------------
"autocfg.sqC"  |      |Demonstrates the use of the following APIs:
               |      |    Autoconfig 
               |      |    Autoconfig Free Memory 
               |      |    Update Database Configuration 
               |      |    Update Database Manager Configuration 
               |      |    Set Client 
               |      |    SQLCA Message 
---------------+------+--------------------------------------------------
"calludf.sqC"  | CLI  |Uses the library of User-defined Functions (UDF)
               |      |created by "udf" for the SAMPLE database tables.
---------------+------+--------------------------------------------------
"client.C"     |      |Demonstrates the use of the following APIs:
               |      |     SET CLIENT
               |      |     QUERY CLIENT
---------------+------+--------------------------------------------------
"cursor.sqC"   |      |Demonstrates the use of a "CURSOR" using static
               |      |SQL.
---------------+------+--------------------------------------------------
"spclient.sqC" | CLI  |Client program for the stored procedure server
               |      |program "spserver".
---------------+------+--------------------------------------------------
"spcreate.db2" | SRV  |DB2 script to register stored procedures for the 
               |      |server program "spserver".
---------------+------+--------------------------------------------------
"spdrop.db2"   | SRV  |DB2 script to deregister stored procedures for the 
               |      |server program "spserver".
---------------+------+--------------------------------------------------
"spserver.sqC" | STP  |Contains stored procedures called by "spclient".
               |      |To build the spserver DLL:
               |      |1. Enter "db2 update dbm cfg using KEEPDARI no" to allow
               |      |unloading DLLs while developing stored procedures.
               |      |2. For Microsoft Visual C++, enter either "bldmsrv
               |      |spserver" or "nmake spserver". For VisualAge C++, enter
               |      |either "bldvsrv spserver" or "nmake spserver".
               |      |3. Enter: "db2 connect to sample".
               |      |4. If the stored procedures were previously cataloged  
               |      |for a different language, uncatalog them by entering:
               |      |"db2 -td@ -vf spdrop.db2".
               |      |5. Catalog the stored procedures by entering: 
               |      |"db2 -td@ -vf spcreate.db2".
---------------+------+--------------------------------------------------
"static.sqC"   |      |Uses static SQL to retrieve information.
---------------+------+--------------------------------------------------
"thdsrver.sqC" |      |Maintains a pool of contexts.  A generate_work 
               |      |function creates dynamic sql statements that 
               |      |are executed by worker threads.
---------------+------+--------------------------------------------------
"udf.c"        | UDF  |Creates a library of User-defined Functions (UDF)
               |      |made specifically for the SAMPLE database tables,
               |      |but can be used with tables of compatible column
               |      |types.
---------------+------+--------------------------------------------------
"updat.sqC"    |      |Uses static SQL to update a database.
---------------+------+--------------------------------------------------
"utilapi.c"    |      |Error checking utility for non-embedded SQL DB2
               |      |API prgrams.
---------------+------+--------------------------------------------------
"utilapi.h"    |      |Header file for "utilapi.c".
---------------+------+--------------------------------------------------
"utilemb.h"    |      |Header file for "utilemb.sqC".
---------------+------+--------------------------------------------------
"utilemb.sqC"  |      |Error checking utility for embedded SQL programs.
---------------+------+--------------------------------------------------


-------------+------+---------------------------------------------------
 BUILD       |NOTES | DESCRIPTION
 FILE        |      | 
 NAME        |      |
-------------+------+---------------------------------------------------
 bldmapp.bat |      |Builds a Microsoft Visual C++ application program.
-------------+------+---------------------------------------------------
 bldmudf.bat |      |Builds a Microsoft Visual C++ user-defined function 
             |      |(UDF).
-------------+------+---------------------------------------------------
 bldmsrv.bat |      |Builds a Microsoft Visual C++ stored procedure.
-------------+------+---------------------------------------------------
 bldvapp.bat |      |Builds a VisualAge C++ application program.
-------------+------+---------------------------------------------------
 bldvsrv.bat |      |Builds a VisualAge C++ stored procedure.
-------------+------+---------------------------------------------------
 bldvudf.bat |      |Builds a VisualAge C++ user-defined function (UDF)
-------------+------+---------------------------------------------------
 embprep.bat |      |Precompiles and binds an embedded SQL program.
-------------+------+---------------------------------------------------


---------------+------+---------------------------------------------------
 CONFIGURATION |NOTES | DESCRIPTION
 FILES for     |      |               
 Visual Age C++|      |                
 Version 4.0   |      |               
---------------+------+---------------------------------------------------
 "api.icc"     |      |DB2 API configuration file.
---------------+------+---------------------------------------------------
 "emb.icc"     |      |Embedded SQL configuration file.
---------------+------+---------------------------------------------------
 "stp.icc"     |      |Embedded SQL stored procedure configuration file.
---------------+------+---------------------------------------------------
 "udf.icc"     |      |User-defined function configuration file.
---------------+------+---------------------------------------------------


---------------+------+---------------------------------------------------
 OTHER         |NOTES | DESCRIPTION
---------------+------+---------------------------------------------------
 "makefile"    |      |Builds most of the supplied programming examples in
               |      |the "sqllib/samples/cpp" subdirectory.
---------------+------+---------------------------------------------------
 "README"      |      |Lists and describes at a high-level, all files in
               |      |the "sqllib/samples/cpp" subdirectory. (This file).
---------------+---+------+---------------------------------------------------