DB2 Version 9.7 for Linux, UNIX, and Windows

sqlu_media_list data structure

This structure is used to pass information to the db2Load API.
Table 1. Fields in the SQLU-MEDIA-LIST Structure
Field Name Data Type Description
MEDIA_TYPE CHAR(1) A character indicating media type.
SESSIONS INTEGER Indicates the number of elements in the array pointed to by the target field of this structure.
TARGET Union This field is a pointer to one of four types of structures. The type of structure pointed to is determined by the value of the media_type field. For more information on what to provide in this field, see the appropriate API.
FILLER CHAR(3) Filler used for proper alignment of data structure in memory.
Table 2. Fields in the SQLU-MEDIA-LIST-TARGETS Structure
Field Name Data Type Description
MEDIA Pointer A pointer to an sqlu_media_entry structure.
VENDOR Pointer A pointer to an sqlu_vendor structure.
LOCATION Pointer A pointer to an sqlu_location_entry structure.
PSTATEMENT Pointer A pointer to an sqlu_statement_entry structure.
PREMOTEFETCH Pointer A pointer to an sqlu_remotefetch_entry structure
Table 3. Fields in the SQLU-MEDIA-ENTRY Structure
Field Name Data Type Description
RESERVE_LEN MEDIA_ENTRY INTEGER CHAR(215) Length of the media_entry field. For languages other than C. Path for a backup image used by the backup and restore utilities.
Table 4. Fields in the SQLU-VENDOR Structure
Field Name Data Type Description
RESERVE_LEN1 INTEGER Length of the shr_lib field. For languages other than C.
SHR_LIB CHAR(255) Name of a shared library supplied by vendors for storing or retrieving data.
RESERVE_LEN2 INTEGER Length of the filename field. For languages other than C.
FILENAME CHAR(255) File name to identify the load input source when using a shared library.
Table 5. Fields in the SQLU-LOCATION-ENTRY Structure
Field Name Data Type Description
RESERVE_LEN INTEGER Length of the location_entry field. For languages other than C.
LOCATION_ENTRY CHAR(256) Name of input data files for the load utility.
Table 6. Fields in the SQLU-STATEMENT-ENTRY Structure
Field Name Data Type Description
LENGTH INTEGER Length of the data field.
PDATA Pointer Pointer to the SQL query.
Table 7. Fields in the SQLU-REMOTEFETCH-ENTRY Structure
Field Name Data Type Description
pDatabaseName Pointer Source Database Name.
iDatabaseNameLen INTEGER Source Database Name Length
pUserID Pointer Pointer to UserID.
iUserIDLen INTEGER UserID Length.
pPassword Pointer Pointer to Password.
iPasswordLen INTEGER Password Length.
pTableSchema Pointer Pointer to schema of source table.
iTableSchemaLen INTEGER Schema Length.
pTableName Pointer Pointer to name of source table.
iTableNameLen INTEGER Source table name Length.
pStatement Pointer Pointer to name of statement.
iStatementLen INTEGER Statement Length.
pIsolationLevel Pointer Pointer to isolation level (default CS).
Valid values for MEDIA_TYPE (defined in sqlutil) are:
SQLU_LOCAL_MEDIA
Local devices (tapes, disks, or diskettes)
SQLU_SERVER_LOCATION
Server devices (tapes, disks, or diskettes; load only). Can be specified only for the piSourceList parameter.
SQLU_CLIENT_LOCATION
Client devices (files or named pipes). Can be specified only for the piSourceList parameter or the piLobFileList parameter.
SQLU_SQL_STMT
SQL query (load only). Can be specified only for the piSourceList parameter.
SQLU_TSM_MEDIA
TSM
SQLU_XBSA_MEDIA
XBSA
SQLU_OTHER_MEDIA
Vendor library
SQLU_REMOTEFETCH
Remote Fetch media (load only). Can be specified only for the piSourceList parameter.
SQLU_DISK_MEDIA
Disk (for vendor APIs only)
SQLU_DISKETTE_MEDIA
Diskette (for vendor APIs only)
SQLU_NULL_MEDIA
Null (generated internally by the DB2® database)
SQLU_TAPE_MEDIA
Tape (for vendor APIs only).
SQLU_PIPE_MEDIA
Named pipe (for vendor APIs only)

