COBOL samples

UNIX directories. IBM COBOL: sqllib/samples/cobol; Micro Focus COBOL: sqllib/samples/cobol_mf.

Windows directories. IBM COBOL: sqllib\samples\cobol; Micro Focus COBOL: sqllib\samples\cobol_mf.

Note: The COBOL samples are not structured in the Db2® level design used for the C, CLI, C++, C#, Java, Perl, PHP, Visual Basic ADO, and Visual Basic .NET samples.
Table 1. COBOL Db2 API sample programs with no embedded SQL
Sample program Included APIs
checkerr.cbl
  • sqlaintp - Get Error Message
  • sqlogstt - Get SQLSTATE Message
client.cbl
  • sqleqryc - Query Client
  • sqlesetc - Set Client
d_dbconf.cbl
  • sqleatin - Attach
  • sqledtin - Detach
  • sqlfddb - Get Database Configuration Defaults
d_dbmcon.cbl
  • sqleatin - Attach
  • sqledtin - Detach
  • sqlfdsys - Get Database Manager Configuration Defaults
db_udcs.cbl
  • sqleatin - Attach
  • sqlecrea - Create Database
  • sqledrpd - Drop Database
dbcat.cbl
  • sqlecadb - Catalog Database
  • db2DbDirCloseScan - Close Database Directory Scan
  • db2DbDirGetNextEntry - Get Next Database Directory Entry
  • db2DbDirOpenScan - Open Database Directory Scan
  • sqleuncd - Uncatalog Database
dbcmt.cbl
  • sqledcgd - Change Database Comment
  • db2DbDirCloseScan - Close Database Directory Scan
  • db2DbDirGetNextEntry - Get Next Database Directory Entry
  • db2DbDirOpenScan - Open Database Directory Scan
  • sqleisig - Install Signal Handler
dbconf.cbl
  • sqleatin - Attach
  • sqlecrea - Create Database
  • sqledrpd - Drop Database
  • sqlfrdb - Reset Database Configuration
  • sqlfudb - Update Database Configuration
  • sqlfxdb - Get Database Configuration
dbinst.cbl
  • sqleatcp - Attach and Change Password
  • sqleatin - Attach
  • sqledtin - Detach
  • sqlegins - Get Instance
dbmconf.cbl
  • sqleatin - Attach
  • sqledtin - Detach
  • sqlfrsys - Reset Database Manager Configuration
  • sqlfusys - Update Database Manager Configuration
  • sqlfxsys - Get Database Manager Configuration
dbsnap.cbl
  • sqleatin - Attach
  • sqlmonss - Get Snapshot
dbstart.cbl
  • sqlepstart - Start Database Manager
dbstop.cbl
  • sqlefrce - Force Application
  • sqlepstp - Stop Database Manager
dbupgrade.cbl
  • db2DatabaseUpgrade- Upgrade Database
Important: The support in COBOL and FORTRAN for the db2DatabaseUpgrade API is deprecated and might be removed in a future release. For more information, see Support in COBOL and FORTRAN for the db2DatabaseUpgrade API.
dcscat.cbl
  • sqlegdad - Catalog DCS Database
  • sqlegdcl - Close DCS Directory Scan
  • sqlegdel - Uncatalog DCS Database
  • sqlegdge - Get DCS Directory Entry for Database
  • sqlegdgt - Get DCS Directory Entries
  • sqlegdsc - Open DCS Directory Scan
ebcdicdb.cbl
  • sqleatin - Attach
  • sqlecrea - Create Database
  • sqledrpd - Drop Database
monreset.cbl
  • sqleatin - Attach
  • sqlmrset - Reset Monitor
monsz.cbl
  • sqleatin - Attach
  • sqlmonss - Get Snapshot
  • db2GetSnapshotSize - Estimate Size Required for sqlmonss() Output Buffer
nodecat.cbl
  • sqlectnd - Catalog Node
  • sqlencls - Close Node Directory Scan
  • sqlengne - Get Next Node Directory Entry
  • sqlenops - Open Node Directory Scan
  • sqleuncn - Uncatalog Node
restart.cbl
  • sqlerstd - Restart Database
setact.cbl
  • sqlesact - Set Accounting String
sws.cbl
  • sqleatin - Attach
  • sqlmon - Get/Update Monitor Switches
Table 2. COBOL Db2 API embedded SQL sample programs
Sample program Included APIs
dbstat.sqb
  • db2Reorg - Reorganize Table
  • db2Runstats - Run Statistics
expsamp.sqb
  • db2Export - Export
  • sqluimpr - Import
impexp.sqb
  • db2Export - Export
  • sqluimpr - Import
loadqry.sqb
  • db2LoadQuery - Load Query
rebind.sqb
  • sqlarbnd - Rebind
tabscont.sqb
  • sqlbctcq - Close Tablespace Container Query
  • sqlbftcq - Fetch Tablespace Container Query
  • sqlbotcq - Open Tablespace Container Query
  • sqlbtcq - Tablespace Container Query
  • sqlefmem - Free Memory
tabspace.sqb
  • sqlbctsq - Close Tablespace Query
  • sqlbftpq - Fetch Tablespace Query
  • sqlbgtss - Get Tablespace Statistics
  • sqlbmtsq - Tablespace Query
  • sqlbotsq - Open Tablespace Query
  • sqlbstpq - Single Tablespace Query
  • sqlefmem - Free Memory
tload.sqb
  • db2Export - Export
  • sqluload - Load
  • sqluvqdp - Quiesce Tablespaces for Table
tspace.sqb
  • sqlbctcq - Close Tablespace Container Query
  • sqlbctsq - Close Tablespace Query
  • sqlbftcq - Fetch Tablespace Container Query
  • sqlbftpq - Fetch Tablespace Query
  • sqlbgtss - Get Tablespace Statistics
  • sqlbmtsq - Tablespace Query
  • sqlbotcq - Open Tablespace Container Query
  • sqlbotsq - Open Tablespace Query
  • sqlbstpq - Single Tablespace Query
  • sqlbstsc - Set Tablespace Containers
  • sqlbtcq - Tablespace Container Query
  • sqlefmem - Free Memory
Table 3. COBOL Embedded SQL sample programs with No Db2 APIs
Sample program name Program description
advsql.sqb Demonstrates the use of advanced SQL expressions like CASE, CAST, and scalar full selects.
cursor.sqb Demonstrates the use of a cursor using static SQL.
delet.sqb Demonstrates static SQL to delete items from a database.
dynamic.sqb Demonstrates the use of a cursor using dynamic SQL.
joinsql.sqb Demonstrates using advanced SQL join expressions.
lobeval.sqb Demonstrates the use of LOB locators and defers the evaluation of the actual LOB data.
lobfile.sqb Demonstrates the use of LOB file handles.
lobloc.sqb Demonstrates the use of LOB locators.
openftch.sqb Demonstrates fetching, updating, and deleting rows using static SQL.
static.sqb Demonstrates static SQL to retrieve information.
tabsql.sqb Demonstrates the use of advanced SQL table expressions.
trigsql.sqb Demonstrates using advanced SQL triggers and constraints.
updat.sqb Demonstrates static SQL to update a database.
varinp.sqb Demonstrates variable input to Embedded Dynamic SQL statement calls using parameter markers.