Paul:
Here's a more concrete example of what I suggested. This query will tell
you how many QZDASOINIT jobs are running, but first it creates a table with
all the jobs that are running in QUSRWRK in qtemp. The last statement
simply puts out a number of jobs.
Now your CLP can read the file in QTEMP and react as needed:
drop table qtemp.actjobs;
create table qtemp.actjobs as (SELECT SUBSTR(JOB_NAME,1,6) AS JOB_NUMBER,
SUBSTR(JOB_NAME,8,POSSTR(SUBSTR(JOB_NAME,8),'/')-1) AS JOB_USER,
SUBSTR(SUBSTR(JOB_NAME,8),POSSTR(SUBSTR(JOB_NAME,8),'/')+1) AS
JOB_NAME FROM TABLE (QSYS2.ACTIVE_JOB_INFO(SUBSYSTEM_LIST_FILTER =>
'QUSRWRK'))as x) with data;
select count(job_name) from qtemp.actjobs where job_name = 'QZDASOINIT';
--
Jim Oberholtzer
Agile Technology Architects
-----Original Message-----
From: Jim Oberholtzer [mailto:midrangel@xxxxxxxxxxxxxxxxx]
Sent: Thursday, June 14, 2018 10:52 AM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxx>
Subject: RE: V7R3 - Halcyon Subsystem job monitor - determine which job is
not running
My own take would be to create a table of jobs that should run in each
subsystem that you wish to check.
Modify the SQL below to take the existing SQL and add a compare against the
table and update a second table with the results (QTEMP or permanent, no
matter which). Now have your CL read that table which contains only the
missing jobs and react accordingly, Start them, or send a message, or both.
90% of that is done in the single SQL statement that can run with STRSQL or
DB2 command from shell. The read loop in CLP is simple so you have a short,
to the point CLP that can handle just about any subsystem, or specific need.
As a note, it's actually easier to do in Python than in CL (because you can
directly read the cursor output without creating the intermediate table) but
the results are the same, and the SQL is the same.
--
Jim Oberholtzer
Agile Technology Architects
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Steinmetz, Paul
Sent: Thursday, June 14, 2018 10:09 AM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxx>
Subject: RE: V7R3 - Halcyon Subsystem job monitor - determine which job is
not running
Jim,
How do I get the SQL compare results into a CL variable, which will be part
of my alert message?
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jim
Oberholtzer
Sent: Wednesday, June 13, 2018 12:18 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: V7R3 - Halcyon Subsystem job monitor - determine which job is
not running
So using:
SELECT SUBSTR(JOB_NAME,1,6) AS JOB_NUMBER,
SUBSTR(JOB_NAME,8,POSSTR(SUBSTR(JOB_NAME,8),'/')-1) AS JOB_USER,
SUBSTR(SUBSTR(JOB_NAME,8),POSSTR(SUBSTR(JOB_NAME,8),'/')+1) AS
JOB_NAME FROM TABLE (QSYS2.ACTIVE_JOB_INFO(SUBSYSTEM_LIST_FILTER =>
'QUSRWRK')) AS X;
Substitute the Halcyon subsystem for QUSRWRK and you have a list of jobs
running. Compare that to what should be running (from a table or other
storage method) and issue messages as needed.
Is this too easy? Why do you want to use TAA tools, adding a dependency to
your project? Don't get me wrong TAA tools are great and I use them when
available at the customer, but we tend away from it when doing system
programming simply to keep dependencies to a minimum.
--
Jim Oberholtzer
Agile Technology Architects
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Steinmetz, Paul
Sent: Wednesday, June 13, 2018 10:53 AM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxx>
Subject: RE: V7R3 - Halcyon Subsystem job monitor - determine which job is
not running
Plan C.
No longer using QHST and CPF1164.
Created a new work file containing each job that runs in the subsystem.
Then using the HALCYON performance subsystem monitor, When it triggers, I
created a HALCYON substitution variable, JOBNOT.
JOBNOT calls my usrpgm, reading work file, which uses TAATOOL CHKACTJOB cmd.
If the job is not running, CHKACTJOB returns TAA9893.
The logic will find and concatenate the job names.
Resulting alert.
PENCOR05 - Not all 50 jobs running for subsystem Interface, ADRINBOGUS,ELECT
not running
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Steinmetz, Paul
Sent: Tuesday, June 12, 2018 2:29 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: V7R3 - Halcyon Subsystem job monitor - determine which job is
not running
I found another work around.
I found two control files that contain the job name for all the jobs in the
subsystem.
I will create a Halcyon QHST monitor for CPF1164.
Once triggered, I will match the job name from the CPF1164 to the job name
in either of the control files.
If I get a match, send the alert.
Working on the SQL for the match.
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Steinmetz, Paul
Sent: Tuesday, June 12, 2018 1:37 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: V7R3 - Halcyon Subsystem job monitor - determine which job is
not running
https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=121160
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Rob
Berendt
Sent: Tuesday, June 12, 2018 1:34 PM
To: Midrange Systems Technical Discussion
Subject: RE: V7R3 - Halcyon Subsystem job monitor - determine which job is
not running
Paul,
We're kind of lazy. It helps to get votes if you provide the direct link.
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: "Steinmetz, Paul" <PSteinmetz@xxxxxxxxxx>
To: "'Midrange Systems Technical Discussion'"
<midrange-l@xxxxxxxxxxxx>
Date: 06/12/2018 01:32 PM
Subject: RE: V7R3 - Halcyon Subsystem job monitor - determine which
job is not running
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
I submitted an RFE - Add subsystem name to CPF1164 job ending message.
Please vote for it.
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Rob
Berendt
Sent: Thursday, June 07, 2018 2:01 PM
To: Midrange Systems Technical Discussion
Subject: Re: V7R3 - Halcyon Subsystem job monitor - determine which job is
not running
Has the subsystem, which was a big concern to the OP.
You gave me an idea though.
Are the jobs still active (if they ever were)?
with cpf1124 as (
SELECT
MESSAGE_ID, -- The message ID for this message.
FROM_JOB, -- The qualified job name when the message was sent.
MESSAGE_TOKENS, -- The message token string. If the value is longer
than 4096 characters, it will be truncated with no warning.
MESSAGE_TEXT, -- The first level text of the message including
tokens, or the impromptu message text.
MESSAGE_SECOND_LEVEL_TEXT -- The second level text of the message including
tokens.
FROM TABLE (QSYS2.HISTORY_LOG_INFO(-- START_TIME => CURRENT DATE
)) AS X
Where x.message_id='CPF1124'
and x.message_text like '%QINTER%'
ORDER BY ORDINAL_POSITION desc),
cpf1164 as (
SELECT
MESSAGE_ID, -- The message ID for this message.
FROM_JOB, -- The qualified job name when the message was sent.
MESSAGE_TOKENS, -- The message token string. If the value is longer
than 4096 characters, it will be truncated with no warning.
MESSAGE_TEXT, -- The first level text of the message including
tokens, or the impromptu message text.
MESSAGE_SECOND_LEVEL_TEXT -- The second level text of the message including
tokens.
FROM TABLE (QSYS2.HISTORY_LOG_INFO(-- START_TIME => CURRENT DATE
)) AS X
Where x.message_id='CPF1164'
ORDER BY ORDINAL_POSITION desc)
select cpf1124.from_job from cpf1124
where cpf1124.from_job not in (
select cpf1164.from_job from cpf1164)
;
If the job ain't in this list then freak out!
Of course there are active job services which may work equally as well.
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: "Vernon Hamberg" <vhamberg@xxxxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Date: 06/07/2018 01:04 PM
Subject: Re: V7R3 - Halcyon Subsystem job monitor - determine which
job is not running
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
Rob, did you try the history log info and specify CPF1124? That message also
has a bunch of info that isn't show, same way as CPF1164.
Vern
On 6/7/2018 11:18 AM, Rob Berendt wrote:
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzajq/rzajqudfhisto
ryloginfo.htm
I don't see it in there either.
SELECT
ORDINAL_POSITION, -- A unique number for each row that indicates the
time order of messages in the job log.
MESSAGE_ID, -- The message ID for this message.
MESSAGE_TYPE, -- Type of message.
MESSAGE_SUBTYPE, -- Subtype of message.
SEVERITY, -- The severity assigned to the message.
MESSAGE_TIMESTAMP, -- The timestamp when the message was sent.
FROM_USER, -- The current user of the job when the message was
sent.
FROM_JOB, -- The qualified job name when the message was sent.
FROM_PROGRAM, -- The program that sent the message.
MESSAGE_LIBRARY, -- The name of the library containing the message
file.
MESSAGE_FILE, -- The message file containing the message.
MESSAGE_TOKENS, -- The message token string. If the value is longer
than 4096 characters, it will be truncated with no warning.
MESSAGE_TEXT, -- The first level text of the message including
tokens, or the impromptu message text.
MESSAGE_SECOND_LEVEL_TEXT -- The second level text of the message
including tokens.
-- SYSLOG_EVENT, -- The Common Event Format (CEF) syslog event for
the message preceded by a header of the requested type.
-- SYSLOG_FACILITY, -- The syslog facility assigned to the event.
-- SYSLOG_SEVERITY -- The syslog severity assigned to the event.
-- SYSLOG_PRIORITY -- The syslog priority number assigned to the
event.
FROM TABLE (QSYS2.HISTORY_LOG_INFO(-- START_TIME => CURRENT DATE
)) AS X
Where message_id='CPF1164'
ORDER BY ORDINAL_POSITION desc;
Then again, if one wasn't so stuck in the rut of insisting that all
joblogs go to spool files there's always this:
Select
ORDINAL_POSITION, -- A unique number for each row that indicates the
time order of messages in the job log.
MESSAGE_ID, -- The message ID for this message.
MESSAGE_TYPE, -- Type of message.
MESSAGE_SUBTYPE, -- Subtype of message.
SEVERITY, -- The severity assigned to the message.
MESSAGE_TIMESTAMP, -- The timestamp for when the message was issued.
FROM_LIBRARY, -- The library containing the program or service
program that sent the message.
FROM_PROGRAM, -- The program or service program name that sent
the
message.
FROM_MODULE, -- The module that sent the message.
FROM_PROCEDURE, -- The procedure that sent the message.
FROM_INSTRUCTION, -- The instruction that sent the message.
TO_LIBRARY, -- The library containing the program or service
program that received the message
TO_PROGRAM, -- The program or service program name that
received
the message.
TO_MODULE, -- The module that received the message.
TO_PROCEDURE, -- The procedure that received the message.
TO_INSTRUCTION, -- The instruction that received the message.
FROM_USER, -- The userid of the job when the message was sent.
MESSAGE_FILE, -- The message file containing the message.
MESSAGE_LIBRARY, -- The name of the library containing the message
file.
MESSAGE_TOKEN_LENGTH, -- The length of the MESSAGE_TOKENS string.
MESSAGE_TOKENS, -- The message token string. If the value is longer
than 2048 characters, it will be truncated with no warning.
MESSAGE_TEXT, -- The first level text of the message including
tokens.
MESSAGE_SECOND_LEVEL_TEXT -- The second level text of the message
including tokens.
from table(qsys2.joblog_info('*')) A
where message_id='CPF1124'
order by ordinal_position desc
fetch first row only;
Job 299789/QUSER/QZDASOINIT started on 06/07/18 at 10:52:52 in
subsystem QUSRWRK in QSYS. Job entered system on 06/07/18 at 10:52:52.
The "ending" message does not display the subsystem.
One could submit an RFE.
Rob Berendt
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.