DB2 Version 9.7 for Linux, UNIX, and Windows

sqluvint API - Initialize and link to a vendor device

Provides information for initializing a vendor device and for establishing a logical link between DB2® and the vendor device.

Authorization

None

Required connection

Database

API include file

sqluvend.h

API and data structure syntax

int sqluvint ( struct Init_input *in,
               struct Init_output *out,
               struct Return_code *return_code);

sqluvint API parameters

in
Input. Structure that contains information provided by DB2 to establish a logical link with the vendor device.
out
Output. Structure that contains the output returned by the vendor device.
return_code
Output. Structure that contains the return code to be passed to DB2, and a brief text explanation.

Usage notes

For each media I/O session, DB2 will call this API to obtain a device handle. If for any reason, the vendor storage API encounters an error during initialization, it will indicate it via a return code. If the return code indicates an error, DB2 may choose to terminate the operation by calling the sqluvend API. Details on possible return codes, and the DB2 reaction to each of these, is contained in the return codes table (see table below).

The Init_input structure contains elements that can be used by the vendor product to determine if the backup or restore can proceed:
size_HI_order and size_LOW_order
This is the estimated size of the backup. They can be used to determine if the vendor devices can handle the size of the backup image. They can be used to estimate the quantity of removable media that will be required to hold the backup. It might be beneficial to fail at the first sqluvint call if problems are anticipated.
req_sessions
The number of user requested sessions can be used in conjunction with the estimated size and the prompting level to determine if the backup or restore operation is possible.
prompt_lvl
The prompting level indicates to the vendor if it is possible to prompt for actions such as changing removable media (for example, put another tape in the tape drive). This might suggest that the operation cannot proceed since there will be no way to prompt the user. If the prompting level is WITHOUT PROMPTING and the quantity of removable media is greater than the number of sessions requested, DB2 will not be able to complete the operation successfully.

DB2 names the backup being written or the restore to be read via fields in the DB2_info structure. In the case of an action = SQLUV_READ, the vendor product must check for the existence of the named object. If it cannot be found, the return code should be set to SQLUV_OBJ_NOT_FOUND so that DB2 will take the appropriate action.

After initialization is completed successfully, DB2 will continue by calling other data transfer APIs, but may terminate the session at any time with an sqluvend call.

Return codes

Table 1. Valid Return Codes for sqluvint and Resulting DB2 Action
Literal in Header File Description Probable Next Call Other Comments
SQLUV_OK Operation successful. sqluvput, sqluvget (see comments) If action = SQLUV_WRITE, the next call will be to the sqluvput API (to BACKUP data). If action = SQLUV_READ, verify the existence of the named object prior to returning SQLUV_OK; the next call will be to the sqluvget API to restore data.
SQLUV_LINK_EXIST Session activated previously. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_COMM_ERROR Communication error with device. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_INV_VERSION The DB2 and vendor products are incompatible No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_INV_ACTION Invalid action is requested. This could also be used to indicate that the combination of parameters results in an operation which is not possible. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_NO_DEV_AVAIL No device is available for use at the moment. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_OBJ_NOT_FOUND Object specified cannot be found. This should be used when the action on the sqluvint call is "R" (read) and the requested object cannot be found based on the criteria specified in the DB2_info structure. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_OBJS_FOUND More than 1 object matches the specified criteria. This will result when the action on the sqluvint call is "R" (read) and more than one object matches the criteria in the DB2_info structure. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_INV_USERID Invalid userid specified. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_INV_PASSWORD Invalid password provided. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_INV_OPTIONS Invalid options encountered in the vendor options field. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_INIT_FAILED Initialization failed and the session is to be terminated. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_DEV_ERROR Device error. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_MAX_LINK_GRANT Max number of links established. sqluvput, sqluvget (see comments). This is treated as a warning by DB2. The warning tells DB2 not to open additional sessions with the vendor product, because the maximum number of sessions it can support has been reached (note: this could be due to device availability). If action = SQLUV_WRITE (BACKUP), the next call will be to sqluvput API. If action = SQLUV_READ, verify the existence of the named object prior to returning SQLUV_MAX_LINK_ GRANT; the next call will be to the sqluvget API to restore data.
SQLUV_IO_ERROR I/O error. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.
SQLUV_NOT_ENOUGH_SPACE There is not enough space to store the entire backup image; the size estimate is provided as a 64-bit value in bytes. No further calls. Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend API call will not be received, since the session was never established.