Checks the status of a load operation during processing.
Required connection
Database
API include file
db2ApiDf.h
API and data structure syntax
SQL_API_RC SQL_API_FN
db2LoadQuery (
db2Uint32 versionNumber,
void * pParmStruct,
struct sqlca * pSqlca);
typedef SQL_STRUCTURE db2LoadQueryStruct
{
db2Uint32 iStringType;
char *piString;
db2Uint32 iShowLoadMessages;
struct db2LoadQueryOutputStruct *poOutputStruct;
char *piLocalMessageFile;
} db2LoadQueryStruct;
typedef SQL_STRUCTURE db2LoadQueryOutputStruct
{
db2Uint32 oRowsRead;
db2Uint32 oRowsSkipped;
db2Uint32 oRowsCommitted;
db2Uint32 oRowsLoaded;
db2Uint32 oRowsRejected;
db2Uint32 oRowsDeleted;
db2Uint32 oCurrentIndex;
db2Uint32 oNumTotalIndexes;
db2Uint32 oCurrentMPPNode;
db2Uint32 oLoadRestarted;
db2Uint32 oWhichPhase;
db2Uint32 oWarningCount;
db2Uint32 oTableState;
} db2LoadQueryOutputStruct;
typedef SQL_STRUCTURE db2LoadQueryOutputStruct64
{
db2Uint64 oRowsRead;
db2Uint64 oRowsSkipped;
db2Uint64 oRowsCommitted;
db2Uint64 oRowsLoaded;
db2Uint64 oRowsRejected;
db2Uint64 oRowsDeleted;
db2Uint32 oCurrentIndex;
db2Uint32 oNumTotalIndexes;
db2Uint32 oCurrentMPPNode;
db2Uint32 oLoadRestarted;
db2Uint32 oWhichPhase;
db2Uint32 oWarningCount;
db2Uint32 oTableState;
} db2LoadQueryOutputStruct64;
typedef SQL_STRUCTURE db2LoadQueryStruct64
{
db2Uint32 iStringType;
char *piString;
db2Uint32 iShowLoadMessages;
struct db2LoadQueryOutputStruct64 *poOutputStruct;
char *piLocalMessageFile;
} db2LoadQueryStruct64;
SQL_API_RC SQL_API_FN
db2gLoadQuery (
db2Uint32 versionNumber,
void * pParmStruct,
struct sqlca * pSqlca);
typedef SQL_STRUCTURE db2gLoadQueryStruct
{
db2Uint32 iStringType;
db2Uint32 iStringLen;
char *piString;
db2Uint32 iShowLoadMessages;
struct db2LoadQueryOutputStruct *poOutputStruct;
db2Uint32 iLocalMessageFileLen;
char *piLocalMessageFile;
} db2gLoadQueryStruct;
typedef SQL_STRUCTURE db2gLoadQueryStru64
{
db2Uint32 iStringType;
db2Uint32 iStringLen;
char *piString;
db2Uint32 iShowLoadMessages;
struct db2LoadQueryOutputStruct64 *poOutputStruct;
db2Uint32 iLocalMessageFileLen;
char *piLocalMessageFile;
} db2gLoadQueryStru64;
db2LoadQuery API parameters
- versionNumber
- Input. Specifies the version and release level of the structure
passed in as the second parameter, pParmStruct.
- pParmStruct
- Input. A pointer to the db2LoadQueryStruct structure.
If the version is Version 9 or higher, it is a pointer to the db2LoadQueryStruct64 structure. Otherwise, it is a pointer
to the db2LoadQueryStruct structure.
- pSqlca
- Output. A pointer to the sqlca structure.
db2LoadQueryStruct data structure parameters
- iStringType
- Input. Specifies a type for piString. Valid
values (defined in db2ApiDf header file, located
in the include directory) are:
- DB2LOADQUERY_TABLENAME
- Specifies a table name for use by the db2LoadQuery API.
- piString
- Input. Specifies a temporary files path name or a table name,
depending on the value of iStringType.
- iShowLoadMessages
- Input. Specifies the level of messages that are to be returned
by the load utility. Valid values (defined in db2ApiDf header file, located in the include directory)
are:
- DB2LOADQUERY_SHOW_ALL_MSGS
- Return all load messages.
- DB2LOADQUERY_SHOW_NO_MSGS
- Return no load messages.
- DB2LOADQUERY_SHOW_NEW_MSGS
- Return only messages that have been generated since the last call
to this API.
- poOutputStruct
- Output. A pointer to the db2LoadQueryOutputStruct structure, which contains load summary information. Set to NULL if a summary is not required.
- piLocalMessageFile
- Input. Specifies the name of a local file to be used for output
messages.
db2LoadQueryOutputStruct data structure parameters
- oRowsRead
- Output. Number of records read so far by the load utility.
- oRowsSkipped
- Output. Number of records skipped before the load operation began.
- oRowsCommitted
- Output. Number of rows committed to the target table so far.
- oRowsLoaded
- Output. Number of rows loaded into the target table so far.
- oRowsRejected
- Output. Number of rows rejected from the target table so far.
- oRowsDeleted
- Output. Number of rows deleted from the target table so far (during
the delete phase).
- oCurrentIndex
- Output. Index currently being built (during the build phase).
- oNumTotalIndexes
- Output. Total number of indexes to be built (during the build
phase).
- oCurrentMPPNode
- Output. Indicates which database partition server is being queried
(for partitioned database environment mode only).
- oLoadRestarted
- Output. A flag whose value is TRUE if the load operation being
queried is a load restart operation.
- oWhichPhase
- Output. Indicates the current phase of the load operation being
queried. Valid values (defined in db2ApiDf header
file, located in the include directory) are:
- DB2LOADQUERY_LOAD_PHASE
- Load phase.
- DB2LOADQUERY_BUILD_PHASE
- Build phase.
- DB2LOADQUERY_DELETE_PHASE
- Delete phase.
- DB2LOADQUERY_INDEXCOPY_PHASE
- Index copy phase.
- oWarningCount
- Output. Total number of warnings returned so far.
- oTableState
- Output. The table states. Valid values (defined in db2ApiDf header file, located in the include directory) are:
- DB2LOADQUERY_NORMAL
- No table states affect the table.
- DB2LOADQUERY_SI_PENDING
- The table has constraints and the constraints have yet to be verified.
Use the SET INTEGRITY statement to take the table out of the DB2LOADQUERY_SI_PENDING
state. The load utility puts a table into the DB2LOADQUERY_SI_PENDING
state when it begins a load on a table with constraints.
- DB2LOADQUERY_LOAD_IN_PROGRESS
- There is a load actively in progress on this table.
- DB2LOADQUERY_LOAD_PENDING
- A load has been active on this table but has been aborted before
the load could commit. Issue a load terminate, a load restart, or
a load replace to bring the table out of the DB2LOADQUERY_LOAD_PENDING
state.
- DB2LOADQUERY_REORG_PENDING
- A reorg recommended alter has been performed on this table. A
classic reorg must be performed before the table will be accessible.
- DB2LOADQUERY_READ_ACCESS
- The table data is available for read access queries. Loads using
the DB2LOADQUERY_READ_ACCESS option put the table into Read Access
Only state.
- DB2LOADQUERY_NOTAVAILABLE
- The table is unavailable. The table may only be dropped or it
may be restored from a backup. Rollforward through a non-recoverable
load will put a table into the unavailable state.
- DB2LOADQUERY_NO_LOAD_RESTART
- The table is in a partially loaded state that will not allow a
load restart. The table will also be in the Load Pending state. Issue
a load terminate or a load replace to bring the table out of the No
Load Restartable state. The table can be placed in the DB2LOADQUERY_NO_LOAD_RESTART
state during a rollforward operation. This can occur if you rollforward
to a point in time that is before the end of a load operation, or
if you roll forward through an aborted load operation but do not roll
forward to the end of the load terminate or load restart operation.
db2LoadQueryOutputStruct64 data structure parameters
- oRowsRead
- Output. Number of records read so far by the load utility.
- oRowsSkipped
- Output. Number of records skipped before the load operation began.
- oRowsCommitted
- Output. Number of rows committed to the target table so far.
- oRowsLoaded
- Output. Number of rows loaded into the target table so far.
- oRowsRejected
- Output. Number of rows rejected from the target table so far.
- oRowsDeleted
- Output. Number of rows deleted from the target table so far (during
the delete phase).
- oCurrentIndex
- Output. Index currently being built (during the build phase).
- oNumTotalIndexes
- Output. Total number of indexes to be built (during the build
phase).
- oCurrentMPPNode
- Output. Indicates which database partition server is being queried
(for partitioned database environment mode only).
- oLoadRestarted
- Output. A flag whose value is TRUE if the load
operation being queried is a load restart operation.
- oWhichPhase
- Output. Indicates the current phase of the load operation being
queried. Valid values (defined in db2ApiDf header
file, located in the include directory) are:
- DB2LOADQUERY_LOAD_PHASE
- Load phase.
- DB2LOADQUERY_BUILD_PHASE
- Build phase.
- DB2LOADQUERY_DELETE_PHASE
- Delete phase.
- DB2LOADQUERY_INDEXCOPY_PHASE
- Index copy phase.
- oWarningCount
- Output. Total number of warnings returned so far.
- oTableState
- Output. The table states. Valid values (defined in db2ApiDf header file, located in the include directory)
are:
- DB2LOADQUERY_NORMAL
- No table states affect the table.
- DB2LOADQUERY_SI_PENDING
- The table has constraints and the constraints have yet to be verified.
Use the SET INTEGRITY statement to take the table out of the DB2LOADQUERY_SI_PENDING
state. The load utility puts a table into the DB2LOADQUERY_SI_PENDING
state when it begins a load on a table with constraints.
- DB2LOADQUERY_LOAD_IN_PROGRESS
- There is a load actively in progress on this table.
- DB2LOADQUERY_LOAD_PENDING
- A load has been active on this table but has been aborted before
the load could commit. Issue a load terminate, a load restart, or
a load replace to bring the table out of the DB2LOADQUERY_LOAD_PENDING
state.
- DB2LOADQUERY_REORG_PENDING
- A reorg recommended alter has been performed on this table. A
classic reorg must be performed before the table will be accessible.
- DB2LOADQUERY_READ_ACCESS
- The table data is available for read access queries. Loads using
the DB2LOADQUERY_READ_ACCESS option put the table into Read Access
Only state.
- DB2LOADQUERY_NOTAVAILABLE
- The table is unavailable. The table may only be dropped or it
may be restored from a backup. Rollforward through a non-recoverable
load will put a table into the unavailable state.
- DB2LOADQUERY_NO_LOAD_RESTART
- The table is in a partially loaded state that will not allow a
load restart. The table will also be in the Load Pending state. Issue
a load terminate or a load replace to bring the table out of the No
Load Restartable state. The table can be placed in the DB2LOADQUERY_NO_LOAD_RESTART
state during a rollforward operation. This can occur if you rollforward
to a point in time that is before the end of a load operation, or
if you roll forward through an aborted load operation but do not roll
forward to the end of the load terminate or load restart operation.
db2LoadQueryStruct64 data structure parameters
- iStringType
- Input. Specifies a type for piString. Valid
values (defined in db2ApiDf header file, located
in the include directory) are:
- DB2LOADQUERY_TABLENAME
- Specifies a table name for use by the db2LoadQuery API.
- piString
- Input. Specifies a temporary files path name or a table name,
depending on the value of iStringType.
- iShowLoadMessages
- Input. Specifies the level of messages that are to be returned
by the load utility. Valid values (defined in db2ApiDf header file, located in the include directory)
are:
- DB2LOADQUERY_SHOW_ALL_MSGS
- Return all load messages.
- DB2LOADQUERY_SHOW_NO_MSGS
- Return no load messages.
- DB2LOADQUERY_SHOW_NEW_MSGS
- Return only messages that have been generated since the last call
to this API.
- poOutputStruct
- Output. A pointer to the db2LoadQueryOutputStruct structure, which contains load summary information. Set to NULL if a summary is not required.
- piLocalMessageFile
- Input. Specifies the name of a local file to be used for output
messages.
db2gLoadQueryStruct data structure specific parameters
- iStringLen
- Input. Specifies the length in bytes of piString parameter.
- iLocalMessageFileLen
- Input. Specifies the length in bytes of piLocalMessageFile parameter.
db2gLoadQueryStru64 data structure specific parameters
- iStringLen
- Input. Specifies the length in bytes of piString parameter.
- iLocalMessageFileLen
- Input. Specifies the length in bytes of piLocalMessageFile parameter.
Usage notes
This API reads the status of
the load operation on the table specified by piString, and writes the status to the file specified by piLocalMsgFileName.