midrange.com code scratchpad
Name:
Finding job ending codes
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
11/13/2017 07:48:21 pm
IP:
Logged
Description:
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/QSYS2.HISTORY_LOG_INFO%20UDTF
Code:
  1. SELECT 
  2. ORDINAL_POSITION,   -- A unique number for each row that indicates the time order of messages in the job log.
  3. MESSAGE_ID,         -- The message ID for this message.
  4. MESSAGE_TYPE,       -- Type of message.
  5. MESSAGE_SUBTYPE,    -- Subtype of message.
  6. SEVERITY,           -- The severity assigned to the message.
  7. MESSAGE_TIMESTAMP,  -- The timestamp when the message was sent.
  8. FROM_USER,          -- The current user of the job when the message was sent.
  9. FROM_JOB,           -- The qualified job name when the message was sent.
  10. FROM_PROGRAM,       -- The program that sent the message.
  11. MESSAGE_LIBRARY,    -- The name of the library containing the message file.
  12. MESSAGE_FILE,       -- The message file containing the message.
  13. MESSAGE_TOKENS,     -- The message token string. If the value is longer than 4096 characters, it will be truncated with no warning.
  14. substr(message_tokens, 49, 2) as Ending_Code_c,
  15. binary(substr(message_tokens, 49, 2)) as Ending_Code_binary,
  16. cast(binary(substr(message_tokens, 49, 2)) as integer) as Ending_Code,
  17. MESSAGE_TEXT,       -- The first level text of the message including tokens, or the impromptu message text.
  18. MESSAGE_SECOND_LEVEL_TEXT  -- The second level text of the message including tokens.
  19. -- SYSLOG_EVENT,       -- The Common Event Format (CEF) syslog event for the message preceded by a header of the requested type.
  20. -- SYSLOG_FACILITY,    -- The syslog facility assigned to the event.
  21. -- SYSLOG_SEVERITY    -- The syslog severity assigned to the event.
  22. -- SYSLOG_PRIORITY     -- The syslog priority number assigned to the event.
  23. FROM TABLE (QSYS2.HISTORY_LOG_INFO(-- START_TIME => CURRENT DATE
  24.               )) AS X
  25. Where message_id='CPF1164'
  26. and date(message_timestamp)='2017-11-12'
  27. and hour(message_timestamp)=23
  28. and minute(message_timestamp)=49
  29. ORDER BY ORDINAL_POSITION desc;
© 2004-2019 by midrange.com generated in 0.009s valid xhtml & css