DB2 Version 10.1 for Linux, UNIX, and Windows

sqlma data structure

The SQL monitor area (SQLMA) structure is used to send database monitor snapshot requests to the database manager. It is also used to estimate the size (in bytes) of the snapshot output.

Table 1. Fields in the SQLMA Structure
Field Name Data Type Description
OBJ_NUM INTEGER Number of objects to be monitored.
OBJ_VAR Array An array of sqlm_obj_struct structures containing descriptions of objects to be monitored. The length of the array is determined by OBJ_NUM.
Table 2. Fields in the SQLM-OBJ-STRUCT Structure
Field Name Data Type Description
AGENT_ID INTEGER The application handle of the application to be monitored. Specified only if OBJ_TYPE requires an agent_id (application handle). To retrieve a health snapshot with full collection information, specify SQLM_HMON_OPT_COLL_FULL in this field.
Note: The SQLM_HMON_OPT_COLL_FULL value is deprecated and might be removed in a future release because the health monitor has been deprecated in Version 9.7.
OBJ_TYPE INTEGER The type of object to be monitored.
OBJECT CHAR(128) The name of the object to be monitored. Specified only if OBJ_TYPE requires a name, such as appl_id, or a database alias.
Valid values for OBJ_TYPE (defined in the sqlmon header file, found in the include directory) are:
SQLMA_DB2
Instance related information.
SQLMA_DBASE
Database related information for a particular database. If you use the SQLMA_DBASE value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_APPL
Application information for an application that matches the provided application ID. If you use the SQLMA_APPL value, you must provide an application ID in the object parameter of sqlm_obj_struct structure.
SQLMA_AGENT_ID
Application information for an application that matches the provided agent ID. If you use the SQLMA_AGENT_ID value, you must provide an agent ID in the agent_id parameter of sqlm_obj_struct structure.
SQLMA_DBASE_TABLES
Table information for a particular database. If you use the SQLMA_DBASE_TABLES value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_DBASE_APPLS
Application information for all applications connected to a particular database. If you use the SQLMA_DBASE_APPLS value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_DBASE_APPLINFO
Summary application information for connections to a particular database. If you use the SQLMA_DBASE_APPLINFO value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_DBASE_LOCKS
List of locks held on a particular database. If you use the SQLMA_DBASE_LOCKS value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_APPL_LOCKS
List of locks held by an application with the matching application ID. If you use the SQLMA_APPL_LOCKS value, you must provide an application ID in the object parameter of sqlm_obj_struct structure.
SQLMA_APPL_LOCKS_AGENT_ID
List of locks held by an application with the matching agent ID. If you use the SQLMA_APPL_LOCKS_AGENT_ID value, you must provide an agent ID in the agent_id parameter of sqlm_obj_struct structure.
SQLMA_DBASE_ALL
Database information for all active databases in the instance.
SQLMA_APPL_ALL
Application information for all database connections in the instance.
SQLMA_APPLINFO_ALL
Summary application information for all connections to the instance.
SQLMA_DCS_APPLINFO_ALL
List of Database Connection Services (DCS) connections to the instance.
SQLMA_DYNAMIC_SQL
Dynamic SQL statement information for a particular database. If you use the SQLMA_DYNAMIC_SQL value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_DCS_DBASE
Information for a particular Database Connection Services (DCS) database. If you use the SQLMA_DCS_DBASE value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_DCS_DBASE_ALL
Information for all active Database Connection Services (DCS) databases.
SQLMA_DCS_APPL_ALL
Database Connection Services (DCS) application information for all connections.
SQLMA_DCS_APPL
Database Connection Services (DCS) application information for an application that matches the provided application ID. If you use the SQLMA_DCS_APPL value, you must provide an application ID in the object parameter of sqlm_obj_struct structure.
SQLMA_DCS_APPL_HANDLE
Database Connection Services (DCS) application information for an application that matches the provided agent ID. If you use the SQLMA_DCS_APPL_HANDLE value, you must provide an agent ID in the agent_id parameter of sqlm_obj_struct structure.
SQLMA_DCS_DBASE_APPLS
Database Connection Services (DCS) application information for all active connections to a particular database. If you use the SQLMA_DCS_DBASE_APPLS value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_DBASE_TABLESPACES
Table space information for a particular database. If you use the SQLMA_DBASE_TABLESPACES value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_DBASE_BUFFERPOOLS
Bufferpool information for a particular database. If you use the SQLMA_DBASE_BUFFERPOOLS value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_BUFFERPOOLS_ALL
Information for all bufferpools.
SQLMA_DBASE_REMOTE
Remote access information for a particular federated database. If you use the SQLMA_DBASE_REMOTE value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_DBASE_REMOTE_ALL
Remote access information for all federated databases.
SQLMA_DBASE_APPLS_REMOTE
Remote access information for an application connected to a particular federated database. If you use the SQLMA_DBASE_APPLS_REMOTE value, you must provide the database name in the object parameter of sqlm_obj_struct structure.
SQLMA_APPL_REMOTE_ALL
Remote access information for all applications.

API and data structure syntax

typedef struct sqlma
{  
   sqluint32 obj_num;
   sqlm_obj_struct obj_var[1];
}sqlma;

typedef struct sqlm_obj_struct
{  
   sqluint32 agent_id;
   sqluint32 obj_type;
   _SQLOLDCHAR object[SQLM_OBJECT_SZ];
}sqlm_obj_struct;

COBOL Structure

* File: sqlmonct.cbl
01 SQLMA.
    05 OBJ-NUM                 PIC 9(9) COMP-5.
    05 OBJ-VAR OCCURS 0 TO 100 TIMES DEPENDING ON OBJ-NUM.
        10 AGENT-ID             PIC 9(9) COMP-5.
        10 OBJ-TYPE             PIC 9(9) COMP-5.
        10 OBJECT               PIC X(128).
*