DB2 Universal Database Version 6.1 SDK for Windows 32-bit Operating Systems README file
=======================================================================================

Last updated: April 1999.

The following is a table of sample programs that are supplied with the SDK.

These programming examples are for the "C" programming language, and can be
found in the "sqllib\samples\c" 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, see the
  -  "Programming in C and C++" section of the Application Development Guide
  
For more information on Building C Applications, see the:
  - "Building C Applications" section of the Application Building Guide.

For more information on the SQL language see 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 nmake|=============================+
|  +============================================+                             |
|  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 started (with the db2start command).              |
|    - Write permission to the the "sqllib/function" directory of             |
|      the database instance prior to building stored procedures and          |
|      user-defined functions such as:                                        |
|                                                                             |
|         outsrv                                                              |
|         inpsrv                                                              |
|         fillsrv                                                             |
|         tblsrv                                                              |
|         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 adhoc)                                      |
|                                                                             |
|  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.
          DDB    Requires a default database designated by environment
                 variable DB2DBDFT.
          IPX    Runs only on a machine using IPX communications protocol.
          MPP    Designed to run specifically in a partitioned database 
                 environment.
          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        |      |
-------------+------+--------------------------------------------------
 adhoc.sqc   |      |Uses dynamic SQL and the SQLDA structure to
             |      |process SQL commands interactively.  SQL commands
             |      |are input by the user, and output corresponding
             |      |to the SQL command is returned.
-------------+------+--------------------------------------------------
 advsql.sqc  |      |An example using advanced SQL expressions like
             |      |CASE, CAST, and scalar fullselects.
-------------+------+--------------------------------------------------
 asynrlog.sqc|      |Demonstrates the use of the following API:
             |      |    ASYNCHRONOUS LOG READ
-------------+------+--------------------------------------------------
 backrest.c  | SRV  |Demonstrates the use of the following APIs:
             |      |     BACKUP DATABASE
             |      |     RESTORE DATABASE
             |      |     ROLL FORWARD DATABASE
-------------+------+--------------------------------------------------
 bindfile.sqc|      |Demonstrates the use of embedded SQL compiled to
             |      |run without BINDING the application to a database.
-------------+------+--------------------------------------------------
 blobfile.sqc|      |Demonstrates the manipulation of a Binary Large
             |      |Object (BLOB), by reading a BLOB value from the
             |      |sample database and placing it in a file, the
             |      |contents of which can be displayed using an
             |      |external viewer.
-------------+------+--------------------------------------------------
 calludf.sqc | CLI  |Uses the library of User-defined Functions (UDF)
             |      |created by "udf.c" for the SAMPLE database tables.
-------------+------+--------------------------------------------------
 cli_info    |      |Demonstrates using CLIENT INFORMATION APIs to set 
             |      |and query client information.  
-------------+------+--------------------------------------------------
 client.c    |      |Demonstrates the use of the following APIs:
             |      |     SET CLIENT
             |      |     QUERY CLIENT
-------------+------+--------------------------------------------------
 columns.sqc |      |Demonstrates the use of a cursor.  This cursor is
             |      |processed using dynamic SQL.  Lists all the entries
             |      |in the system table sysibm.systables that do not have
             |      |the value "STAFF" in the "name" column.
-------------+------+--------------------------------------------------
 cursor.sqc  |      |Demonstrates the use of a "CURSOR" using static
             |      |SQL.
-------------+------+--------------------------------------------------
 db2mon.c    |      |Demonstrates how to use the Database System Monitor
             |      |APIs, and how to process the output data buffer
             |      |buffer returned from the Snapshot API.  For information
             |      |on building this application see "db2mon.c"
-------------+------+--------------------------------------------------
 delet.sqc   |      |Uses static SQL to delete items from a database.
-------------+------+--------------------------------------------------
 dynamic.sqc |      |Demonstrates the use of a "CURSOR" using dynamic
             |      |SQL.
-------------+------+--------------------------------------------------
 d_dbconf.c  |      |Demonstrates the use of the following API:
             |      |     GET DATABASE CONFIGURATION DEFAULTS
