GET_CONSOLE, GET_EVENT_INFO
Use the GET_CONSOLE and the GET_EVENT_INFO script functions to retrieve information about CONS, FILE and DB events that have occurred. Both script functions have the same syntax.
-
GET_CONSOLE
- BS2000 and z/OS: Retrieves the Console message.
- OS/400: Retrieves information from a message queue. You can define the message queue to be monitored in the INI file of the OS/400 agent. For more information, see Console (CONS) Event Objects.
-
GET_EVENT_INFO
Retrieves information from the scripts of FILE events where z/OS provides specific keywords.
Syntax
GET_CONSOLE (Keyword[, Index])
GET_EVENT_INFO (Keyword[, Index])
Parameters
| Parameter | Description | Format/Allowed Values |
|---|---|---|
| Keyword |
Defines the message part that should be read. See the Allowed Keywords table below for the complete list. |
AE name, script literal or script variable |
| Index |
(Optional) Can only be used in combination with the keyword INSERT, RESULT1 and RESULT2.
|
Script literal, number or script variable. Default: 1 |
Allowed Keywords
| Keyword | Description | Available for | Allowed Values/Notes |
|---|---|---|---|
| ACCESS | File access. | Automatic z/OS FILE events | CLOSE: Closes the file. |
| ACTIVATIONSTATE | Adapter status. | SAP XI |
|
| ALERT_OPTION | Returns if and when an SNA alert is created and sent to the message. | OS/400 and Windows |
|
| CATEGORY | Event category. | Windows | n.a. |
| CHANNEL | Communication channel. | SAP XI | n.a. |
| DDNAME | DD description. | Automatic z/OS FILE events | n.a. |
| EVENT_ADDITIONAL_PARM | Additional parameters of SAP Java Scheduler events. | SAP Java | n.a. |
| EVENT_COUNTOFJOBS | Number of triggered SAP jobs (ABAP). | SAP ABAP | n.a. |
| EVENT_GUID | SAP event's instance number (ABAP). | SAP Java | n.a. |
| EVENT_ID | Event ID (ABAP/Java Events). | SAP ABAP, SAP Java, and Windows | n.a. |
| EVENT_PARM | SAP event parameter (ABAP/Java events). | SAP ABAP and SAP Java | n.a. |
| EVENT_PROCESSSTATE | SAP processing status (ABAP). | SAP ABAP | n.a. |
| EVENT_SERVER | SAP-event server (ABAP). | SAP ABAP | n.a. |
| EVENT_STATE | SAP event status (ABAP). | SAP ABAP | n.a. |
| EVENT_TYPE | SAP Java Scheduler event type. | SAP Java | n.a. |
| FILENAME | Name of the file. |
FILE events, Automatic z/OS FILE events |
|
| FILESIZE | Size of the file. | FILE events |
(FILE events only) Set the following:
|
| ID | Message ID. | SAP XI | n.a. |
| INFO_ACTION | Action. | Automatic z/OS FILE events | YES (An object has been activated), NO (No object has been activated) |
| INFO_TEXT | Name of the activated object. | Automatic z/OS FILE events | n.a. |
| INSERT | Accesses a certain variable part of a message together with Index. | OS/400 and Windows | n.a. |
| INSERT_COUNT | Determines the number of the message's variable part. | OS/400 and Windows | n.a. |
| INSERT_ID | Retrieves the identification of the job. | Automatic z/OS FILE events and z/OS | n.a. |
| INSERT_NAME | Retrieves the identification of the job. | Automatic z/OS FILE events and z/OS | n.a. |
| JOB_ABENDED | End status of the job which closed the file. | Automatic z/OS FILE events |
|
| JOB_ENDED | Status of the job which closed the file. | Automatic z/OS FILE events |
|
| JOB_NAME | Name of the job. | Automatic z/OS FILE events and z/OS | n.a. |
| LPAR_NAME | Returns the LPAR name. | Automatic z/OS FILE events and z/OS | n.a. |
| MEMGEN | Member name or generation number. | Automatic z/OS FILE events | n.a. |
| MSG_DESCRIPTOR | Description of the message as a 16-bit field. | z/OS |
|
| MSG_FILE_LIBRARY | Name of the library containing the message file or the values "*CURLIB" or "*LIBL" used by the send program. | OS/400 | n.a. |
| MSG_FILE_NAME | Name of the message file which contains the obtained message. | OS/400 | n.a. |
| MSG_ID | Message ID of the received message. | OS/400 | This field is left blank if an improvised message is obtained. |
| MSG_KEY | Message key of the obtained message. | OS/400 | Four-figure value in hexadecimal format X'xxxxxxxx'. |
| MSG_LEVEL | Urgency level of the message (16-bit field). | z/OS |
|
| MSG_LIBRARY_USED | Real name of the library which is used to send the message. | OS/400 | The library can contain overriding instructions. Thus, this is not necessarily the library in which the message is actually stored. |
| MSG_MISC | Various additional message information (16-bit field). | OS/400 |
|
| MSG_SEVERITY | Severity of the obtained message. | OS/400 | Allowed values: 0 to 99 |
| MSG_TEXT | Message text (default value). | BS2000, z/OS, and OS/400 | n.a. |
| MSGNR | Message number. | BS2000 | n.a. |
| MSGTYPE, MSGTYP | Retrieves the message type. | BS2000 and OS/400 |
OS/400 specific values:
|
| OS_NAME | Name of the operating system in the console message defined by IBM. | z/OS | Currently, this name is always MVS. |
| PARTY | Partner. | SAP XI | n.a. |
| PROCESSID | Task number (TSN) in the console message. | BS2000 | n.a. |
| PROGRAM_NAME | Program description. | Automatic z/OS FILE events | n.a. |
| REPLY_ID | Reply ID of the console message. | z/OS | n.a. |
| RESULT | Indicates whether the conditions of file system events with the checks FILESIZE or PATH_FILE_COUNT were fulfilled. | FILE events |
|
| RESULT1 | Allows access to the SQL query result for "Value 1". | DB events | In Index, specify the column number whose value should be read. Important! A database event only reads the first 10 columns. Column contents that exceed 255 characters are truncated. The value " " is returned if you try to access a non-existing column. |
| RESULT2 | Allows access to the SQL query result for "Value 2". | DB events | In Index, specify the column number whose value should be read. Important! A database event only reads the first 10 columns. Column contents that exceed 255 characters are truncated. The value " " is returned if you try to access a non-existing column. |
| RETCODE | Return code of the job in converted format. | Automatic z/OS FILE events | For more information, see Return Codes of z/OS Jobs. |
| RETCODE_STATE | Filter specification for the return code. | Automatic z/OS FILE events |
|
| SEND_JOB | Name of the job that was used to send the received message. | OS/400 | n.a. |
| SEND_JOB_NUMBER | Number of the job that was used to send the received message. | OS/400 | n.a. |
| SEND_USER_PROFILE | Name of the user profile that was used to send the received message. | OS/400 | n.a. |
| SERVICE | Service. | SAP XI and automatic z/OS FILE events | n.a. |
| SMS_MANAGEMENT_CLASS, SMS_DATA_CLASS, SMS_STORAGE_CLASS | Name of the class. | Automatic z/OS FILE events | n.a. |
| SOURCE | Source of the event. | Windows | n.a. |
| STATE | Status. | SAP XI |
|
| STEP_NAME | Name of the job step. | Automatic z/OS FILE events | n.a. |
| SYS_NAME | User-defined system name. | z/OS and automatic z/OS FILE events | n.a. |
| SYSPLEX_NAME | SYSPLEX name. | z/OS and automatic z/OS FILE events | n.a. |
| TIMESTAMP | Date and time of the console message. | BS2000, z/OS, OS/400, SAP ABAP, SAP Java, Windows, FILE events, and automatic z/OS FILE events | Subject to identical constraints as defined for the FILENAME keyword. |
| TYPE | Type of the event. | Windows |
|
| USER | User. | Windows | n.a. |
Platform-specific Features
-
z/OS
The keywords MSG_DESCRIPTOR, MSG_LEVEL, and MSG_MISC are special features. They are 16-bit fields, of which each bit has a specific meaning. You can query each bit with this script function. You can do so by giving the bit a value or a constant with Index. The value returned by this script function is "1" (bit is set) or "0" (bit is not set).
-
OS/400
With INSERT_COUNT as the keyword, you can establish the number of variable parts of a message in an OS/400 message. With INSERT as the keyword and by specifying the Index, a specific variable part of a message can be accessed. Without Index, the function returns the first variable part of the message.
Examples
The GET_CONSOLE function is used to retrieve the TSN of the process that triggered the event:
:SET &PROCESS_ID# = GET_CONSOLE(PROCESSID)
The second example determines the number of variable parts of the message text (inserts) of an OS/400 message. Then, a process loop runs where all inserts are written in the activation report:
:SET &COUNT# = GET_CONSOLE("INSERT_COUNT")
:SET &IDX# = 1
:WHILE &COUNT# > 0
:SET &INSERT# = GET_CONSOLE("INSERT", &IDX#)
:SET &HELP# = FORMAT(&IDX#, "000")
:PRINT "INSERT[&HELP#] = '&INSERT#'"
:SET &IDX# = ADD(&IDX#, 1)
:SET &COUNT# = SUB(&COUNT#, 1)
:ENDWHILE
The following lines are logged in the activation report:
20220110/235011.000 - U0020408 INSERT[001] = 'QPFRMON'
20220110/235011.000 - U0020408 INSERT[002] = 'QPGMR'
20220110/235011.000 - U0020408 INSERT[003] = '007982'
20220110/235011.000 - U0020408 INSERT[004] = '23:48:43'
20220110/235011.000 - U0020408 INSERT[005] = '20/01/01'
20220110/235011.000 - U0020408 INSERT[006] = '0'
The third example retrieves a component of the console message in z/OS. Bit 03 of the MSG_DESCRIPTOR keyword is accessed. Bit 03 is given either as a value or a constant.
: SET &RET# = GET_CONSOLE ("MSG_DESCRIPTOR", 3)
: SET &RET# = GET_CONSOLE ("MSG_DESCRIPTOR", "EVENTUAL_ACTION")
The following example shows a script excerpt that retrieves the file name and reads the file content line by line.
: SET &FILE_NAME# = GET_EVENT_INFO (FILENAME)
: SET &HND# = PREP_PROCESS_FILE ("MVSHOST", &FILE_NAME#)
The fifth example reads the values of an SQL query for Value 1 in a database event.
SQL results:
Last name: Smith
First name: John
Location: Seattle
The first name is retrieved as shown below:
: SET &First name# = GET_EVENT_INFO (RESULT1, 2)
The following line supplies the location:
: SET &Location# = GET_EVENT_INFO (RESULT1, 3)
See Also