IBM Books

Administrative API Reference

sqluvint - Initialize and Link to Device

This function is called to provide information for initialization and establishment of a logical link between DB2 and the vendor device.

Authorization

One of the following:

Required Connection

Database

Version

sql.h

C API Syntax



/* File: sqluvend.h */
/* API: Initialize and Link to Device */
/* ... */
int sqluvint (
  struct Init_input   *,
  struct Init_output  *,
  struct Return_code  *);
/* ... */
 

API Parameters

Init_input
Input. Structure that contains information provided by DB2 to establish a logical link with the vendor device.

Init_output
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 function to obtain a device handle. If for any reason, the vendor function 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 function. Details on possible return codes, and the DB2 reaction to each of these, is contained in the return codes table (see Table 81).

The INIT-INPUT structure contains elements that can be used by the vendor product to determine if the backup or restore can proceed:

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 issuing other data transfer functions, but may terminate the session at any time with an sqluvend call.

Return Codes

Table 81. 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 or sqluvdel (see comments) If action = SQLUV_WRITE, the next call will be sqluvput (to BACKUP data). If action = SQLUV_READ, verify the existence of the named object prior to returning SQLUV_OK; the next call could be a sqluvget (to RESTORE data) or an sqluvdel (to delete a committed session).
SQLUV_LINK_EXIST Session activated previously. no further calls Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend 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 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 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 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 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 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 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 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 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 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 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 call will not be received, since the session was never established.
SQLUV_MAX_LINK_ GRANT Max number of links established. sqluvput, sqluvget or sqluvdel (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 sqluvput. If action = SQLUV_READ, you should verify the existence of the named object prior to returning SQLUV_MAX_LINK_GRANT; the next call could be a sqluvget (to RESTORE data) or an sqluvdel (to delete a committed session).
SQLUV_IO_ERROR I/O error. no further calls Session initialization fails. Free up memory allocated for this session and terminate. A sqluvend 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 call will not be received, since the session was never established.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]