27.12.2012 Views

The Virtualization Cookbook for SLES 10 SP2 - z/VM - IBM

The Virtualization Cookbook for SLES 10 SP2 - z/VM - IBM

The Virtualization Cookbook for SLES 10 SP2 - z/VM - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

parse upper var dasds dasd dasds<br />

dashPos = pos('-', dasd)<br />

if (dashPos = 0) then /* there is just one DASD */<br />

do<br />

numDasd = numDasd + 1<br />

dasdList.numDasd = dasd<br />

'CP Q MDISK' dasdList.numDasd 'LOCATION'<br />

if (rc 0) then<br />

do<br />

say 'Return code from Q MDISK =' rc<br />

say 'Are all DASD ATTached?'<br />

exit 3<br />

end<br />

call checkReserved(dasdList.numDasd)<br />

end /* do */<br />

else /* process the range of DASD */<br />

do<br />

startRange = substr(dasd, 1, dashPos - 1)<br />

endRange = substr(dasd, dashPos + 1, length(dasd) - dashPos)<br />

do i = x2d(startRange) to x2d(endRange)<br />

numDasd = numDasd + 1<br />

dasdList.numDasd = d2x(i)<br />

'CP Q MDISK' dasdList.numDasd 'LOCATION'<br />

if (rc 0) then<br />

do<br />

say 'Return code from Q MDISK =' rc<br />

exit 3<br />

end<br />

call checkReserved(dasdList.numDasd)<br />

end /* do i */<br />

end /* else */<br />

end /* do while */<br />

return numDasd /* from parseDasd */<br />

/*+------------------------------------------------------------------+*/<br />

doFormat: procedure expose dasdList. <strong>for</strong>matted<br />

/*| Format all DASD specified using CPFMTXA |*/<br />

/*| parm 1: labelPrefix - the two character label prefix |*/<br />

/*| parm 2: numDasd - number of DASD in the array dasdList |*/<br />

/*| parm 3: type - the type of DASD <strong>for</strong>mat |*/<br />

/*| retVal: 0 = success |*/<br />

/*+------------------------------------------------------------------+*/<br />

arg labelPrefix numDasd type<br />

'CP TERM MORE 1 1'<br />

do i = 1 to numDasd<br />

label = getLabel(labelPrefix dasdList.i)<br />

retVal = <strong>for</strong>matOne(dasdList.i type label)<br />

if (retVal ^= 0) then<br />

do<br />

say "Error from CPFMTXA on DASD" label "rc =" retVal<br />

leave /* error - abort! */<br />

end<br />

<strong>for</strong>matted = <strong>for</strong>matted label<br />

end /* do i = */<br />

'CP TERM MORE 50 <strong>10</strong>'<br />

return retVal /* from doFormat */<br />

/*+------------------------------------------------------------------+*/<br />

checkReserved: procedure<br />

/*| Try copying an already <strong>for</strong>matted DASD then relabelling it |*/<br />

246 <strong>The</strong> <strong>Virtualization</strong> <strong>Cookbook</strong> <strong>for</strong> RHEL 6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!