API and data structure syntax

typedef SQL_STRUCTURE sqlu_media_list
{
   char media_type;
   char filler[3];
   sqlint32 sessions;
   union sqlu_media_list_targets target;
} sqlu_media_list;

union sqlu_media_list_targets
{
   struct sqlu_media_entry *media;
   struct sqlu_vendor *vendor;
   struct sqlu_location_entry *location;
   struct sqlu_statement_entry *pStatement;
   struct sqlu_remotefetch_entry *pRemoteFetch;
};

typedef SQL_STRUCTURE sqlu_media_entry
{
   sqluint32 reserve_len;
   char media_entry[SQLU_DB_DIR_LEN+1];
} sqlu_media_entry;

typedef SQL_STRUCTURE sqlu_vendor
{
   sqluint32 reserve_len1;
   char shr_lib[SQLU_SHR_LIB_LEN+1];
   sqluint32 reserve_len2;
   char filename[SQLU_SHR_LIB_LEN+1];
} sqlu_vendor;

typedef SQL_STRUCTURE sqlu_location_entry
{
   sqluint32 reserve_len;
   char location_entry[SQLU_MEDIA_LOCATION_LEN+1];
} sqlu_location_entry;

typedef SQL_STRUCTURE sqlu_statement_entry
{
   sqluint32 length;
   char *pEntry;
} sqlu_statement_entry;

typedef SQL_STRUCTURE sqlu_remotefetch_entry
{
   char *pDatabaseName;
   sqluint32 iDatabaseNameLen;
   char *pUserID;
   sqluint32 iUserIDLen;
   char *pPassword;
   sqluint32 iPasswordLen;
   char *pTableSchema;
   sqluint32 iTableSchemaLen;
   char *pTableName;
   sqluint32 iTableNameLen;
   char *pStatement;
   sqluint32 iStatementLen;
   sqlint32 *pIsolationLevel;
   sqluint32 *piEnableParallelism;
} sqlu_remotefetch_entry;

COBOL Structure

* File: sqlutil.cbl
01 SQLU-MEDIA-LIST.
    05 SQL-MEDIA-TYPE         PIC X.
    05 SQL-FILLER             PIC X(3).
    05 SQL-SESSIONS           PIC S9(9) COMP-5.
    05 SQL-TARGET.
        10 SQL-MEDIA          USAGE IS POINTER.
        10 SQL-VENDOR         REDEFINES SQL-MEDIA
        10 SQL-LOCATION       REDEFINES SQL-MEDIA
        10 SQL-STATEMENT      REDEFINES SQL-MEDIA
        10 FILLER             REDEFINES SQL-MEDIA
*


* File: sqlutil.cbl
01 SQLU-MEDIA-ENTRY.
    05 SQL-MEDENT-LEN         PIC 9(9) COMP-5.
    05 SQL-MEDIA-ENTRY        PIC X(215).
    05 FILLER                 PIC X.
* 


* File: sqlutil.cbl
01 SQLU-VENDOR.
    05 SQL-SHRLIB-LEN         PIC 9(9) COMP-5.
    05 SQL-SHR-LIB            PIC X(255).
    05 FILLER                 PIC X.
    05 SQL-FILENAME-LEN       PIC 9(9) COMP-5.
    05 SQL-FILENAME           PIC X(255).
    05 FILLER                 PIC X.
*


* File: sqlutil.cbl
01 SQLU-LOCATION-ENTRY.
    05 SQL-LOCATION-LEN       PIC 9(9) COMP-5.
    05 SQL-LOCATION-ENTRY     PIC X(255).
    05 FILLER                 PIC X.
*


* File: sqlutil.cbl
01 SQLU-STATEMENT-ENTRY.
    05 SQL-STATEMENT-LEN       PIC 9(9) COMP-5.
    05 SQL-STATEMENT-ENTRY     USAGE IS POINTER.
*