| 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.4 Creating an Object
Creates an object of the FJDB-RECORDSET class using a CREATE-OBJECT method and opens it.
INVOKE FJDB-RECORDSET "CREATE-OBJECT" USING SQL RSOPT DSN UID PWD SCM OPT ERROR-A
RETURNING RECORDSET-A.
SQL [attribute:X(nn) nn is an area length]
Writes a search SQL statement (query expression) directed at a database.
RSOPT [attribute:S9(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 used to specify multiple options.
(Specifying multiple options)
COMPUTE RSOPT = FJDB-SCRSOPT-NOCACHE + FJDB-SCRSOPT-READONLY
INVOKE FJDB-RECORDSET "CREATE-OBJECT" USING SQL RSOPT ` ERROR-A
RETURNING RECORDSET-A.
Available options are listed below.
(1) Record set cache use mode
(FJDB-SCRSOPT-CACHE/FJDB-SCRSOPT-NOCACHE)
Specify whether to use a local cache for a record set or not. The MOVE-PREVIOUS, MOVE-FIRST, and MOVE-LAST methods become unavailable if a record set is created without using a local cache. But the task of referencing search data only once in the forward direction would be made more efficient because it dispenses with the need to save read data to a local cache.
(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.
(3) Recordset updatability mode
iFJDB-SCRSOPT-READONLY)
Whether a record set is updatable or read-only depends on the updatability of the table accessed and on the coding format of the search SQL statement used. Users have the option, however, to give the record sets they create a read-only attribute. The following modes are supported to establish the updatability attribute of record sets 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. |
DSN [attribute:X(nn) nn is an area length]
Specifies a database environment name.
UID [attribute:X(nn) nn is an area length]
Specifies the user ID for making a connection to the database.
PWD [attribute:X(nn) nn is an area length]
Specifies the password associated with the user ID used to connect to the database.
SCM [attribute:X(nn) nn is an area length]
Specifies the default schema name for the SQL statement that is specified in the OPEN-RECORDSET method, the CREATE-COMMAND method, or the EXECUTE-SQL method aimed at an object of the FJDB-DATABASE class.
The default schema name complements a table when it is not qualified by a schema name in the SQL statement that is specified in the OPEN-RECORDSET method, the EXECUTE-SQL method, and the CREATE-COMMAND method.
DBOPT [attribute:S9(9) COMP-5]
Specifies a database run-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 DBOPT = FJDB-SCDBOPT-READONLY + FJDB-SCDBOPT-READCOMMITED
INVOKE FJDB-COMMAND "CREATE-OBJECT" USING SQL ` DBOPT ERROR-A
RETURNING RECORDSET-A.
Available options are listed below.
(1) Database updatability attribute mode
(FJDB-SCDBOPT-READONLY)
Determine whether to make the open database both readable and writable or read-only. The default is both readable and writable.
(2) Isolation level mode
(FJDB-SCDBOPT-READCOMMITED)
Determine whether to set the isolation level as READ COMMITED or READ UNCOMITTED. The default is READ UNCOMMITED.
The isolation level is a transaction mode in which reference and update to data are controlled to enable multiple transactions and gain access to the same resource without causing data inconsistencies.
| Symbolic constant | Value | Meaning |
| FJDB-SCDBOPT-DEFAULT | 0 | Do not use any option. |
| FJDB-SCDBOPT-READONLY | 1 | Open the database with a read-only attribute. |
| FJDB-SCDBOPT-READCOMMITED | 2 | Set the isolation level as READ COMMITED. |
ERROR-A [attribute:OBJECT REFERENCE FJDB-ERROR]
Returns an object of the FJDB-ERROR class if the method fails to end normally.
RECORDSET-A [attribute:OBJECT REFERENCE FJDB-RECORDSET]
Returns an object of the FJDB- RECORDSET class if the method ends normally; otherwise, returns a NULL object.
With A non-SymfoWARE database, set the same value as the user ID (UID) in the default schema (SCM).
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
![]()
|