/*+------------------------------------------------------------------+*/ /*| EXEC: LABEL540 wrapper around CPFMTXA to LABEL and ALLOC DASD |*/ /*| retVal: 0 - success |*/ /*| 1 - help was asked for or given |*/ /*| 2 - user is not sure |*/ /*| 3 - DASD (minidisk) range is not valid |*/ /*| 4 - at least one DASD (minidisk) is reserved to MAINT |*/ /*+------------------------------------------------------------------+*/ /* For details on how this EXEC is used, see one of the two books: "z/VM and Linux on IBM System z: The Virtualization Cookbook for SLES 10 SP2" on the Web at: http://www.redbooks.ibm.com/abstracts/SG247493.html -or- "z/VM and Linux on IBM System z: The Virtualization Cookbook for RHEL 5.2" on the Web at: http://www.redbooks.ibm.com/abstracts/SG247492.html */ /*------------------------------------------------------------------ THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES -------------------------------------------------------------------*/ /* Construct the two character label prefix */ firstChar = 'M' /* change this for an LPAR ID other than 'M' */ labelPrefix = firstChar'V' /* Parse arguments */ parse upper arg res spl pag w01 w02 . if (w02 = '') then call help /* Construct the 5 labels */ resLabel = getLabel(labelPrefix res) splLabel = getLabel(labelPrefix spl) pagLabel = getLabel(labelPrefix pag) w01Label = getLabel(labelPrefix w01) w02Label = getLabel(labelPrefix w02) /* Ask "Are you sure?" */ say 'The volumes are:' 'CP Q' res spl pag w01 w02 say '' say 'The system volume labels will become:' say resLabel splLabel pagLabel w01Label w02Label say '' say 'ARE YOU SURE you want to relabel the DASD (y/n)?' parse upper pull answer ansFirstChar = substr(answer, 1, 1) if (ansFirstChar ^= 'Y') then exit 2 /* Label the 4 volumes: RES is 123, W01 is 124, W02 is 125, SPL is 122 */ 'CP TERM MORE 1 1' 'CPFMTXA 123' resLabel 'LABEL' 'CPFMTXA 124' w01Label 'LABEL' 'CPFMTXA 125' w02Label 'LABEL' 'CPFMTXA 122' splLabel 'LABEL' /* LINK the 540PAG volume which is $PAGE$ A03, label it, DETACH it */ 'CP LINK $PAGE$ A03 A03 MR' 'CPFMTXA A03' pagLabel 'LABEL' 'CP DET A03' 'CP TERM MORE 50 10' exit /*+------------------------------------------------------------------+*/ help: procedure expose firstChar /*+------------------------------------------------------------------+*/ parse source . . fn . say "" say "Synopsis:" say "" say "Relabel 5 system volumes (540RES, 540W01, ...) to" firstChar"V" say " where is the 4 digit address" say "" say "Syntax is:" say "" say " >>---LABEL540--res--spl--pag--w01--w02------------------------><" say "" say " where res, spl, pag, w01 and w02 are 4 digit virtual addresses" say " of the volumes that z/VM 5.2 is installed onto" say "" exit 1 /*+------------------------------------------------------------------+*/ getLabel: procedure /*| Compose the six character label of a minidisk |*/ /*| parm 1: labelPrefix - first two characters of label |*/ /*| parm 2: disk - vaddr of length 1, 2, 3 or 4 |*/ /*| return: the 6 character label |*/ /*+------------------------------------------------------------------+*/ arg labelPrefix disk if (DATATYPE(disk, 'X') = 0) then do say "Error:" disk "is not a hexadecimal number" call help end diskLen = length(disk) select when (diskLen = 1) then /* insert 3 zeros */ label = labelPrefix||'000'||disk when (diskLen = 2) then /* insert 2 zeros */ label = labelPrefix||'00'||disk when (diskLen = 3) then /* insert a zero */ label = labelPrefix||'0'||disk otherwise /* it must be length 4 or query would have failed */ label = labelPrefix||disk end /* select */ return label /* from getLabel */