| DB Access Class Library for COBOL V1.0 API Reference - Microsoft(R) Windows(R) - - Microsoft(R) Windows NT(R) - - Microsoft(R) Windows(R) 2000 - |
Contents
Index
![]()
|
Chapter 6 DB Access Library API Reference
6.2 Methods
Click the buttons shown below to scroll to class-specific explanations.
Queries a database using an SQL statement and creates an object of the FJDB-RECORDSET class as a search result.
INVOKE DATABASE-A "OPEN-RECORDSET" USING SQL RSOPT RECORDSET-A
RETURNING RET-CODE.
DATABASE-A [attribute:FOBJECT REFERENCE FJDB-DATABASE]
Specifies an object of the FJDB-DATABASE class.
SQL [attribute:FX(nn) nn is an area length]
Writes a search SQL statement (query expression) directed at a database.
RSOPT [attribute:FS9(9) COMP-5]
Specifies a database search-time option with a symbolic constant or integer. A mix of multiple symbolic constants, or associated values, can be specified to specify multiple options.
(Specifying multiple options)
COMPUTE RSOPT = FJDB-SCRSOPT-NOCACHE + FJDB-SCRSOPT-READONLY
INVOKE DATABASE-A "OPEN-RECORDSET " USING SQL RSOPT RECORDSET-A
RETURNING RET-CODE.
Available options are listed below.
(1) Recordset cache use mode
(FJDB-SCRSOPT-CACHE/FJDB-SCRSOPT-NOCACHE)
Specify whether to use a local cache for a recordset or not. The MOVE-PREVIOUS, MOVE-FIRST, and MOVE-LAST methods become unavailable if a recordset is created without using a local cache. But the task of referencing search data once in the forward direction would be made more efficient because it dispenses with the need to save read data to a local cache.
The defaults are as follows:
If accessing a remote database:FJDB-SCRSOPT-CACHE
If accessing a local database :FJDB-SCRSOPT-NOCACHE
(2) Scroll cursor function use mode
(FJDB-SCRSOPT-SCROLLABLECUR/FJDB-SCRSOPT-FORWARDONLYCUR)
Specify whether to use the DBMS scroll cursor function. If the scroll cursor function is used, the row on which the cursor is positioned can be specified from DBMS without having to use a local cache.
The defaults are as follows:
If accessing a remote database:FJDB-SCRSOPT-FORWARDONLYCUR
If accessing a local database :FJDB-SCRSOPT-SCROLLABLECUR
(3) Recordset updatability mode
iFJDB-SCRSOPT-READONLY)
Whether a recordset is updatable or read-only depends on updatability of the table accessed and on the coding format of the search SQL statement used. Users have the option, however, to force the recordsets they create to have a read-only attribute. The following modes are supported to establish the updatability attribute of recordsets created:
| Symbolic constant | Value | Meaning |
| FJDB-SCRSOPT-DEFAULT | 0 | Do not use any option. |
| FJDB-SCRSOPT-CACHE | 1 | Use a local cache. |
| FJDB-SCRSOPT-NOCACHE | 2 | Do not use a local cache. |
| FJDB-SCRSOPT-SCROLLABLECUR | 4 | Use the scroll cursor function. |
| FJDB-SCRSOPT-FORWARDONLYCUR | 8 | Do not use the scroll cursor function. |
| FJDB-SCRSOPT-READONLY | 16 | Force recordsets to have a read-only attribute. |
RECORDSET-A [attribute:OBJECT REFERENCE FJDB-RECORDSET]
Specifies the object variable in which an object of the FJDB-RECORDSET class is stored.
RET-CODE [attribute:FS9(9) COMP-5]
Returns a value of 0 if the method ends normally; otherwise, returns an error code.
A library file having symbolic constants defined within FJDBOPT.CBL is stored in the COPY folder of the folder in which the DB access class library is installed. To use symbolic constants in a program, see the following instructions:
Example:
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
SYMBOLIC CONSTANT
COPY FJDBOPT.
.
Queries a database using an SQL statement associated with an object of the FJDB-COMMAND class and creates an object of the FJDB-RECORDSET class as a search result.
INVOKE COMMAND-A "OPEN-RECORDSET" USING RSOPT RECORDSET-A
RETURNING RET-CODE.
COMMAND-A [attribute:OBJECT REFERENCE FJDB-COMMAND]
Specifies an object of the FJDB-COMMAND class.
RSOPT [attribute:S9(9) COMP-5]
Specifies a database search-time option with a symbolic constant or integer.
For more information about the options, see the description of the OPEN-RECORDSET method directed at objects of the FJDB-DATABASE class.
| Symbolic constant | Value | Meaning |
| FJDB-SCRSOPT-DEFAULT | 0 | Do not use any option. |
| FJDB-SCRSOPT-CACHE | 1 | Use a local cache. |
| FJDB-SCRSOPT-NOCACHE | 2 | Do not use a local cache. |
| FJDB-SCRSOPT-SCROLLABLECUR | 4 | Use the scroll cursor function. |
| FJDB-SCRSOPT-FORWARDONLYCUR | 8 | Do not use the scroll cursor function. |
| FJDB-SCRSOPT-READONLY | 16 | Force recordsets to have a read-only attribute. |
RECORDSET-A [attribute:OBJECT REFERENCE FJDB-RECORDSET]
Specifies the object variable in which an object of the FJDB-RECORDSET class is stored.
RET-CODE [attribute:S9(9) COMP-5]
Returns a value of 0 if the method ends normally; otherwise, returns an error code.
Only one object of the FJDB-RECORDSET class takes effect when an OPEN-RECORDSET method of the FJDB-COMMAND class is issued. When multiple objects of the FJDB-RECORDSET class are created, the last created object of the FJDB-RECORDSET class takes effect.
The OPEN-RECORDSET method can be issued when the SQL statement associated with the object of the FJDB-COMMAND class is a SELECT statement. An error is reported with any other SQL statement.
A library file having symbolic constants defined in it FJDBOPT.CBL is stored in the COPY folder of the folder in which the DB access class library is installed. To use symbolic constants in a program, see the following instructions:
Example:
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
SYMBOLIC CONSTANT
COPY FJDBOPT.
.
Contents
Index
![]()
|