Start of change

JOBLOG_INFO table function

The JOBLOG_INFO table function returns one row for each message in a job log.

Read syntax diagramSkip visual syntax diagram
>>-JOBLOG_INFO--(--job-name--)---------------------------------><

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.

The result of the function is a table containing multiple rows with the format shown in the following table. All the columns are nullable.

Table 1. JOBLOG_INFO table function
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:
  • COMMAND
  • COMPLETION
  • DIAGNOSTIC
  • ESCAPE
  • INFORMATIONAL
  • INQUIRY
  • NOTIFY
  • REPLY
  • REQUEST
  • SCOPE
  • SENDER
MESSAGE_SUBTYPE VARCHAR(22) Subtype of message.

Values for NOTIFY or ESCAPE messages are:

  • EXCEPTION HANDLED
  • EXCEPTION NOT HANDLED

Values for REPLY messages are:

  • FROM EXIT PROGRAM
  • FROM SYSTEM REPLY LIST
  • MESSAGE DEFAULT USED
  • NOT VALIDITY CHECKED
  • SYSTEM DEFAULT USED
  • VALIDITY CHECKED
Contains the null value for other message types.
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(512) FOR BIT DATA The message token string. If the value is longer than 512 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.

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
End of change