JOBLOG_INFO table function
The JOBLOG_INFO table function returns one row for each message in a job log.
The values returned for the table function columns are closely related to the values returned by the Display Job Log (DSPJOBLOG) CL command.
Authorization:
- None required to see job log information for jobs where the caller's user profile is the same as the job user identity of the job for which the information is being returned.
- If the job user identity of the job for which the information is being returned has *ALLOBJ special authority, the caller must have *ALLOBJ special authority or be authorized to the QIBM_ACCESS_ALLOBJ_JOBLOG function usage identifier.
- Otherwise, the caller must have *JOBCTL special authority.
The schema is QSYS2.
- job-name
- A character or graphic string expression that identifies the qualified name of a job. The special value of '*' indicates the current job.
- ignore-errors
- A character or graphic string expression that identifies what to do when an error is encountered.
- NO
- An error is returned. This is the default.
- YES
- A warning is returned. No rows are returned when an error is encountered.
The result of the function is a table containing multiple rows with the format shown in the following table. All the columns are nullable.
Column Name | Data Type | Description |
---|---|---|
ORDINAL_POSITION | INTEGER | A unique number for each row that indicates the time order of messages in the job log. The first (oldest) message in the job log will have a value of 1. Subsequent messages will have a value one greater than the previous message. Since these values are assigned when this catalog is queried, there will be no gaps in values. There is no visibility of messages that have been deleted from the job log. |
MESSAGE_ID | VARCHAR(7) | The message ID for this message. Contains the null value if this is an impromptu message or a REQUEST message. |
MESSAGE_TYPE | VARCHAR(13) | Type of message. Values are:
|
MESSAGE_SUBTYPE | VARCHAR(22) | Subtype of message. Values for NOTIFY or ESCAPE messages are:
Values for REPLY messages are:
|
SEVERITY | SMALLINT | The severity assigned to the message. |
MESSAGE_TIMESTAMP | TIMESTAMP | The timestamp for when the message was issued. |
FROM_LIBRARY | VARCHAR(10) | The library containing the program or service program that sent the message. |
FROM_PROGRAM | VARCHAR(256) | The program or service program name that sent the message. |
FROM_MODULE | VARCHAR(10) | The module that sent the message. |
FROM_PROCEDURE | VARCHAR(4096) | The procedure that sent the message. |
FROM_INSTRUCTION | VARCHAR(10) | The instruction that sent the message. |
TO_LIBRARY | VARCHAR(10) | The library containing the program or service program that received the message |
TO_PROGRAM | VARCHAR(10) | The program or service program name that received the message. |
TO_MODULE | VARCHAR(10) | The module that received the message. |
TO_PROCEDURE | VARCHAR(4096) | The procedure that received the message. |
TO_INSTRUCTION | VARCHAR(10) | The instruction that received the message. |
FROM_USER | VARCHAR(10) | The userid of the job when the message was sent. |
MESSAGE_FILE | VARCHAR(10) | The message file containing the message. |
MESSAGE_LIBRARY | VARCHAR(10) | The name of the library containing the message file. |
MESSAGE_TOKEN_LENGTH | SMALLINT | The length of the MESSAGE_TOKENS string. |
MESSAGE_TOKENS | VARCHAR(12000) FOR BIT DATA | The message token string. If the value is longer than 12000 characters, it will be truncated with no warning. |
MESSAGE_TEXT | VARGRAPHIC(1024) CCSID 1200 | The first level text of the message including tokens. |
MESSAGE_SECOND_LEVEL_TEXT | VARGRAPHIC(4096) CCSID 1200 | The second level text of the message including tokens. |
MESSAGE_KEY | BINARY(4) | The key assigned to the message. The key is assigned by the command or API that sends the message. |
QUALIFIED_JOB_NAME | VARCHAR(28) | The qualified name of the job for this job log. |
Examples
- Return joblog information for job
347117/QUSER/QZDASOINIT.
SELECT * FROM TABLE(QSYS2.JOBLOG_INFO('347117/QUSER/QZDASOINIT')) A
- Extract the last command entered by the user.
SELECT MESSAGE_TEXT FROM TABLE(QSYS2.JOBLOG_INFO('817029/QUSER/QPADEV0004')) A WHERE A.MESSAGE_TYPE = 'REQUEST' ORDER BY ORDINAL_POSITION DESC FETCH FIRST 1 ROW ONLY