JOBLOG_INFO table function

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

Read syntax diagramSkip visual syntax diagramJOBLOG_INFO(JOB_NAME => job-name ,IGNORE_ERRORS => ignore-errors)
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.
Start of changeignore-errorsEnd of change
Start of change 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.
End of change

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(2048) FOR BIT DATA The message token string. If the value is longer than 2048 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.
Start of changeMESSAGE_KEYEnd of change Start of changeBINARY(4)End of change Start of changeThe key assigned to the message.

The key is assigned by the command or API that sends the message.

End of change
Start of changeQUALIFIED_JOB_NAMEEnd of change Start of changeVARCHAR(28)End of change Start of changeThe qualified name of the job for this job log.End of change

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