@@ -15,14 +15,18 @@ allOSA.0 = 0
1515call mergeOSA /* merge free & used OSA by rdev */
1616call prtOutput /* print results */
1717exit /* CALCOSA EXEC */
18-
18+
1919/*-------------------------------------------------------------------*/
2020parseArgs: procedure expose debug verbose
2121/* Parse arguments */
2222/*-------------------------------------------------------------------*/
23- parse arg arg1 '(' flags ')'
23+ parse upper arg arg1 '(' flags ')'
2424 if arg1 = "?" | arg1 = "-H" then
2525 call help
26+ if arg1 = "-V" then
27+ verbose = 2
28+ if arg1 = "-D" then
29+ debug = 1
2630 if flags = "" then
2731 return /* all done */
2832 do i = 1 to LENGTH(flags)
@@ -39,7 +43,7 @@ parseArgs: procedure expose debug verbose
3943 end
4044 end
4145return /* parseArgs() */
42-
46+
4347/*-------------------------------------------------------------------*/
4448getOSAs: procedure expose usedOSA. freeOSA. debug verbose
4549/* Get the used and free OSAs */
@@ -62,7 +66,7 @@ getOSAs: procedure expose usedOSA. freeOSA. debug verbose
6266 freeOSA.0 = freeIndex
6367 end
6468return /* getOSAs() */
65-
69+
6670/*-------------------------------------------------------------------*/
6771setColor:
6872/* Change color of next line */
@@ -73,7 +77,7 @@ setColor:
7377 'conwait' /* flush output stack */
7478 'pipe cp screen outarea' color '| hole' /* no COMMAND COMPLETE */
7579return /* setColor() */
76-
80+
7781/*-------------------------------------------------------------------*/
7882debugMsg: procedure expose verbose
7983/* issue message in debug mode */
@@ -85,7 +89,7 @@ debugMsg: procedure expose verbose
8589 call setColor "green"
8690 end
8791return /* debugMsg() */
88-
92+
8993/*-------------------------------------------------------------------*/
9094parseFreeLine: procedure expose freeOSA. freeIndex verbose
9195/* get a line of 1 - 4 free OSA and populate stem var freeOSA. */
@@ -119,7 +123,7 @@ parseFreeLine: procedure expose freeOSA. freeIndex verbose
119123 freeOSA.freeIndex = rdev4 "FREE"
120124 end
121125return /* parseFreeLine() */
122-
126+
123127/*-------------------------------------------------------------------*/
124128mergeOSA: procedure expose allOSA. freeOSA. numAllOSA usedOSA. verbose
125129/* merge used and free OSA lists */
@@ -170,7 +174,7 @@ mergeOSA: procedure expose allOSA. freeOSA. numAllOSA usedOSA. verbose
170174 end
171175 allOSA.0 = allIndex - 1
172176return /* mergeOSA() */
173-
177+
174178/*-------------------------------------------------------------------*/
175179getPchid: procedure expose verbose
176180/* Given a CHPID, return the PCHID or "NONE" */
@@ -181,7 +185,7 @@ getPchid: procedure expose verbose
181185 if pchid = "physical" then /* no PCHID found */
182186 pchid = "NONE"
183187return pchid /* getPchid() */
184-
188+
185189/*-------------------------------------------------------------------*/
186190prtLn: procedure expose verbose
187191/* print one line of output formatting the 7 fields */
@@ -197,7 +201,7 @@ prtLn: procedure expose verbose
197201 JUSTIFY(devType,8) JUSTIFY(OSAType, 8) JUSTIFY(chpid,6),
198202 JUSTIFY(pchid,6)
199203return /* prtLn() */
200-
204+
201205/*-------------------------------------------------------------------*/
202206prtFree: procedure expose verbose
203207/* print one line of a free OSA - need to get CHPID and PCHID */
@@ -217,7 +221,7 @@ Device 2340, Status ONLINE
217221 dash = "-"
218222 call prtLn rdev "FREE" dash dash dash chpid pchid
219223return /* prtFree() */
220-
224+
221225/*-------------------------------------------------------------------*/
222226prtUsed: procedure expose verbose
223227/* print one line of a used OSA - need to get PCHID from CHPID */
@@ -228,7 +232,7 @@ OSA 0340 ATTACHED TO DTCVSW1 0600 DEVTYPE OSA CHPID F0 OSD */
228232 pchid = getPchid(chpid)
229233 call prtLn rdev userID vdev devType OSAType chpid pchid
230234return /* prtUsed() */
231-
235+
232236/*-------------------------------------------------------------------*/
233237prtOutput: procedure expose allOSA. freeOSA. usedOSA. verbose
234238/* print merged free and used OSAs */
@@ -248,15 +252,15 @@ prtOutput: procedure expose allOSA. freeOSA. usedOSA. verbose
248252 say " ----"
249253 say " Total:" FORMAT(allOSA.0, 4)
250254return /* prtOutput() */
251-
255+
252256/*-------------------------------------------------------------------*/
253257help:
254258/* give help */
255259/*-------------------------------------------------------------------*/
256260 say "Name: CALCOSA EXEC - compute OSA statistics"
257261 say "Usage: CALCOSA {-h|?} {(vd)}"
258- say "Where: -h or '| ' = give help"
262+ say "Where: -h or '? ' = give help"
259263 say " v = verbose"
260264 say " d = debug"
261265exit 2 /* help() */
262-
266+
0 commit comments