-------------+------+--------------------------------------------------
 d_dbmcon.c  |      |Demonstrates the use of the following API:
             |      |     GET DATABASE MANAGER CONFIGURATION DEFAULTS
-------------+------+--------------------------------------------------
 db_udcs.c   |      |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
-------------+------+--------------------------------------------------
 db2uext2    |      |User Exit program.  Refer to program for details.
             |      |Not included in the makefile.
-------------+------+--------------------------------------------------
 dbauth.sqc  |      |Demonstrates the use of the following API:
             |      |     GET AUTHORIZATIONS
-------------+------+--------------------------------------------------
 dbcat.c     |      |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.c     |      |Demonstrates the use of the following API:
             |      |     CHANGE DATABASE COMMENT
-------------+------+--------------------------------------------------
 dbconf.c    |      |Demonstrates the use of the following APIs:
             |      |     CREATE DATABASE
             |      |     DROP DATABASE
             |      |     GET DATABASE CONFIGURATION
             |      |     RESET DATABASE CONFIGURATION
             |      |     UPDATE DATABASE CONFIGURATION
-------------+------+--------------------------------------------------
 dbinst.c    |      |Demonstrates the use of the following APIs:
             |      |     ATTACH TO INSTANCE
             |      |     DETACH FROM INSTANCE
             |      |     GET INSTANCE
-------------+------+--------------------------------------------------
 dbmconf.c   |      |Demonstrates the use of the following APIs:
             |      |     GET DATABASE MANAGER CONFIGURATION
             |      |     RESET DATABASE MANAGER CONFIGURATION
             |      |     UPDATE DATABASE MANAGER CONFIGURATION
-------------+------+--------------------------------------------------
 dbsnap.c    |      |Demonstrates the use of the following API:
             |      |     DATABASE MONITOR SNAPSHOT
-------------+------+--------------------------------------------------
 dbstat.sqc  |      |Demonstrates the use of the following APIs:
             |      |     REORGANIZE TABLE
             |      |     RUN STATISTICS
-------------+------+--------------------------------------------------
 dbstart.c   | SRV  |Demonstrates the use of the following API:
             |      |     START DATABASE MANAGER
-------------+------+--------------------------------------------------
 dbstop.c    | SRV  |Demonstrates the use of the following APIs:
             |      |     FORCE USERS
             |      |     STOP DATABASE MANAGER
-------------+------+--------------------------------------------------
 dcscat.c    |      |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
-------------+------+--------------------------------------------------
 dmscont.c   |      |Demonstrates the use of the following APIs to
             |      |create a database with more than one database
             |      |managed storage (DMS) container:
             |      |     CREATE DATABASE
             |      |     DROP DATABASE
-------------+------+--------------------------------------------------
 ebcdicdb.c  |      |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.sqc |      |Demonstrates the use of the following APIs:
             |      |     EXPORT
             |      |     IMPORT
             |      |in conjunction with a DRDA database.
-------------+------+---------------------------------------------------
 fillcli.sqc | CLI  |Demonstrates the client-side of a stored procedure
             |      |that uses the SQLDA to pass information 
             |      |specifying which table the stored procedure 
             |      |populates with random data.
-------------+------+---------------------------------------------------
 fillsrv.sqc | STP  |Demonstrates the server-side of a stored procedure
             |      |example that uses the SQLDA to receive information
             |      |from the client specifying the table that the 
             |      |stored procedure populates with random data.
-------------+------+--------------------------------------------------
 impexp.sqc  |      |Demonstrates the use of the following APIs:
             |      |     EXPORT
             |      |     IMPORT
-------------+------+--------------------------------------------------
 inpcli.sqc  | CLI  |Demonstrates stored procedures using the SQLDA
             |      |structure.  This is the client program of a
             |      |client/server example.  (The server program is
             |      |called "inpsrv.sqc".) The program fills the SQLDA
             |      |with information, and passes it to the server
             |      |program for further processing.  The SQLCA status
             |      |is returned to the client program.  This
             |      |program calls a stored procedure using an embedded
             |      |SQL CALL statement with host variables, alongside 
             |      |the old implementation of a DARI API.
