220 The Virtualization Cookbook for Red Hat Enterprise Linux 5.2
return retVal /* from formatOne */
/*+------------------------------------------------------------------+*/
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
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 */
The CHPW540 XEDIT macro
Following is the code for the XEDIT macro that changes all passwords in the z/VM 5.4 USER
DIRECT file:
/*+------------------------------------------------------------------+*/
/* CHPW540 XEDIT - change all passwords in z/VM 5.2 USER DIRECT file */
/*+------------------------------------------------------------------+*/
/* For details on how this macro is used, see the book:
"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 */
/*------------------------------------------------------------------
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
-------------------------------------------------------------------*/
parse arg fn ft fm '(' options ')' newPass .
if (length(newPass) > 8) then
do
say "Error: new password must be 8 characters or fewer"
exit
end
say ''
say 'Changing all passwords to:' newPass
say ''
/* set some values */
'command set stay on'
Komentarze do niniejszej Instrukcji