#desc SCM - Detail - CICSPLEX exception alerts (2)
#callable
/*
This IMOD is similar to SCM_CICSPLEX with additional code to
determine if an inactive CICS region is active on another
LPAR. It attempts to handle CICS regions in a CICSPLEX that
were started on one LPAR, then subsequently restarted on
another LPAR. The goal is to eliminate the 'false' warning
condition that indicates the CICS region is not active.
Assumptions:
1) The systems participating in the CICSPLEX are connected
via CCI to allow XSYSTEM data to be retrieved from the
CICSLIST command.
2) The CICS job names are unique across the CICSPLEX.
*/
/*
input_style
SUMMARY - Display line for each jobname indicating ACTIVE/INACTIVE
Do not add detailed exception information
Display line status by locating the overall status of
the specific CICS jobname entry.
input_xsgroup
<optional> - Sets XSGROUP to this group name for CICSLIST so that
cross-system data will be limited to this group of systems
when determining if a CICS region is active on another
LPAR. The group specified must be of type XSSYSTEM.
*/
PARSE UPPER ARG input_group input_style input_xsgroup .
IF input_group = '' THEN input_group = '*'
IF input_style = '' THEN input_style = 'SUMMARY'
CALL INITIALIZE
IF input_xsgroup <> '' THEN
CALL SET_XSGROUP
CALL GET_CICSLIST
CALL GET_GROUPS
DO loop = 1 TO grouplist.0
CALL PROCESS_CICS grouplist.loop
END
IF input_style = 'DETAIL' THEN CALL GET_CALERTS
CALL UPDATE_DATA
EXIT
/*===================================================================*/
/* */
/*===================================================================*/
INITIALIZE:
count = 0
found = 0
execlist_called = 0
grouplist.0 = 0
normal = 'G'
warning = 'Y'
problem = 'R'
action = 'A'
inactive = 'I'
color = normal
cmd_default = 'MOREINFO'
select_parms = ' '
filter_parms = ' '
session = 'SCMDRIVE'
ssid = sysval('ssname')
sysname = sysval('sysname')
RETURN
/*===================================================================*/
/* */
/* Build 2 arrays of jobnames */
/* Active array */
/* INactive array */
/* */
/*===================================================================*/
GET_CICSLIST:
cicslist_active.0 = 0
cicslist_active_cnt = 0
cicslist_inactive.0 = 0
cicslist_inactive_cnt = 0
cicslist_parms = 'NOXSDATA'
IF input_group ¬= '*' THEN
cicslist_parms = cicslist_parms 'GROUP' input_group
cicslist_stack = SWAPSTAK('NEW')
result = SYSVIEW_REQUEST(session 'CICSLIST' cicslist_parms)
DO i = 1 to queued()
PARSE PULL line
IF SUBSTR(line,1,1) = 'D' THEN DO
line = SUBSTR(line,2)
PARSE VALUE line WITH d +1 ,
l_cmd (d) ,
l_name (d) ,
l_execstage (d) ,
l_status (d) ,
.
SELECT
WHEN l_status = 'ACTIVE' THEN DO
cicslist_active_cnt = cicslist_active_cnt + 1
cicslist_active.cicslist_active_cnt = l_name
END
OTHERWISE
DO
cicslist_inactive_cnt = cicslist_inactive_cnt + 1
cicslist_inactive.cicslist_inactive_cnt = l_name
END
END
END
END
cicslist_active.0 = cicslist_active_cnt
cicslist_inactive.0 = cicslist_inactive_cnt
cicslist_stack = SWAPSTAK('DELETE')
RETURN
/*===================================================================*/
/* */
/*===================================================================*/
GET_GROUPS:
grouplist.0 = 0
grouplist_cnt = 0
IF input_group = '*' THEN DO
DO i = 1 TO cicslist_active.0
grouplist_cnt = grouplist_cnt + 1
grouplist.grouplist_cnt = cicslist_active.i
END
DO i = 1 TO cicslist_inactive.0
grouplist_cnt = grouplist_cnt + 1
grouplist.grouplist_cnt = cicslist_inactive.i
END
grouplist.0 = grouplist_cnt
RETURN
END
groups_stack = SWAPSTAK('NEW')
result = SYSVIEW_REQUEST(session 'GROUPS TYPE CICSPLEX NOINPUT')
DO i = 1 to queued()
PARSE PULL line
IF SUBSTR(line,1,1) = 'D' THEN DO
line = SUBSTR(line,2)
PARSE VALUE line WITH d +1 ,
l_cmd (d) ,
l_type (d) ,
l_group (d) ,
l_instance (d) ,
l_option (d) ,
l_member (d) ,
.
IF input_group = l_group THEN DO
grouplist_cnt = grouplist_cnt + 1
grouplist.grouplist_cnt = l_member
END
END
END
grouplist.0 = grouplist_cnt
groups_stack = SWAPSTAK('DELETE')
RETURN
/*===================================================================*/
/* */
/*===================================================================*/
PROCESS_CICS:
PARSE ARG jobname .
found = 0
DO lci = 1 TO cicslist_active.0
IF cicslist_active.lci = jobname THEN DO
found = 1
CALL ADD_ACTIVE jobname
IF input_style = 'DETAIL' THEN DO
CALL SCM_MVSALERTS 'SELECTJOB' jobname
END
LEAVE
END
END
/*-------------------------------------------------------------------*/
/* If the jobname is executing somewhere, don't add it as inactive. */
/*-------------------------------------------------------------------*/
IF found = 0 THEN DO
IF execlist_called then
NOP
ELSE
/* CALL GET_JOBSUM */
CALL GET_CICSJOBS
IF JOB_STATUS(jobname) THEN
NOP
ELSE
CALL ADD_NOTACTIVE jobname
END
RETURN found
/*===================================================================*/
/* */
/*===================================================================*/
ADD_ENTRY:
count = count + 1
outputc.count = normal
IF status = 'ACTIVE' THEN outputc.count = normal
IF status = 'WARNING' THEN outputc.count = warning
IF status = 'INACTIVE' THEN outputc.count = inactive
IF status = 'PROBLEM' THEN outputc.count = problem
output.count = l_desc
If l_arg1 ¬= '' THEN output.count = output.count 'for' l_arg1
If l_arg2 ¬= '' THEN output.count = output.count 'on' l_arg2
output.count = output.count 'is' l_value
outputcmd.count = WORD(l_command,1)
outputp.count = SUBWORD(l_command,2)
IF WORD(l_command,1) = '*' THEN DO
outputcmd.count = cmd_default
outputp.count = l_jobname l_name l_arg1 l_arg2
END
RETURN
/*===================================================================*/
/* */
/*===================================================================*/
ADD_NOTACTIVE:
PARSE ARG an_jobname .
count = count + 1
outputc.count = inactive
outputcmd.count = 'CICSLIST'
output.count = LEFT(jobname,8) ,
LEFT('is not active',32)
outputp.count = ' '
RETURN
/*===================================================================*/
/* */
/*===================================================================*/
ADD_ACTIVE:
PARSE ARG an_jobname .
count = count + 1
outputc.count = normal
output.count = LEFT(jobname,8) ,
LEFT('is active',32)
outputcmd.count = 'CTASKS'
outputp.count = ' '
IF input_style = 'SUMMARY' THEN DO
outputcmd.count = 'SCMENTRY'
outputp.count = '*' ssid sysname 'CICS' jobname
DO i = 1 TO &$scm_count
IF &$scm_type.i = 'CICS' & &$scm_name.i = jobname THEN DO
outputc.count = &$scm_status.i
LEAVE
END
END
END
RETURN
/*===================================================================*/
/* */
/*===================================================================*/
GET_CALERTS:
x = SWAPSTAK('NEW')
result = SYSVIEW_REQUEST(session 'CALERTS WARNING GROUP ' input_group )
/*
result = SYSVIEW_REQUEST(session 'CALERTS NORMAL GROUP ' input_group )
*/
DO i = 1 to queued()
PARSE PULL line
IF SUBSTR(line,1,1) = 'D' THEN DO
line = SUBSTR(line,2)
PARSE VALUE line WITH d +1 ,
l_cmd (d) ,
l_jobname (d) ,
l_name (d) ,
l_arg1 (d) ,
l_arg2 (d) ,
l_task (d) ,
l_value (d) ,
l_status (d) ,
l_ruletype (d) ,
l_desc (d) ,
l_current (d) ,
l_average (d) ,
l_median (d) ,
l_stddev (d) ,
l_change (d) ,
l_chgstd (d) ,
l_warning (d) ,
l_problem (d) ,
l_minimum (d) ,
l_maximum (d) ,
l_elapsed (d) ,
l_date (d) ,
l_time (d) ,
l_hits00 (d) ,
l_hits10 (d) ,
l_hits20 (d) ,
l_hits30 (d) ,
l_hits40 (d) ,
l_hits50 (d) ,
l_hits60 (d) ,
l_hits70 (d) ,
l_hits80 (d) ,
l_hits90 (d) ,
l_hits100 (d) ,
l_int0 (d) ,
l_int1 (d) ,
l_int2 (d) ,
l_int3 (d) ,
l_int4 (d) ,
l_int5 (d) ,
l_int6 (d) ,
l_int7 (d) ,
l_int8 (d) ,
l_int9 (d) ,
l_subgroup (d) ,
.
l_arg1 = STRIP(l_arg1)
l_arg2 = STRIP(l_arg2)
l_value = STRIP(l_value)
l_warning = STRIP(l_warning)
l_problem = STRIP(l_problem)
l_status = STRIP(l_status)
l_desc = STRIP(l_desc)
l_jobname = STRIP(l_jobname)
l_command = '*'
status = l_status
UPPER status
IF l_status = 'WARNING' THEN CALL ADD_ENTRY
IF l_status = 'PROBLEM' THEN CALL ADD_ENTRY
/*
IF l_status = 'NORMAL' THEN CALL ADD_ENTRY
*/
END
END
x = SWAPSTAK('DELETE')
RETURN
/*===================================================================*/
/* */
/*===================================================================*/
UPDATE_DATA:
DO i = 1 TO count
color = outputc.i
text = output.i
select_cmd = outputcmd.i
select_parms = outputp.i
CALL WRITE_DATA
END
RETURN
/*===================================================================*/
/* */
/*===================================================================*/
WRITE_DATA:
/*
IF color = normal THEN RETURN
*/
select_cmd = STRIP(select_cmd)
select_parms = STRIP(select_parms)
filter_parms = STRIP(filter_parms)
/*
text = SPACE(text)
*/
QUEUE LEFT(text,64) || ,
color || ,
LEFT(select_cmd,08) || ,
' ' || ,
LEFT(select_parms,64) || ,
LEFT(filter_parms,64)
filter_parms = ' '
RETURN
/*===================================================================*/
/* */
/* Build a list of CICS jobs executing on all systems. */
/* */
/*===================================================================*/
GET_CICSJOBS:
jobs_active.0 = 0
jobs_active_cnt = 0
execlist_called = 1
jobs_stack = SWAPSTAK('NEW')
Select_cmd = "SET SELECTNEXT 'ExecStage = EXECUTING'"
Command_cmd = "CICSLIST"
Command_parms = "XSYSTEM ALL"
Sort_subcmd = "SORT Name A"
Command_string = Select_cmd ';' Command_cmd Command_parms ,
';' Sort_subcmd
result = SYSVIEW_REQUEST(session Command_string)
DO i = 1 to queued()
PARSE PULL line
IF SUBSTR(line,1,1) = 'D' THEN DO
line = SUBSTR(line,2)
PARSE VALUE line WITH d +1 ,
l_cmd (d) ,
l_system (d) ,
l_jobname (d) ,
.
l_jobname = strip(l_jobname)
IF l_jobname <> "" THEN DO
jobs_active_cnt = jobs_active_cnt + 1
jobs_active.jobs_active_cnt = l_jobname
END
END
END
jobs_active.0 = jobs_active_cnt
jobs_stack = SWAPSTAK('DELETE')
RETURN
/*===================================================================*/
/* Function to return '1' (true) if the passed jobname is executing */
/* (active) anywhere in the CICSPLEX, otherwise return '0' (false). */
/*===================================================================*/
JOB_STATUS:
PARSE ARG jobn .
job_stat = 0
DO i = 1 TO jobs_active.0
IF jobs_active.i = jobn THEN DO
job_stat = 1
LEAVE
END
IF jobs_active.i > jobn THEN
LEAVE
END
/*
SAY 'Returning a status of' job_stat 'for job' jobn
*/
RETURN job_stat
/*===================================================================*/
/* Subroutine to set the XSGROUP for CICSLIST if a group was */
/* specified and it wasn't already done. */
/*===================================================================*/
SET_XSGROUP:
IF DATATYPE(&xsgroup) <> 'NUM' THEN
DO
&xsgroup = 1
set_xsgroup = SWAPSTAK('NEW')
Command_cmd = "SET XSGROUP," || input_xsgroup || ",CICSLIST"
result = SYSVIEW_REQUEST(session Command_cmd)
set_xsgroup = SWAPSTAK('DELETE')
END
RETURN