ADMIN_INFO_IFCID stored procedure
The ADMIN_INFO_IFCID stored procedure returns Db2 instrumentation facility interface (IFI) information.
Environment
ADMIN_INFO_IFCID must run in a WLM-established stored procedure address space.
Authorization
To execute the CALL statement, the owner of the package or plan that contains the CALL statement must have one or more of the following privileges on each package that the stored procedure uses:
- The EXECUTE privilege on the package for DSNADMIF
- Ownership of the package
- PACKADM authority for the package collection
- SYSADM authority
The user who calls this stored procedure must have MONITOR1 privilege.
Syntax
The following syntax diagram shows the SQL CALL statement for invoking this stored procedure:
Option descriptions
- ifcid
- Specifies the Db2 instrumentation facility component ID (IFCID). Valid values are: 1, 2, 225.
This is an input parameter of type INTEGER and cannot be null.
- db2-member
- Specifies the name of the single data sharing group member that executes the IFI request.
This is an input parameter of type VARCHAR(8) and must be null.
- return-code
- Provides the return code from the stored procedure. Possible values are:
- 0
- The call completed successfully.
- 12
- The call did not complete successfully. The MSG output parameter contains messages that describe the error that is encountered by the stored procedure.
This is an output parameter of type INTEGER.
- message
- Contains messages that describe the error that was encountered by the stored procedure. If an error did not occur, a message is not returned.
This is an output parameter of type VARCHAR(1331).
Output
This stored procedure returns the following output parameters, which are described in Option descriptions:
- return-code
- message
In addition to the preceding output, the stored procedure returns one result set that contains the IFI record associated with the IFCID specified. The following table shows the format of the result set that is returned in the created global temporary table SYSIBM.IFIREC:
Column name | Data type | Contents |
---|---|---|
ROWNUM | INTEGER NOT NULL | Sequence number of the table row, from 1 to n |
IFIREC | VARCHAR(32000) FOR BIT DATA NOT NULL | VARCHAR(32000) FOR BIT DATA NOT NULL. If an IFCID record exceeds 32,000 characters it is split up and inserted into this table with the sequence starting at 1, and then incremented with every insert. |
Example
The following example program calls the ADMIN_INFO_IFCID stored procedure.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/******************** DB2 SQL Communication Area ********************/
EXEC SQL INCLUDE SQLCA;
int main( int argc, char *argv[] ) /* Argument count and list */
{
/****************** DB2 Host Variables ****************************/
EXEC SQL BEGIN DECLARE SECTION;
/* SYSPROC.ADMIN_INFO_IFCID parameters */
long int ifcid; /* IFCID */
short int ind_ifcid; /* Indicator variable */
char db2_member[9]; /* Data sharing group member */
short int ind_db2_member; /* Indicator variable */
long int retcd; /* Return code */
short int ind_retcd; /* Indicator variable */
char errmsg[1332]; /* Error message */
short int ind_errmsg; /* Indicator variable */
/* Result set locators */
volatile SQL TYPE IS RESULT_SET_LOCATOR *rs_loc1;
/* Result set row */
long int rownum; /* Sequence number of the */
/* table row (1,...,n) */
struct {
short len;
char text[32001];
} ifirec; /* IFI record */
EXEC SQL END DECLARE SECTION;
/******************************************************************/
/* Initializatation */
/******************************************************************/
ifcid = 1;
retcd = 0;
errmsg[0] = '\0';
ind_ifcid = 0;
ind_db2_member = -1;
ind_retcd = -1;
ind_errmsg = -1;
rownum = 0;
ifirec.len = 0;
ifirec.text[0] = '\0';
/******************************************************************/
/* Call stored procedure SYSPROC.ADMIN_INFO_IFCID */
/******************************************************************/
EXEC SQL CALL SYSPROC.ADMIN_INFO_IFCID
(:ifcid :ind_ifcid,
:db2_member :ind_db2_member,
:retcd :ind_retcd,
:errmsg :ind_errmsg);
/******************************************************************/
/* Retrieve result set when the SQLCODE from the call is +446, */
/* which indicates that result sets were returned */
/******************************************************************/
if (SQLCODE == +466) /* Result sets were returned */
{
/* Establish a link between the result set and its locator */
EXEC SQL ASSOCIATE LOCATORS (:rs_loc1)
WITH PROCEDURE SYSPROC.ADMIN_INFO_IFCID;
/* Associate a cursor with the result set */
EXEC SQL ALLOCATE C1 CURSOR FOR RESULT SET :rs_loc1;
/* Perform fetches using C1 to retrieve all rows from the */
/* result set */
EXEC SQL FETCH C1
INTO :rownum, :ifirec;
while(SQLCODE==0)
{
EXEC SQL FETCH C1
INTO :rownum, :ifirec;
}
EXEC SQL CLOSE C1;
}
return(retcd);
}