Run Database Hash (qdbrunha) API


  Required Parameter Group:

1 Hash name Input Char(10)
2 Function Input Char(1)
3 Number of keys Input Binary(4)
4 Key values Input Char(*)
5 Data I/O Char(*)
6 Length of Data Input Binary(4)
7 Return code Output Binary(4)

  Service Program Name: QDBRUNHA

  Default Public Authority: *USE

  Threadsafe: No

The Run Database Hash (qdbrunha) API allows the user to FETCH, UPDATE, DELETE and INSERT data into existing database files using an alternative access method. The hash approach can be used on relatively static files in situations where it is desirable to reduce the amount of memory that is consumed by indexes. Its affectiveness is reduced in memory-rich environments or environments with dynamic data.


Authorities and Locks

HASH User Space in Library QUSRSYS
*OBJOPR, *READ, and *UPDATE

Required Parameter Group

Hash name
INPUT; CHAR(10)

The hash name used to access the data. See the description of the Create Database Hash (qdbcrtha) API for information on defining and naming the hash.

Function
INPUT; CHAR(1)

The function to be performed. The possible values are character digits as follows:

1 Fetch a row for read purposes only
2 Fetch a row with intent to update
3 Update the currently locked row
4 Delete the currently locked row
5 Insert a row into the database

Number of keys
INPUT; BINARY(4)

The number of keys used by the hash.

Key values
INPUT; CHAR(*)

A structure containing up to five rows of the name of key fields and the value of key fields in the order that they appear in the logical file used to create the hash. For more details, see Field Descriptions.

Offset Type Field
Dec Hex
CHAR(10) Name of key
Binary(4) Value of key

Data
I/O; CHAR(*)

A pointer to the actual row of data from the database to be manipulated according to the function parameter. The row will be inserted, deleted, updated, or fetched from the database.

Data length
INPUT; BINARY(4)

The length of the buffer in the application that will receive or contain the data.

Return code
OUTPUT; BINARY(4)

A numeric indication as to what took place during the hash function request. The possible values are:

0 No errors.
1 Hash user space does not exist.
2 Hash does not exist.
100 Record not found.
812 Lock-wait time-out.
-99 Another error was encountered and ignored. See job log for details.

Field Descriptions

Name of key. The name of the key field in the order that they appear in the logical file referenced in the associated Create Database Hash (QDBCRTHA) API. The names are for documentation purposes only.

Value of key. The key value used by the API to access the appropriate record in the file.


Error Messages

Only the error conditions listed in the return code parameter are monitored. No error messages other than the value of the return code parameter are returned.



API Introduced: V4R3

[ Back to top | Database and File APIs | APIs by category ]