I sent an offline reply to David with the following, but it seems the
needs may be wider. It has the pre-req of the CMS Pipelines Runtime
Library (Pipes RTL, available at: http://vm.marist.edu/~pipeline/
Mike Walter
Hewitt Associates
Any opinions expressed herein are mine alone and do not necessarily
represent the opinions or policies of Hewitt Associates.
/* Prolog; See Epilog for additional information ********************
* Exec Name - QDASD EXEC *
* Unit Support - Information Systems *
* Status - Version 2, Release 1.0 *
********************************************************************/
address 'COMMAND'
parse source xos xct xfn xft xfm xcmd xenvir .
parse upper arg parms 1 operands '(' options ')' parmrest
parse upper arg operands '(' options ')' .
If operands='?' then Signal Explain
parse var operands op1 .
If op1='' then operands='*' /* Default to 'all' volumes */
?file= wordpos('FILE',options)>0
?path= wordpos('PATH',options)>0 | ,
wordpos('PATHS',options)>0
?count= wordpos('COUNT',options)>0
?offline= wordpos('OFFLINE',options)>0
cmd='CP QUERY DASD ALL'
If length(op1)>1 & op1<>'*' then
'PIPE (END ? NAME QDASD1)' ,
'|' cmd ,
'| SPLIT AT /,/' ,
'| STRIP BOTH' ,
'| nm: WILDCARD ANYCASE 21.6 /'op1'/' , /*Volser pattern*/
'| fany: FANINANY' ,
'| STEM dasd.' ,
'? nm:' ,
'| NLOCATE 11.6 / /' , /* DASD 0Cuu CP SYSTEM */
'| WILDCARD ANYCASE 11.6 /'op1'/' , /* DASD ccuu volser */
'| fany:'
Else
'PIPE (NAME QDASD2)' ,
'|' cmd ,
'| SPLIT AT /,/' ,
'| STEM dasd.'
If rc<>0 then say xfn';' cmd', rc='rc
BuildALLstem: /* All DASD, one address per stem entry */
ax=0
?rtnoffline=0 /* Return to offline state? */
Do dx=1 to dasd.0
parse var dasd.dx begin ',' remains 0 dev rdev w3 .
If w3='OFFLINE' & ?offline & , /* Include offline DASD, too */
\?rtnoffline then /* Don't VARY ON or loop again */
Do /* Bring online long enough to report on it */
?rtnoffline=1
'PIPE CP VARY ON' rdev
Call WaitForOnline 10
'PIPE CP QUERY' rdev ,
'| VAR updt'
dasd.dx=updt
dx=dx-1 /* Back up to retry this rdev */
Iterate dx /* And do so... */
End
If wordpos(w3,'OFFLINE FREE CP')=0 then
begin = dev rdev '^ mounted' w3||' .'
'PIPE (NAME GetRdevCyls)' ,
'| CP QUERY DASD DETAILS' rdev ,
'| TAKE 1' ,
'| SPECS WORD -1;-1 1' , /* Cyls = last word */
'| VAR rdevcyls'
begin=left(strip(begin,'B'),35) right(strip(rdevcyls,'B'),6)
ax=ax+1
If ?path then
Do
'PIPE CP QUERY PATHS' rdev ,
'| DROP LAST 1' ,
'| TAKE LAST 1' ,
'| SPECS 30-* 1' , /* Keep online/offline */
'| VAR status'
begin = left(strip(begin),50) status
End
Else begin=strip(begin,l)
all.ax=begin
If remains='' then
Do
If ?rtnoffline then
Do
'PIPE CP VARY OFF' rdev
?rtnoffline=0
End
Iterate
End
Do until remains=''
parse var remains begin ',' remains 0 dev rdev w3 ',' .
If wordpos(w3,'OFFLINE FREE CP')=0 then
begin = dev rdev '^ mounted' w3
ax=ax+1
If ?path then
Do
'PIPE CP QUERY PATHS' rdev ,
'| DROP LAST 1' ,
'| TAKE LAST 1' ,
'| SPECS 30-* 1' , /* Keep online/offline */
'| VAR status'
begin = left(strip(begin),41) status
End
Else begin=strip(begin,l)
all.ax=begin
End
If ?rtnoffline then
Do
'PIPE CP VARY OFF' rdev
?rtnoffline=0
End
End dx
all.0=ax
PotentialSort:
If find(options,'SORT')>0 | find(options,'BYVOLSER')>0 then
'PIPE STEM all.' ,
'| SORT 21.6 A' ,
'| STEM all.'
Else
'PIPE STEM all.' ,
'| REXX HEXSORT W2' ,
'| STEM all.'
ProcessStem:
If ?file then
'PIPE STEM all.' ,
'| APPEND STRLITERAL /* /' ,
'| APPEND STRLITERAL /* Prepared' date('S') 'at' time() ,
'by command:' xfn parms'/' ,
'| > QDASD FILE A'
Else
Do
'PIPE STEM all. | CONSOLE'
If ?count then say 'Total matching volumes:' all.0
End
Call Exit 0
/* ******************************************************************* */
/* ******************* S U B R O U T I N E S ************************* */
/* ******************************************************************* */
Exit:
Parse arg exitrc .
If datatype(exitrc,'W') then Exit exitrc; Else exit 0
WaitForOnline:
parse arg waitsecs .
/* VARY ONLINE is an asynch command, we need to wait a little */
/* bit for it to come online. */
waittimes=waitsecs*4
Do wx=1 to waittimes until w3<>'OFFLINE'
'PIPE (NAME Enabled) CP QUERY' rdev ,
'| SPECS WORD 3 1' ,
'| VAR W3'
'PIPE LITERAL +0.25 | DELAY'
End
Return
Explain:
'PIPE (NAME Explain)' ,
'| <' xfn xft xfm ,
'| INSIDE /ExplainBegin:/ /ExplainEnd:/' ,
'| CONSOLE'
Call Exit 0
/*
ExplainBegin:
QDASD is used to display all DASD matching a given volser PATTERN.
Syntax:
>-QDASD-+-volser_pattern-+------------------| Options |-------------><
Where:
volser_pattern
Is specified using the same pattern matching wildcard characters as
LISTFILE ("*" for "any", and "%" for a single character).
Options:
FILE
Place the matching volsers in file "QDASD FILE".
PATHs
Display '+' or '-' for each online or offline path.
SORT
BYVOLSER
Sort results my volser instead of rdev.
COUNT
Display total number of matching volsers.
OFFLINE
Include OFFLINE volumes in the output display. This will
automatically vary them online and offline as each OFFLINE DASD
is processed... be patient.
ExplainEnd:
*/
Call Exit 4
/* Epilog ***********************************************************
* Function - Enhanced Q DASD command (allows wildcard '*' at *
* start, end or both of volser parms). Can put *
* output in disk file 'QDASD FILE'. *
* Component of - VM Systems Programmers ToolBox. *
* Command format- QDASD <*>volser<*> <( <FILE> <SORT> > *
* Called by - User from console *
* Dependencies - VM/SP 3 or higher. *
* - Privilege class 'B' *
* - CMS Pipelines Runtime Library with WILDCARD stage*
* Program Lang. - CMS REXX *
* Date Written - 05/20/85 *
* Author - Michael R. Walter *
* Chg Dte |By | Description of Change *
* --------+---+-----+--------------------------------------------- *
* 07/30/86 MRW -Add FILE option. *
* 10/15/86 MRW -Add SORT option to sort file on volser. *
* 12/19/89 MRW -Update to use RXSORT. *
* 01/02/90 MRW -Produce stem ALL. with one dev per entry. *
* -Add '^ mounted' status. *
* 01/06/92 MRW -Add BUFFER 25000 to EXECIO Q DASD ALL. *
* 09/12/94 MRW -Use PIPE in place of EXECIO. *
* 06/20/95 MRW -Add 'COUNT' option. *
* 20040308 MRW -Change pattern match to use WILDCARD stage *
* -Add Explain: *
* -Misc. cleanup. *
* 20080415 mrw -Default so sort by rdev. CP Q DASD ALL returns *
* ACTIVE, FREE, and OFFLINE in that order. *
* -Add '.' as "linked" placeholder when none. *
* -Add rdev cylinder count. *
* 20081210 mrw -Correct alignment problems for cyls of OFFLINE DASD*
* 20090407 mrw -Add code to bring OFFLINE 'online' for cyl counts *
* *
********************************************************************/
The information contained in this e-mail and any accompanying documents may
contain information that is confidential or otherwise protected from
disclosure. If you are not the intended recipient of this message, or if this
message has been addressed to you in error, please immediately alert the sender
by reply e-mail and then delete this message, including any attachments. Any
dissemination, distribution or other use of the contents of this message by
anyone other than the intended recipient is strictly prohibited. All messages
sent to and from this e-mail address may be monitored as permitted by
applicable law and regulations to ensure compliance with our internal policies
and to protect our business. E-mails are not secure and cannot be guaranteed to
be error free as they can be intercepted, amended, lost or destroyed, or
contain viruses. You are deemed to have accepted these risks if you communicate
with us by e-mail.