-------------+------+--------------------------------------------------
 inpsrv.sqc  | STP  |Demonstrates stored procedures using the SQLDA
             |      |structure.  This is the server program of a
             |      |client/server example.  (The client program is
             |      |called "inpcli.sqc".)  The program creates a table
             |      |("PRESIDENTS") in the "SAMPLE" database with the
             |      |information received in the SQLDA.  The server
             |      |program does all the database processing and
             |      |returns the SQLCA status to the client program.
-------------+------+--------------------------------------------------
 joinsql.sqc |      |An example using advanced SQL join expressions.
-------------+------+--------------------------------------------------
 loadqry     |      |Demonstrates use of APIs to query the current status 
             |      |of any LOAD invoked on a table.
-------------+------+--------------------------------------------------
 lobeval.sqc |      |Demonstrates the use of deferring the evaluation
             |      |of a LOB within a database.
-------------+------+--------------------------------------------------
 lobfile.sqc |      |Demonstrates the use of LOB file handles.
-------------+------+--------------------------------------------------
 lobloc.sqc  |      |Demonstrates the use of LOB locators.
-------------+------+--------------------------------------------------
 lobval.sqc  |      |Demonstrates the use of LOBs.
-------------+------+--------------------------------------------------
 makeapi.sqc | SRV  |Demonstrates the use of the following APIs:
             |      |     BIND
             |      |     PRECOMPILE PROGRAM
             |      |     START DATABASE MANAGER
             |      |     STOP DATABASE MANAGER
             |      |Not included in the makefile. 
-------------+------+--------------------------------------------------
 migrate.c   |      |Demonstrates the use of the following API:
             |      |     MIGRATE DATABASE
-------------+------+--------------------------------------------------
 monreset.c  |      |Demonstrates the use of the follwing API:
             |      |     RESET DATABASE SYSTEM MONITOR DATA AREAS
-------------+------+--------------------------------------------------
 monsz.c     |      |Demonstrates the use of the following APIs:
             |      |     ESTIMATE DATABASE SYSTEM MONITOR BUFFER SIZE
             |      |     DATABASE SYSTEM MONITOR SNAPSHOT
-------------+------+--------------------------------------------------
 nodecat.c   |      |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.sqc|      |Uses static SQL to fetch rows and then UPDATE
             |      |or DELETE them.
-------------+------+--------------------------------------------------
 outcli.sqc  | CLI  |Demonstrates stored procedures using the SQLDA
             |      |structure.  This is the client program of a
             |      |client/server example.  (The server program is
             |      |called "outsrv.sqc".)  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
             |      |program calls a stored procedure using an embedded
             |      |SQL CALL statement with host variables, alongside 
             |      |the old implementation of a DARI API.
-------------+------+--------------------------------------------------
 outsrv.sqc  | STP  |Demonstrates stored procedures using the SQLDA
             |      |structure.  This is the server program of a
             |      |client/server example.  (The client program is
             |      |called "outcli.sqc".)  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.
-------------+------+--------------------------------------------------
 qload.sqc   |      |Demonstrates the use of the LOAD QUERY API
-------------+------+--------------------------------------------------
 rebind.sqc  |      |Demonstrates the use of the REBIND API
-------------+------+--------------------------------------------------
 rechist.sqc | DDB  |Demonstrates the use of the following APIs:
             | SRV  |     CLOSE RECOVERY HISTORY FILE SCAN
             |      |     GET NEXT RECOVERY HISTORY FILE ENTRY
             |      |     OPEN RECOVER HISTORY FILE SCAN
             |      |     PRUNE RECOVERY HISTORY FILE ENTRY
             |      |     UPDATE RECOVERY HISTORY FILE ENTRY
-------------+------+--------------------------------------------------
 recursql.sqc|      |An example using advanced SQL recursive queries.
-------------+------+--------------------------------------------------
 regder.c    | IPX  |Demonstrates the use of the following APIs:
             | SRV  |     REGISTER
             |      |     DEREGISTER
-------------+------+--------------------------------------------------
 restart.c   | SRV  |Demonstrates the use of the following API:
             |      |     RESTART DATABASE MANAGER
-------------+------+--------------------------------------------------
 sampudf.sqc |      |Demonstrates the use of User-defined Types (UDT)
             |      |and User-defined Functions (UDF).  The UDFs
             |      |declared in this program are all sourced UDFs,
             |      |and do not call a UDF library on the server.
