-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathdomchk.rexx
339 lines (330 loc) · 14.7 KB
/
domchk.rexx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
/* REXX **************************************************************/
/* DOMCHK ZZ026184 */
/*-------------------------------------------------------------------*/
/* Copyright 2017 IBM Corp. */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software*/
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/*-------------------------------------------------------------------*/
/*01* CHANGE-ACTIVITY: */
/*-------------------------------------------------------------------*/
/* 1509 Change verrel to contain period to compare to 2.1 */
/* 1604 Add check for /usr/lpp/internet/sbin/httpd */
/*********************************************************************/
rc = Process_DOM_Check_Start()
if rc = 0 then do
rc = Process_DOM_Check_Parms()
if rc = 0 then do
rc = Process_DOM_Main()
if rc = 0 then do
call Process_DOM_Check_Report
end
end
call Process_DOM_Check_End
end
exit
/*-------------------------------------------------------------------*/
/* For debug purpose. Only run in SYSREXX environment */
/*-------------------------------------------------------------------*/
/*
HZSLSTRT:
HZS_PQE_DEBUG = 1
HZS_PQE_FUNCTION_CODE = 'RUN'
HZS_PQE_LOOKATPARMS = 1
HZSLSTRT_RC = 0
HZSLSTRT_RSN = 'NONE'
HZSLSTRT_SYSTEMDIAG = 'NONE'
return HZSLSTRT_RC
HZSLSTOP:
HZSLSTOP_RC = 0
HZSLSTOP_RSN = 'NONE'
HZSLSTOP_SYSTEMDIAG = 'NONE'
return HZSLSTOP_RC
HZSLFMSG:
HZSLFMSG_RC = 0
HZSLFMSG_RSN = 'NONE'
HZSLFMSG_SYSTEMDIAG = 'NONE'
return HZSLFMSG_RC
*/
/*********************************************************************/
/* Function: Process_DOM_Check_Start */
/*********************************************************************/
/* If HZSLSTRT is not successful all IBM Health Checker for z/OS */
/* function calls will fail. */
/*********************************************************************/
Process_DOM_Check_Start:
rc = 0
check_name = 'ZOSMIG_HTTP_SERVER_DOMINO_CHECK'
check_name = 'The Domino HTTP server check'
text = 'TEXT'
sysname = mvsvar(sysname)
date = DATE() /*Get Run Date*/
timeStarted = word(date,1) DATE('M') word(date,3)"," TIME()
HZSLSTRT_RC = HZSLSTRT()
if HZSLSTRT_RC <> 0 then do /* HZSLSTRT error @01C*/
if HZS_PQE_DEBUG = 1 then do /* Report debug detail in REXXOUT */
call LOGMSGS text," HZSLSTRT ACTIVATE PROCESSING HAS FAILED. RC="HZSLSTRT_RC /*1408*/
call LOGMSGS text," HZSLSTRT RC" HZSLSTRT_RC
call LOGMSGS text," HZSLSTRT RSN" HZSLSTRT_RSN
call LOGMSGS text," HZSLSTRT SYSTEMDIAG" HZSLSTRT_SYSTEMDIAG
end
rc = 8 /* Exit, check cannot be performed */
end
else do
if HZS_PQE_DEBUG = 1 then do
call LOGMSGS text,' 'check_name' started at 'timeStarted' on 'sysname
call LOGMSGS text,' Entering PROCESS_DOM_CHECK_START'
end
/*-----------------------------------------------------------------*/
/* Check the function code to determine what to do */
/*-----------------------------------------------------------------*/
/* look for Init function */
/*-----------------------------------------------------------------*/
if HZS_PQE_FUNCTION_CODE = "INITRUN" then do
if HZS_PQE_DEBUG = 1 then /* 0912 */
call LOGMSGS text," HZS_PQE_CHKWORK is null with function code 'INITRUN'"
end
/*-----------------------------------------------------------------*/
/* look for Run function */
/*-----------------------------------------------------------------*/
else if HZS_PQE_FUNCTION_CODE = "RUN" then do
if HZS_PQE_DEBUG = 1 then /* 0912 */
call LOGMSGS text," HZS_PQE_CHKWORK is "HZS_PQE_CHKWORK" with function code 'RUN'"
end
end
return rc
/*********************************************************************/
/* Function: Process_DOM_Check_End */
/*********************************************************************/
Process_DOM_Check_End:
HZSLSTOP_RC = HZSLSTOP() /* report check completion */
if HZS_PQE_DEBUG = 1 then do /* Report debug detail in REXXOUT */
call LOGMSGS text,' Entering Process_DOM_CHECK_END'
call LOGMSGS text," HZSLSTOP RC" HZSLSTOP_RC
call LOGMSGS text," HZSLSTOP RSN" HZSLSTOP_RSN
call LOGMSGS text," HZSLSTOP SYSTEMDIAG" HZSLSTOP_SYSTEMDIAG
end
return
/*********************************************************************/
/* Function: Process_DOM_Check_Parms */
/*********************************************************************/
Process_DOM_Check_Parms:
rc = 0
if HZS_PQE_DEBUG = 1 then
call LOGMSGS text,' Entering Process_DOM_CHECK_PARMS'
if HZS_PQE_LOOKATPARMS = 1 then do /* HCHECK var that identifies parm attribute in parmlib */
/*-----------------------------------------------------------------*/
/* User has specified overriding default parameter */
/*-----------------------------------------------------------------*/
if HZS_PQE_DEBUG = 1 then do
if HZS_PQE_PARMAREA = '' then
call LOGMSGS text,' There are no parms for this Check.'
else
call LOGMSGS text,' Found HZS Parms: 'HZS_PQE_PARMAREA
end
end
return rc
/*********************************************************************/
/* Function: Process_DOM_Main */
/*********************************************************************/
/* - Checks System for Domino HTTP webserver */
/*********************************************************************/
PROCESS_DOM_MAIN:
xrc = 0
if HZS_PQE_DEBUG = 1 then
call LOGMSGS text,' Entering Process_DOM_MAIN'
dom_server_found = 0
na_env = 0
sysLvl = mvsvar(sysopsys)
parse var syslvl os ver'.'rel'.' .
ver = format(ver)
rel = format(rel)
verrel = ver'.'rel /* add period between for compare to 2.1 1509 */
if verrel <= 2.1 then do /* change 21 to 2.1 for compare 1509 */
say;say ' This system is at level 'os' Rel 'ver'.'rel'. Processing continues.';say
dom_server. = ''
dom_server.0 = 0
say;say ' Display all z/OS UNIX System Services address spaces.';say
asid_Cmd = 'D OMVS,ASID=ALL'
say ' Issuing command 'asid_cmd;say
AxrCmdRc = AXRCMD(asid_Cmd,OMsg.,4)
if AxrCmdRc = 0 then do
say ' Searching for IMWHTTPD in command results.';say
do i = 1 to OMsg.0
say ' 'Omsg.i
if pos('CMD=IMWHTTPD',Omsg.i) > 0 | , /* 1604 */
pos('/usr/lpp/internet/sbin/httpd',Omsg.i) > 0 then do
j = i - 1 /* back up so we can get the jobname */
jobname = space(substr(Omsg.j,10,9))
say;say " A Domino HTTP WebServer named "jobname" was found."
dom_server_found = 1
ds = dom_server.0 + 1
dom_server.ds = left(jobname,79)
dom_server.0 = ds
end
end
if dom_server_found = 0 then do
say;say " A Domino HTTP WebServer was not found."
end
else do
serverlist = dom_server.1
do i = 2 to dom_server.0
serverlist = serverlist' 'dom_server.i
end
end
say
end
else do
if HZS_PQE_DEBUG = 1 then do
if AxrCmdRc = 4 then do
call LOGMSGS text,' No response received. Message might be suppressed by a Subsystem.'
call LOGMSGS text,' Verify the automation on this system.'
end
end
xrc = AxrCmdRc
say ' Failed to obtain results of command 'asid_cmd'.'
end
end
else do
na_env = 1
say;say ' This exec will only run on a z/OS Rel 2.1 or earlier system.'
say ' This system is at level 'os' Rel 'ver'.'rel'.';say
end
return xrc
/*********************************************************************/
/* Function: Process_DOM_Check_Report */
/*********************************************************************/
/* Purpose : Set message variables and generate check report. */
/* Assuming the code above did not detect an exception situation, */
/* Write "all is OK" message */
/*********************************************************************/
Process_DOM_Check_Report:
if HZS_PQE_DEBUG = 1 then
call LOGMSGS text,' Entering Process_DOM_CHECK_REPORT'
HZSLFMSG_REQUEST='DIRECTMSG'
/*-------------------------------------------------------------------*/
/* Directmsg options are CHECKEXCEPTION, CHECKINFO and CHECKREPORT */
/* The _TEXT option is required on all. The _ID option is NOT */
/* required for CHECKREPORT, it is for the other two. */
/* The other vars are optional for CHECKEXECPTION */
/*-------------------------------------------------------------------*/
/*
HZSLFMSG_REASON = "CHECKEXCEPTION"
HZSLFMSG_DIRECTMSG_ID = ''
HZSLFMSG_DIRECTMSG_TEXT = ''
HZSLFMSG_DIRECTMSG.EXPL = ''
HZSLFMSG_DIRECTMSG.SYSACT = ''
HZSLFMSG_DIRECTMSG.ORESP = ''
HZSLFMSG_DIRECTMSG.SPRESP = ''
HZSLFMSG_DIRECTMSG.PROBD = ''
HZSLFMSG_DIRECTMSG.SOURCE = ''
HZSLFMSG_DIRECTMSG.REFDOC = ''
HZSLFMSG_DIRECTMSG.AUTOMATION = ''
HZSLFMSG_SEVERITY = '' /* SYSTEM, LOW, MED, HI, NONE*/
HZSLFMSG_REASON = "CHECKINFO"
HZSLFMSG_DIRECTMSG_ID = ''
HZSLFMSG_DIRECTMSG_TEXT = ''
*/
if dom_server_found = 1 then do
/*-----------------------------------------------------------------*/
/* One or more Domino Webservers were found on this system. */
/* This is not what we want, so flag an exception. */
/*-----------------------------------------------------------------*/
HZSLFMSG_REASON = "CHECKEXCEPTION"
HZSLFMSG_DIRECTMSG_ID = 'DOMCHK8'
HZSLFMSG_DIRECTMSG_TEXT = ,
left('One or more IBM HTTP Server(s) Powered by Domino were found.',80),
serverlist
HZSLFMSG_DIRECTMSG.EXPL = 'z/OS V2R1 is planned to be the last release to include',
'the IBM HTTP Server Powered by Domino. IBM recommends that you',
'use the IBM HTTP Server Powered by Apache, which is available in',
'z/OS Ported Tools as a replacement. Refer to the IBM Redbook',
'called IBM HTTP Server on z/OS: Migrating from Domino-powered',
'to Apache-powered.',
copies(' ',80),
'For any comments or questions on this IBM Health Checker for z/OS',
'migration health check, send an email to [email protected].'
end
else do
if env_na = 1 then do
/*---------------------------------------------------------------*/
/* The level of the system was not applicable. It was > 2.1 */
/*---------------------------------------------------------------*/
HZSLFMSG_REASON = 'CHECKREPORT'
HZSLFMSG_DIRECTMSG_TEXT = ,
copies(' ',80),
'This IBM Health Checker for z/OS migration check is running on a system',
'that is later than z/OS V2.1. This check is not appropriate for this',
'system, as it verifies applicability of a migration action that',
'occurred in z/OS V2.1.'
HZSLFMSG_RC = HZSLFMSG()
HZSLFMSG_REQUEST = 'STOP'
HZSLFMSG_REASON = 'ENVNA'
end
else do
/*---------------------------------------------------------------*/
/* A Domino Webserver was NOT found on this system. That's good. */
/*---------------------------------------------------------------*/
HZSLFMSG_REASON = "CHECKREPORT"
HZSLFMSG_DIRECTMSG_TEXT = ,
copies(' ',80),
'No IBM HTTP Servers Powered by Domino were found.',
'The migration action to move from the IBM HTTP Server Powered by',
'Domino to IBM HTTP Server Powered by Apache was not applicable',
'to this system.',
copies(' ',80),
copies(' ',80),
'For any comments or questions on this IBM Health Checker for z/OS',
'migration health check, send an email to [email protected].'
end
end
if HZS_PQE_DEBUG = 1 then do
call LOGMSGS text," "HZSLFMSG_DIRECTMSG_TEXT
end
/* Flush the checker report */
HZSLFMSG_RC = HZSLFMSG()
if HZS_PQE_DEBUG = 1 then do
call LOGMSGS text," HZSLFMSG RC" HZSLFMSG_RC
call LOGMSGS text," HZSLFMSG RSN" HZSLFMSG_RSN
call LOGMSGS text," SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG
if HZSLFMSG_RC = 8 then do /* A user error occurred */
call LOGMSGS text," USER RSN" HZSLFMSG_UserRsn
call LOGMSGS text," USER RESULT" HZSLFMSG_AbendResult
end
end
return
/*********************************************************************/
/* LOGMSGS */
/*********************************************************************/
LOGMSGS:
parse arg output,msg
/*-------------------------------------------------------------------*/
/* Load the contents of the message to outputlog stem. We will */
/* then write the outputlog stem back to the output file. */
/*-------------------------------------------------------------------*/
if output <> 'TEXT' then do
/*-----------------------------------------------------------------*/
/* Log a pre-defined array */
/*-----------------------------------------------------------------*/
do k = 1 to WTO.output.0
say WTO.Output.k /* 0912 */
/*AxrWtoRc = AXRWTO(WTO.Output.k) 0912 */
end
end
else do
/*-----------------------------------------------------------------*/
/* Log a single message */
/*-----------------------------------------------------------------*/
say msg /* 0912 */
/* AxrWtoRc = AXRWTO(msg) 0912 */
end
return