-------------+------+--------------------------------------------------
 setact.c    |      |Demonstrates the use of the following API:
             |      |     SET ACCOUNTING STRING
-------------+------+--------------------------------------------------
 setrundg.c  |      |Demonstrates the use of the following API:
             |      |     SET RUNTIME DEGREE
-------------+------+--------------------------------------------------
 static.sqc  |      |Uses static SQL to retrieve information.
-------------+------+--------------------------------------------------
 sws.c       |      |Demonstrates the use of the following API:
             |      |     DATABASE MONITOR SWITCH
-------------+------+--------------------------------------------------
 tabscont.sqc|      |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.sqc|      |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.sqc  |      |An example using advanced SQL table expressions.
-------------+------+--------------------------------------------------
 tblcli.sqc  | CLI  |Demonstrates a call to a table function
             |      |(client-side) to display weather information for
             |      |a number of cities.
-------------+------+--------------------------------------------------
 tblsrv.c    | UDF  |Demonstrates a table function
             |      |(server-side) that processes weather information
             |      |for a number of cities.
-------------+------+--------------------------------------------------
 tload.sqc   | SRV  |Demonstrates the use of the following APIs:
             |      |     EXPORT
             |      |     QUIESCE TABLESPACES FOR TABLE
             |      |     LOAD
             |      |     LOAD QUERY
-------------+------+--------------------------------------------------
 trigsql.sqc |      |An example using advanced SQL triggers and
             |      |contraints.
-------------+------+--------------------------------------------------
 tspace.sqc  |      |An example using TABLESPACE and TABLESPACE CONTAINER
             |      |APIs.
-------------+------+--------------------------------------------------
 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.
-------------+------+--------------------------------------------------
 util.c      |      |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.
-------------+------+--------------------------------------------------
 varinp.sqc  |      |An example of variable input to Embedded Dynamic
             |      |SQL calls using parameter markers.
-------------+------+--------------------------------------------------
 

-------------+------+---------------------------------------------------
 BATCH       |NOTES | DESCRIPTION
 FILE        |      |
 NAME        |      |
-------------+------+--------------------------------------------------
 bldmsstp    |      |Builds a sample C or C++ stored procedure using
             |      |Microsoft Visual C++ and stores it on the server.
-------------+------+---------------------------------------------------
 bldmsemb    |      |Builds a sample C or C++ program containing embedded
             |      |SQL using the Microsoft Visual C++ compiler.
-------------+------+---------------------------------------------------
 bldmsapi    |      |Builds a sample C program that contains DB2 APIs
             |      |using the Microsoft Visual C++ compiler.
-------------+------+---------------------------------------------------
 bldmsudf    |      |Builds a sample C UDF library using the Microsoft 
             |      |Visual C++ compiler, and stores it on the server.
-------------+------+---------------------------------------------------
 bldvastp    |      |Builds a sample C or C++ stored procedure using IBM
             |      |VisualAge C++, and stores it on the server.
-------------+------+---------------------------------------------------
 bldvaemb    |      |Builds a sample C or C++ program containing embedded
             |      |SQL using the IBM VisualAge C++ compiler.
-------------+------+---------------------------------------------------
 bldvaapi    |      |Builds a sample C program that contains DB2 APIs
             |      |using the IBM VisualAge C++ compiler.
-------------+------+---------------------------------------------------
 bldvaudf    |      |Builds a sample C UDF library using the IBM VisualAge 
             |      |C++ compiler, and stores it on the server.
-------------+------+---------------------------------------------------
 embprep     |      |Precompiles and binds a C sample program that contains
             |      |embedded SQL.
-------------+------+---------------------------------------------------


-------------+------+---------------------------------------------------
CONFIGURATION|      |                  
FILES for    |      |               
Visual Age   | NOTES| DESCRIPTION    
C++ Vers.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 sample programs in
             |      |the "sqllib\samples\c" subdirectory.
-------------+------+---------------------------------------------------
 README      |      |Lists and describes, at a high-level, all files in
             |      |the "sqllib\samples\c" subdirectory. (This file).
-------------+------+---------------------------------------------------