Redp 4769
Redp 4769
Paul Rogers
Robert Hering
ibm.com/redbooks Redpaper
International Technical Support Organization
January 2012
REDP-4769-00
Note: Before using this information and the product it supports, read the information in “Notices” on page v.
This edition applies to Distributed File Service (DFS/SMB/zFS) of z/OS (5694-A01) and to all subsequent
releases and modifications until otherwise indicated in new editions.
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .v
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
The team who wrote this paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Now you can become a published author, too! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Stay connected to IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
IBM Redbooks publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Other publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult
your local IBM representative for information on the products and services currently available in your area.
Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM
product, program, or service may be used. Any functionally equivalent product, program, or service that does
not infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility to
evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this document. The
furnishing of this document does not give you any license to these patents. You can send license inquiries, in
writing, to:
IBM Director of Licensing, IBM Corporation, North Castle Drive, Armonk, NY 10504-1785 U.S.A.
The following paragraph does not apply to the United Kingdom or any other country where such
provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION
PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of
express or implied warranties in certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically made
to the information herein; these changes will be incorporated in new editions of the publication. IBM may make
improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time
without notice.
Any references in this information to non-IBM websites are provided for convenience only and do not in any
manner serve as an endorsement of those websites. The materials at those websites are not part of the
materials for this IBM product and use of those websites is at your own risk.
IBM may use or distribute any of the information you supply in any way it believes appropriate without
incurring any obligation to you.
Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products and cannot confirm the
accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the
capabilities of non-IBM products should be addressed to the suppliers of those products.
This information contains examples of data and reports used in daily business operations. To illustrate them
as completely as possible, the examples include the names of individuals, companies, brands, and products.
All of these names are fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs in
any form without payment to IBM, for the purposes of developing, using, marketing or distributing application
programs conforming to the application programming interface for the operating platform for which the sample
programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore,
cannot guarantee or imply reliability, serviceability, or function of these programs.
The following terms are trademarks of the International Business Machines Corporation in the United States,
other countries, or both:
IBM® RACF® Redbooks (logo) ®
MVS™ Redbooks® VM/ESA®
OS/390® Redpaper™ z/OS®
UNIX is a registered trademark of The Open Group in the United States and other countries.
Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo, Celeron, Intel Xeon, Intel
SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
Other company, product, or service names may be trademarks or service marks of others.
ZFSREORG is a tool for reorganizing and restructuring zFS compatibility mode aggregates. It
is an alternative to directly using commands like pax and copytree. It provides more flexibility
in many situations and offers options for how the reorganization or copy processing should be
done.
This IBM® Redpaper™ document describes the tool, explains how to install and use it, and
provides the complete code for the tool.
Robert Hering is an IT Specialist at the ITS Technical Support Center, Mainz, Germany. He
advises customers on z/OS and UNIX System Services-related questions and problems. He
has participated in several ITSO residencies since 1988, writing about UNIX-related topics.
Before providing support on OS/390 and z/OS, Robert worked with VM and all its various
flavors (VM/370, VM/HPO, VM/XA, and VM/ESA®) for many years.
Find out more about the residency program, browse the residency index, and apply online at:
ibm.com/redbooks/residencies.html
Comments welcome
Your comments are important to us!
We want our papers to be as helpful as possible. Send us your comments about this paper or
other IBM Redbooks® publications in one of the following ways:
Among the reasons you might want to do this are as the following situations:
To reduce the number of extents used for a zFS aggregate.
To internally restructure a zFS aggregate to allow growth above 4 GB because this was
not initially taken into account.
Note: You need to assign an SMS data class with Data Set Name Type EXTENDED and
Extended Addressability YES for the new zFS aggregate.
Important: You must have one of the following authorizations to perform the definition
part in TSO/ISPF foreground:
A permanent z/OS UNIX superuser ID (UID=0)
Read access to profile BPX.SUPERUSER in the FACILITY class of RACF®
Read access to profile SUPERUSER.FILESYS.PFSCTL in class UNIXPRIV
Several test or step options for running the job to see whether the reorganization can run
okay later or to stop after doing some initial work. You can restart the job later after
changing the options, as follows:
– You can stop after doing a short syntax check.
– You can stop after mounting the old zFS (if not already done) and the new zFS (if it
exists already; the new zFS gets unmounted again automatically).
– You can stop after defining and formatting the new zFS aggregate (if formatting is
needed).
If the new zFS aggregate exists already, the ability to specify to run the copy processing
only if the target zFS structure is empty.
Automatic replacement (after successful copy processing) of the old zFS file system by
the new zFS file system and remounting of the file systems down the structure again
without any manual interaction.
Naming specific PFS types that block automatic replacement of the old zFS by the new
zFS even if you specified to replace the old zFS.
Installation Instructions
Note: myuser in these instructions is your User ID. So replace your User ID where you
see myuser and [email protected] is your email address.
ftp www.redbooks.ibm.com
User: anonymous
Password: [email protected]
cd redbooks/REDP4769/
lcd 'myuser'
locsite blk=3120 lrecl=80 recfm=fb
binary
get zfs.zfsreorg.unload.bin zfs.zfsreorg.unload
quit
Note: You may also decide to pre-allocate the unloaded files as XMIT-ed sequential files
instead of using the LOCSITE setting.
ftp www.redbooks.ibm.com
User: anonymous
Password: [email protected]
cd redbooks/REDP4769/
binary
get zfs.zfsreorg.unload.bin
quit
The following example shows how to transfer the files to z/OS from your workstation
afterwards.
ftp my.zos.system
User: myuser
Password: mypasswd
cd 'myuser'
binary
quote site blk=3120 lrecl=80 recfm=fb
put zfs.zfsreorg.unload.bin zfs.zfsreorg.unload
quit
Figure 1-1 Sample FTP commands to transfer the unloaded ZFSREORG PDS to your system
On display of the following messages you may request to restore the original
PDS data set with a desired new data set name (You may also decide to rename
the data set after completion of the receive command.):
dsn('myuser.zfs.zfsreorg')
Figure 1-2 Final instructions to move files to the z/OS system
Figure 1-3 on page 5 shows the results of executing the first TSO RECEIVE command.
As shown in Figure 1-4 on page 6, you can view and edit the PDS data set ZFS.ZFSREORG. The
first member is named $INSTALL. Near the top is a sequence of job variables that can be
customized according to your installation’s naming conventions and file structures.
You need two partitioned libraries with record format FB80, a REXX library such as
myuserid.ZFS.REXX.EXEC (which should be located in the SYSPROC or SYSEXEC library
chain), and a job control library such as myuserid.ZFS.JOB.CNTL, as shown in Figure 1-4.
Another option is to use your own REXX and JCL libraries and then change them with the
JCL, as is also shown in the figure.
Submit the $INSTALL job after these requirements are met. Figure 1-4 on page 6 lists excerpts
of the sample job provided.
Examine the step return codes and messages to be sure the job ran successfully.
Notes:
These statements are automatically generated using DEFREORG, displayed for
review, saved in the data set containing the REORG definition statements, and
referenced in the JCL using DD name STDIN.
The abbreviation “FYR” as used here means a value that is provided just “For Your
Reference.”
Important: If you specify to not replace the old zFS file system by the new zFS file system,
or this cannot be done for other reasons, the old zFS file system is kept mounted read-only
to assure that the contents will not differ from the new zFS file system.
$> pwd
/u/hering
$> sudo /usr/sbin/mount -qv test.reorg
----A- HERING.TEST.BIG.ZFS /u/hering/test.reorg/test.sub/subdir
R---A- HERING.TEST.ZFS /u/hering/test.reorg/test.sub
----A- HERING.TEST.REORG.ZFS /u/hering/test.reorg
$> rxzfsmon | grep HERING.TEST | grep ZFS
HERING.TEST.ZFS 360 309 = 85.8% X-R-
HERING.TEST.REORG.ZFS 360 22 = 6.1% X--S
HERING.TEST.BIG.ZFS 180000 67769 = 37.6% X--S
$>
Figure 1-5 Initial situation with all the file systems involved
Note: As suggested previously, the migration definition data has been allocated as a PDS
with record type FB 80.
First, from ISPF Option 6, enter the DEFREORG command, which brings up an EDIT session as
shown in Figure 1-6. This command can be issued from any ISPF command line, using the
command TSO DEFREORG.
______________________________________________________________________________
| Enter DH to show REORG definition information. Change the data as needed. To |
| continue SAVE the changes,to stop processing use CANCEL. |
|______________________________________________________________________________|
Command ===> Scroll ===> CSR
F3=Exit F4=Save F5=Rfind F6=Rchange F10=Retrieve F12=Cancel
Figure 1-6 EDIT session display after starting the DEFREORG utility
In this file, we changed the settings as needed. Figure 1-7 on page 12 shows the display after
we made the changes.
Note: If you do not specify a member name, the tool will select a non-existent name such
as WORKxx.
______________________________________________________________________________
| Enter DH to show REORG definition information. Change the data as needed. To |
| continue SAVE the changes,to stop processing use CANCEL. |
|______________________________________________________________________________|
Command ===> Scroll ===> CSR
F3=Exit F4=Save F5=Rfind F6=Rchange F10=Retrieve F12=Cancel
We set the member name to REORG01, requested to replace the member if available, and
finally entered the zFS aggregates to look for. Pressing PF03 ended the EDIT session. The
DEFREORG command then calculated the settings, displayed messages as shown in Figure 1-8,
and then displayed the member for reviewing and modifying the data. This is shown in
Figure 1-9 on page 13, after going forward to line 5.
Note that you can redisplay the messages from the new EDIT session shown in Figure 1-9 on
page 13 using the command DM.
Figure 1-9 EDIT session displaying the reorganization statements just created
Because HERING.TEST.REORG.ZFS was the only data set that met the search criteria, we simply
accepted the values suggested, saved the data, and ended the EDIT session.
Then we edited the JCL member ZFSREORG and modified the data as shown in Figure 1-10 on
page 14 and Figure 1-11 on page 15.
Figure 1-10 JCL ZFSREORG with the modified reorganization definition member name
No further changes were made in the remaining part of the JCL, shown in Figure 1-11.
Finally, we submitted the job. Figure 1-12 on page 16 shows the messages we got after the
job successfully ended with RC=0.
----------------------------------------------------------------------------
The main process ID for this job is 33751184. If you should need to stop
processing use the following UNIX command to do this smoothly.
Either: kill 33751184
Or : kill -s SIGTERM 33751184
----------------------------------------------------------------------------
----------------------------------------------------------------------------
ZFSRO004I Processing zFS old data set name HERING.TEST.REORG.ZFS...
----------------------------------------------------------------------------
ZFSRO075I As the new zFS aggregate name is the same as of the old zFS data set a
temporary name is used for the new zFS.
ZFSRO076I zFS temporary name: HERING.TEST.REORG.ZFS.TMP
ZFSRO086I Defining zFS aggregate HERING.TEST.REORG.ZFS.TMP ...
IOEZ00248I VSAM linear dataset HERING.TEST.REORG.ZFS.TMP successfully created.
ZFSRO087I 09:46:41 Formatting zFS aggregate HERING.TEST.REORG.ZFS.TMP ...
IOEZ00077I HFS-compatibility aggregate HERING.TEST.REORG.ZFS.TMP has been successfully
created
ZFSRO054I 09:46:42 Now starting copy processing...
ZFSRO070I 09:46:43 Copy processing has been ended...
ZFSRO105I Temporary unmounting HERING.TEST.BIG.ZFS mounted at
/u/hering/test.reorg/test.sub/subdir
ZFSRO105I Temporary unmounting HERING.TEST.ZFS mounted at /u/hering/test.reorg/test.sub
ZFSRO106I Unmounting HERING.TEST.REORG.ZFS ...
IDC0531I ENTRY HERING.TEST.REORG.ZFS ALTERED
ZFSRO103I The old zFS aggregate has been renamed to HERING.TEST.REORG.ZFS.SAV.
IDC0531I ENTRY HERING.TEST.REORG.ZFS.DATA ALTERED
ZFSRO131I The old zFS DATA part has been renamed to or is named
HERING.TEST.REORG.ZFS.SAV.DATA.
IDC0531I ENTRY HERING.TEST.REORG.ZFS.TMP ALTERED
ZFSRO104I The zFS aggregate has been renamed to HERING.TEST.REORG.ZFS.
IDC0531I ENTRY HERING.TEST.REORG.ZFS.TMP.DATA ALTERED
ZFSRO119I The zFS DATA part has been renamed to or is named HERING.TEST.REORG.ZFS.DATA.
ZFSRO107I Mounting zFS HERING.TEST.REORG.ZFS at /u/hering/test.reorg now...
ZFSRO109I Mounting file system HERING.TEST.ZFS at /u/hering/test.reorg/test.sub again
ZFSRO109I Mounting file system HERING.TEST.BIG.ZFS at
/u/hering/test.reorg/test.sub/subdir again
ZFSRO111I No errors have been recognized for the actual REORG process.
READY
END
Reorganization results
The results of the reorganization process are shown in Figure 1-13 on page 17.
This verifies that the reorganization processing was done successfully and all file systems
were mounted in the same way as before.
Figure 1-14 shows a situation where 37 cylinders are formatted and available but not much
space is used. Furthermore, as Figure 1-17 on page 19 shows, even more space is allocated
but not yet completely formatted.
______________________________________________________________________________
| Enter DH to show REORG definition information. Change the data as needed. To |
| continue SAVE the changes,to stop processing use CANCEL. |
|______________________________________________________________________________|
Command ===> Scroll ===> CSR
F3=Exit F4=Save F5=Rfind F6=Rchange F10=Retrieve F12=Cancel
Figure 1-15 EDIT session display after starting DEFREORG and modifying some values
Figure 1-17 EDIT session showing the reorganization statements created for this run
Figure 1-18 JCL ZFSREORG with the modified reorganization member REORG02
----------------------------------------------------------------------------
The main process ID for this job is 67305587. If you should need to stop
processing use the following UNIX command to do this smoothly.
Either: kill 67305587
Or : kill -s SIGTERM 67305587
----------------------------------------------------------------------------
----------------------------------------------------------------------------
ZFSRO004I Processing zFS old data set name HERING.TEST.AUTOGROW...
----------------------------------------------------------------------------
ZFSRO075I As the new zFS aggregate name is the same as of the old zFS data set a
temporary name is used for the new zFS.
ZFSRO076I zFS temporary name: HERING.TEST.AUTOGROW.TMP
ZFSRO086I Defining zFS aggregate HERING.TEST.AUTOGROW.TMP ...
IOEZ00248I VSAM linear dataset HERING.TEST.AUTOGROW.TMP successfully created.
ZFSRO087I 09:10:31 Formatting zFS aggregate HERING.TEST.AUTOGROW.TMP ...
IOEZ00077I HFS-compatibility aggregate HERING.TEST.AUTOGROW.TMP has been successfully
created
ZFSRO054I 09:10:32 Now starting copy processing...
ZFSRO070I 09:10:33 Copy processing has been ended...
IDC0531I ENTRY HERING.TEST.AUTOGROW ALTERED
ZFSRO103I The old zFS aggregate has been renamed to HERING.TEST.AUTOGROW.SAV.
IDC0531I ENTRY HERING.TEST.AUTOGROW.DATA ALTERED
ZFSRO131I The old zFS DATA part has been renamed to or is named
HERING.TEST.AUTOGROW.SAV.DATA.
IDC0531I ENTRY HERING.TEST.AUTOGROW.TMP ALTERED
ZFSRO104I The zFS aggregate has been renamed to HERING.TEST.AUTOGROW.
IDC0531I ENTRY HERING.TEST.AUTOGROW.TMP.DATA ALTERED
ZFSRO119I The zFS DATA part has been renamed to or is named HERING.TEST.AUTOGROW.DATA.
ZFSRO111I No errors have been recognized for the actual REORG process.
READY
END
The results of this reorganization processing are shown in Figure 1-20 and indicate that the
desired results were achieved.
Figure 1-21 Information about the original zFS aggregate with no extended addressability
Note: Using REPRO can be much faster than using pax in cases of complex structures
and many special attribute settings.
For more information about using REPRO with zFS aggregates, see z/OS Distributed File
Service zSeries File System Implementation z/OS V1R13, SG24-6580 (edition 05 or later).
______________________________________________________________________________
| Enter DH to show REORG definition information. Change the data as needed. To |
| continue SAVE the changes,to stop processing use CANCEL. |
|______________________________________________________________________________|
Command ===> Scroll ===> CSR
F3=Exit F4=Save F5=Rfind F6=Rchange F10=Retrieve F12=Cancel
Figure 1-22 EDIT session display after starting DEFREORG and modifying the values for as needed
We pressed PF03 to start the DEFREORG search for possible data sets as shown in
Figure 1-23.
As before, DEFREORG calculated suggestions for the new zFS aggregate. This is shown in
Figure 1-24 on page 24.
Figure 1-24 EDIT session showing the reorganization statements created by DEFREORG
Figure 1-25 EDIT session showing the reorganization statements after doing a small change
$> rexx
SH> Do i=5000 By 500 To 6000; -
> Say i "cylinders are about" Format(i*90*8/(1024*1024),,2) "GB"; -
> End
5000 cylinders are about 3.43 GB
5500 cylinders are about 3.78 GB
6000 cylinders are about 4.12 GB
SH> Exit
$>
Figure 1-26 Some cylinder to GB calculations
Figure 1-27 JCL ZFSREORG with the changed CPYTOOL and member name specification
----------------------------------------------------------------------------
The main process ID for this job is 67305655. If you should need to stop
processing use the following UNIX command to do this smoothly.
Either: kill 67305655
Or : kill -s SIGTERM 67305655
----------------------------------------------------------------------------
----------------------------------------------------------------------------
ZFSRO004I Processing zFS old data set name HERING.TEST.NOT.EXTADDR...
----------------------------------------------------------------------------
ZFSRO086I Defining zFS aggregate HERING.TEST.EXTADDR ...
IOEZ00248I VSAM linear dataset HERING.TEST.EXTADDR successfully created.
ZFSRO054I 09:33:03 Now starting copy processing...
IDC0005I NUMBER OF RECORDS PROCESSED WAS 918180
ZFSRO070I 09:38:14 Copy processing has been ended...
ZFSRO106I Unmounting HERING.TEST.NOT.EXTADDR ...
ZFSRO107I Mounting zFS HERING.TEST.EXTADDR at /u/hering/test now...
ZFSRO111I No errors have been recognized for the actual REORG process.
READY
END
Figure 1-28 Messages shown in the joblog for the reorganization processing using REPRO
Figure 1-29 shows what this number of records of records processed means.
$> rexx
SH> Say "918180 records processed means" 918180/2 "8K blocks. These are" -
> 918180/(2*90) "cylinders."
918180 records processed means 459090 8K blocks. These are 5101 cylinders.
SH> exit
$>
Figure 1-29 Calculation for the number of records processed by REPRO
Figure 1-30 on page 28 shows the results of the reorganization job. This verifies that
extended addressability is set now, exactly 5101 cylinders are formatted, and 5500 cylinders
are allocated.
Notes:
If TSOREPRO is used, the specification for ZFS_NEW_ALLOC_NUM_SEC_ALLOCS is ignored
and not used.
If COPYPAX is used, the resulting zFS would have 6500 cylinders fully formatted (500
+ 12*500 cylinders).
We hope that the description and samples provided, together with the online help that is
available, is enough to understand how to install, customize, and use the ZFSREORG tool.
The following files and a short description of each are included here:
ZFSREORG
CPYRHELP
DEFRHELP
DEFREORG
DZRC$MAC
DZRH$MAC
DZRM$MAC
DZRP$MAC
DZRR$MAC
ZFSREORG JCL
Trace O
Parse Source . calltype myname .
switched = 0
final_rc = 0
no_msgs = 1
noexit_on_error = 1
info_on_timeout = 2
fd. = -1
pp. = -1
sig_enabled = 0
tmp_dir_defined = 0
max_no_vols = 59 /* maximal number of volumes for a zFS aggregate */
foreground = (Sysvar("SYSENV")="FORE")
background = (foreground=0)
msg_save = Msg()
zfo_temp_mounted = 0
zfs_temp_mounted = 0
zfo_switched_ro = 0
zfs_exists = 0
zfs_formatted = 0
zfs_created = 0
zfs_usable = 0
zfs_mounted = 0
zfo_processed. = 0
error_found = 0
denied_umnt_fstypes ="TFS" /* do not unmount these fstype fss */
swsu = 1 /* forces SU switching */
local_system = MVSVar("SYMDEF","SYSNAME")
If Syscalls("ON")>4 Then Do
Say "ZFSRO002E The SYSCALL environment could not be established."
Exit 8
End
If Syscalls("SIGON")<>0 Then Do
Say "ZFSRO003E The SIGNAL interface could not be established."
Exit 8
End
If foreground Then Do
Say "ZFSRO080E Processing is not yet supported in foreground."
Exit 8
End
/* ------------------------------------------------------------------ */
/* Switch effective and/or real UID to zero if needed and possible */
/* ------------------------------------------------------------------ */
If swsu Then Do
Call Syscall_Cmd "geteuid"
cur_euid = retval
/* ------------------------------------------------------------------ */
/* Set home and working directory, setup envvars, open /dev/null */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* Handling of signal interrupts */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* Read in all the reorg statements */
/* ------------------------------------------------------------------ */
If background Then Do
Call Bpxwdyn "INFO DD(STDIN)"
If Pos(Left(Right(D2x(result),8,"0"),4),"0438 0440")<>0 Then Do
/* IKJ56247I FILE INFO-RETRIEVAL NOT PERFORMED, NOT ALLOCATED */
Say "ZFSRO128E The necessary DDNAME STDIN is missing."
Call Final_Exit 8
End
Else Do
"EXECIO * DISKR STDIN (STEM INPUTD. FINIS"
If rc<>0 Then Do
Say "ZFSRO122E The specified member on DDNAME STDIN probably",
"does not exist."
Call Final_Exit 8
End
End
in_lines = inputd.0
End
/* ------------------------------------------------------------------ */
/* Run all the reorg processing */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* End of processing */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* Subroutines */
/* ------------------------------------------------------------------ */
Migrate_Data_Reset:
Parse Arg curmig_msg
If zfs_temp_mounted Then Do
Call syscall_cmd "unmount" zfs_name "(mtm_immed)", noexit_on_error
Call Test4_unmounted zfs_name
Migrate_zFS2zFS:
Call Msg "OFF"
zfo_dsn_status = Sysdsn("'"||zfo_name||"'")
Call Msg msg_save
Parse Value zfo_dsn_status With invalid_dsn "," .
Select
When zfo_dsn_status="DATASET NOT FOUND" Then Do
Say "ZFSRO015W The old zFS data set cannot be found."
error_found = 1
End
When invalid_dsn="INVALID DATASET NAME" Then Do
Say "ZFSRO016W The old zFS data set name specified is not valid."
error_found = 1
End
When zfo_dsn_status="OK" Then Nop
When zfo_dsn_status="UNAVAILABLE DATASET" Then Nop /* expect OK */
Otherwise Do
Say "ZFSRO017W The old zFS data set status is not as expected:"
Say "ZFSRO018W" zfo_dsn_status
error_found = 1
End
End
If error_found Then Nop /* Skip test for old zFS mounted already */
Else Do
Call Syscall_Cmd "statfs (zfo_name) st.", noexit_on_error, no_msgs
Select
When OK Then Do
zfo_devno = st.stfs_fsid
Call Syscall_Cmd "getmntent zfo." zfo_devno
read_only = Bitand(D2c(zfo.mnte_mode.1),D2c(mnt_mode_rdonly))
read_only = C2d(read_only)
read_write = (read_only=0)
zfo_mntdir = zfo.mnte_path.1
zfo_fstype = zfo.mnte_fstype.1
zfo_mounted = 1
If zfo_fstype<>"ZFS" Then Do
Say "ZFSRO090E The dataset specified as old zFS is not a zFS."
error_found = 1
End
End
When rc=0 & retval=-1 & errno=79 & errnojr="567002E" Then
zfo_mounted = 0
Otherwise Do
Say "ZFSRO019W The status of the old zFS is not expected."
Say "ZFSRO020W Rc=" rc "retval=" retval "errno=" errno,
"errnojr=" errnojr
error_found = 1
End
End /* Select */
End
zfs_volumes = zfs_volumes||,
If stop_after_syntax_check Then Do
Say "ZFSRO034I No specification errors found for current migration."
Return
End
If zfo_mounted Then Do
If read_write Then Do
Call Syscall_Cmd "unmount (zfo_name)" mtm_remount,,
noexit_on_error
If OK Then zfo_switched_ro = 1
Else Do
Say "ZFSRO036E Old zFS mount mode could not be switched to R/O."
error_found = 1
Return
End
End
End
Else Do
Call Syscall_Cmd "mount (tmp_zfo)" zfo_name "ZFS (mtm_rdonly)",,
noexit_on_error
If OK Then Do
zfo_temp_mounted = 1
zfo_mntdir = tmp_zfo
Call Syscall_Cmd "statvfs (tmp_zfo) st."
zfo_devno = st.stfs_fsid
Call Syscall_Cmd "getmntent zfo." zfo_devno
If zfo.mnte_fstype.1<>"ZFS" Then Do
Say "ZFSRO091E The data set specified as zFS is not a zFS."
error_found = 1
Return
End
End
Else Do
Say "ZFSRO037E zFS file system could not be mounted read-only."
error_found = 1
Return
End
End
If zfs_exists Then Do
If reorgtool<>"TSOREPRO" Then Do
Call Syscall_Cmd "mount (tmp_zfs)" zfs_name "ZFS (mtm_rdwr)",
"aggrgrow", noexit_on_error
If OK Then zfs_temp_mounted = 1
Else Do
Say "ZFSRO038E The new zFS aggregate could not be mounted."
error_found = 1
Return
If reorgtool<>"TSOREPRO" Then Do
End /* If reorgtool<>"TSOREPRO" */
If stop_after_zfs_is_formatted Then Do
Say "ZFSRO094I Old zFS is mounted, new zFS aggregate has been",
"created."
Say "ZFSRO035I Old zFS data set name=" zfo_name
Return
End
If zfo_temp_mounted Then Do
Call Syscall_Cmd "unmount" zfo_name "(mtm_normal)", noexit_on_error
If OK Then zfo_temp_mounted = 0
Call Test4_unmounted zfo_name
End
If zfs_temp_mounted Then Do
Call Syscall_Cmd "unmount" zfs_name "(mtm_normal)", noexit_on_error
If OK Then zfs_temp_mounted = 0
Call Test4_unmounted zfs_name
End
zfo_still_mounted = zfo_mounted
If zfs_replaces_zfo="Y" & zfo_mounted Then Do
Call Syscall_Cmd "statfs" zfo_name "st."
zfo_devno = st.stfs_fsid
Call Syscall_Cmd "getmntent mnt."
subfss. = ""
Do j=1 To mnt.0
par_devno = mnt.mnte_pardev.j
subfss.par_devno = subfss.par_devno j
End
zfo_fss = 0
Call Build_List_Of_Subfss zfo_devno
do_unmounting = 1
Do j=zfo_fss By -1 To 1
mnt_index = zfo_fs.j
fsdevno = mnt.mnte_dev.mnt_index
fstype = mnt.mnte_fstype.mnt_index
If Wordpos(mnt.mnte_fstype.mnt_index,denied_umnt_fstypes)<>0 Then
Do
Say "ZFSRO123E One PFS down the USS structure is marked to",
"prevent unmounting of the sub structures; no replacement",
"of the file systems is done."
error_found = 1
do_unmounting = 0
Final_Exit: Trace O
Parse Arg final_rc
Call Migrate_Data_Reset 0 /* 0= no curmig_msg */
If tmp_dir_defined Then Do
Call Syscall_Cmd "chdir" tmp_dir, noexit_on_error
If OK Then Do
If zfo_temp_mounted Then Do
Call Syscall_Cmd "unmount (zfo_name)" mtm_normal,,
noexit_on_error
If OK Then zfo_temp_mounted = 0
Call Test4_unmounted zfo_name
End
If zfs_temp_mounted Then Do
Call Syscall_Cmd "unmount (zfs_name)" mtm_normal,,
noexit_on_error
Syntax_Error:
Say "ZFSRO097W REXX error in sourceline" sigl "of" myname
Say "ZFSRO098I Line" sigl||":" Strip(Sourceline(sigl))
Say "ZFSRO099E" Errortext(rc)||", Rc("||rc||")"
Call Final_Exit 12
Exit 9999
Novalue_Error:
retc = rc
Say "ZFSRO100W REXX error in sourceline" sigl "of" myname
Say "ZFSRO101I Line" sigl||":" Strip(Sourceline(sigl))
Say "ZFSRO102E Variable not initialized..."
Call Final_Exit 12
Exit 9999
Get_Output_Data: Trace O
Call Syscall_Cmd "fstat (pp.1) st."
output_size = st.st_size
If Verify(output_size,"1234567890")<>0 Then Do
Say "ZFSRO059I Too many lines have been created, aborting..."
Say "ZFSRO060I Command:" shell_cmd
Call Final_Exit 8
End
If output_size<>0 Then Do
Call Syscall_Cmd "read (pp.1) output_data (output_size)"
all_output = all_output||output_data
Do While Length(all_output)>0
Parse Var all_output output_line (esc_n) all_output
Say output_line
End
End
Return
Syscall_Cmd: Trace O
Parse Arg syscall_cmd, call_type, no_display
display_msgs = (no_display<>"1")
exit_on_error = (call_type="")
Address SYSCALL syscall_cmd
Select
When rc=0 & retval=-1 & errno=79 & errnojr="55B005C" &,
syscall_cmd="mount m." Then Do /* Problem with mount point */
not_OK = 1
Address SYSCALL "statfs (m.mnte_fsname) st."
If retval>=0 Then Do
ffsid = st.stfs_fsid
Address SYSCALL "statvfs (m.mnte_path) st."
If retval>=0 Then Do
If ffsid=st.stfs_fsid Then Do
not_OK = 0
retval = 0
End
End
Test4_unmounted:
Parse Arg uss_fsn
Trace O
Parse Source . . myname .
Call Compute_Help_Lines
Exit 9999
Browse_Migr_Help:
Signal On Syntax Name Syntax_Error
Parse Value Sourceline(sigl) With . . skip_top skip_end .
help_strt = sigl + skip_top
help_stop = sourceline() - skip_end
msg.0 = 0
Call Bpxwdyn "ALLOC RTDSN(RGRHPDSN) RTDDN(RGRHPDDN) NEW",
"MSG(MSG.) LRECL(80) RECFM(F,B) SPACE(1,1) TRACKS"||tmp_unit
If result<>0 | rgrhpddn="" Then Do
If msg.0=0 Then
Say "Disp_Msg RGRHP001E Error allocating temporary file"
Else Do i=1 to msg.0
Say Strip(msg.i,"T")
End
Say "Rc("||result||")"
Exit 8
End
Do i=help_strt To help_stop
j=i+1-help_strt
hline.j = Sourceline(i)
End
"EXECIO" (help_stop+1-help_strt) "DISKW" rgrhpddn "(STEM HLINE. FINIS"
Call Final_Exit 0
Exit 9999
Final_Exit:
Parse Arg final_rc
If Symbol("RGRHPDID")="VAR" Then
Address ISPEXEC "LMDFREE LISTID("||rgrhpdid||")"
If rgrhpddn<>"" Then Call Bpxwdyn "FREE DD("||rgrhpddn||")"
Exit final_rc
Syntax_Error:
Say "RGRHP003W REXX error in sourceline" sigl "of" myname
Say "RGRHP004I Line" sigl||":" Strip(Sourceline(sigl))
Say "RGRHP005E" Errortext(rc)||", Rc("||rc||")"
Call Final_Exit 12
Exit 9999
Novalue_Error:
retc = rc
Say "RGRHP006W REXX error in sourceline" sigl "of" myname
Say "RGRHP007I Line" sigl||":" Strip(Sourceline(sigl))
Say "RGRHP008E Variable not initialized..."
Call Final_Exit 12
Exit 9999
Compute_Help_Lines:
Call Browse_MigrHelp 3 1 /* skip next 2 lines and 1 at the end */
/* ------------------------------------------------------------------ *
# ==================================================================== #
# REORGDATA Help Information #
# ==================================================================== #
b) Environment Variables
STOP_AFTER_SYNTAX_CHECK:
Force stopping after formal syntax check of STDIN data is done; value
must be specified as N or Y.
STOP_AFTER_FSS_MOUNTED:
Force stopping when old and if existing new zFS is/are mounted; value
must be specified as N or Y.
STOP_AFTER_ZFS_IS_FORMATTED:
Force stopping when the new zFS aggregate is formatted; value must be
specified as N or Y.
TARGET_ZFS_MUST_BE_EMPTY:
Run copy processing only if the target zFS structure is empty; value
may be set to Y or N.
DENIED_UMNT_FSTYPES:
PATH:
Note: The abbreviation "FYR:" used below means a value that is provided
just "For Your Reference".
Important: If you specify not to replace the old by the new zFS or this
cannot be done for other reasons the old zFS file system is kept
mounted read-only to assure that the contents will not differ
again from the new zFS.
* ------------------------------------------------------------------ */
Trace O
Parse Source . . myname .
Call Compute_Help_Lines
Exit 9999
Browse_Migr_Help:
Signal On Syntax Name Syntax_Error
Parse Value Sourceline(sigl) With . . skip_top skip_end .
help_strt = sigl + skip_top
help_stop = sourceline() - skip_end
msg.0 = 0
Call Bpxwdyn "ALLOC RTDSN(RGRHPDSN) RTDDN(RGRHPDDN) NEW",
"MSG(MSG.) LRECL(80) RECFM(F,B) SPACE(1,1) TRACKS"||tmp_unit
If result<>0 | rgrhpddn="" Then Do
If msg.0=0 Then
Say "Disp_Msg RGRHP001E Error allocating temporary file"
Else Do i=1 to msg.0
Say Strip(msg.i,"T")
End
Say "Rc("||result||")"
Exit 8
End
Do i=help_strt To help_stop
j=i+1-help_strt
hline.j = Sourceline(i)
End
"EXECIO" (help_stop+1-help_strt) "DISKW" rgrhpddn "(STEM HLINE. FINIS"
Call Final_Exit 0
Exit 9999
Final_Exit:
Parse Arg final_rc
If Symbol("RGRHPDID")="VAR" Then
Address ISPEXEC "LMDFREE LISTID("||rgrhpdid||")"
If rgrhpddn<>"" Then Call Bpxwdyn "FREE DD("||rgrhpddn||")"
Exit final_rc
Syntax_Error:
Say "RGRHP003W REXX error in sourceline" sigl "of" myname
Say "RGRHP004I Line" sigl||":" Strip(Sourceline(sigl))
Say "RGRHP005E" Errortext(rc)||", Rc("||rc||")"
Call Final_Exit 12
Exit 9999
Novalue_Error:
retc = rc
Say "RGRHP006W REXX error in sourceline" sigl "of" myname
Say "RGRHP007I Line" sigl||":" Strip(Sourceline(sigl))
Say "RGRHP008E Variable not initialized..."
Call Final_Exit 12
Exit 9999
Compute_Help_Lines:
Call Browse_MigrHelp 3 1 /* skip next 2 lines and 1 at the end */
/* ------------------------------------------------------------------ *
# ==================================================================== #
# DEFREORG Help Information #
# ==================================================================== #
ZFS_REORG_DEFINE_DSN=
This is the full name of a sequential MVS data set including HLQ or the
name of PDS. Preferred is to use a PDS as this allows simply to use new
members for new migration tasks. This data set must be pre-allocated as
VB80 or FB80. The default name is hlq.ZFS.REORG.DEFINE with "hlq" being
your own userid.
ZFS_REORG_DEFINE_MBR=
Here you can specify the output member name to contain the migration
the migration control statements. If no name is provided "WORKnn" is
used by default with "nn" being a number that is not used currently.
You can rename the member names using ISPF at any time as you like it.
ZFS_REORG_DEFINE_DSP=
This value must be specified as APPEND or REPLACE. Note, only the first
character is examined. With "APPEND" the new control statements are
appended, otherwise the old contents is replaced (if the member exists
already).
ZFS_DEF_DATACLASS=
ZFS_DEF_MANAGEMENTCLASS=
ZFS_DEF_STORAGECLASS=
ZFS_DATA_SETS_TO_REORG=
This statement defines the zFS data set name list to be reorganized. The
value cannot be BLANK. You may use several lines using this control
word. The values are the same as used on ISPF 3.4 to display a list of
data sets.
ZFS_AGGRNAME_CHANGE_CMD=
* ------------------------------------------------------------------ */
tmp_unit = "" /* UNIT for temp files, e.g. SYSDA, 3390, VIO */
Trace O
Parse Source . . myname . . . . omvs .
myname = Substr(myname,Lastpos("/",myname)+1)
If omvs="OMVS" Then Do
Say "DEFRO053E The procedure needs to be run in TSO/ISPF foreground."
Exit 2
End
If Sysvar("SYSISPF")<>"ACTIVE" Then Do
Address TSO "ISPSTART CMD(%"||myname||")"
Exit rc
End
msg_save = Msg()
msg_say = 0
defrcopn = 0
listaccd = 0
no_add2imsg = 0
foreground = (Sysvar("SYSENV")="FORE")
background = (foreground=0)
Parse Value "" With defroddn defrmddn defrcddn zerrmsg zerrlm
no_sms_class = "**None**"
get_size_needed = 0
Numeric Digits 10
final_rc = 0
no_msgs = 1
noexit_on_error = 1
switched = 0
zero_parm = D2c(0,4)
zero_01 = "00"x
zero_33 = Copies(zero_01,33)
aid_reserved = zero_33 /* for pfsctl() calls - char(33) */
zero_st = Copies(zero_01,164) /* aggr_status initialization part */
zfs_cmd = X2d("40000005") /* zFS pfsctl() cmd ZFSCALL_AGGR */
If background Then Do
Call Disp_Msg,
"DEFRO001E The procedure needs to be run in foreground."
Call Final_Exit 8
End
If Syscalls("ON")>4 Then Do
Call Disp_Msg,
"DEFRO054E The SYSCALL environment could not be established."
Call Final_Exit 8
End
msg.0 = 0
Call Bpxwdyn "ALLOC RTDDN(DEFRODDN) NEW MSG(MSG.) LRECL(80)",
"RECFM(F,B) SPACE(1,1) TRACKS"||tmp_unit
If result<>0 | defroddn="" Then Do
If msg.0=0 | msg.0>1 Then Do
Do i=1 to msg.0
Say Strip(msg.i)
End
Call Disp_Msg "DEFRO002E Error allocating temporary file,",
"Rc("||result||")"
End
Else Call Disp_Msg Strip(msg.1)||", Rc("||result||")"
Call Final_Exit 8
End
msg.0 = 0
Call Bpxwdyn "ALLOC RTDDN(DEFRMDDN) NEW MSG(MSG.) LRECL(84)",
"RECFM(V,B) SPACE(1,1) TRACKS"||tmp_unit
If result<>0 | defrmddn="" Then Do
If msg.0=0 | msg.0>1 Then Do
Do i=1 to msg.0
mline00 = 4
mline.2 = "Messages created during previous processing"
mline.1 = Copies("=",Length(mline.2))
mline.3 = mline.1
mline.4 = ""
Address ISPEXEC "VGET (ZFSM$DSN ZFSM$MBR ZFSM$DSP ZFSM$DCL ZFSM$MCL",
"ZFSM$SCL ZFSM$HDM ZFSM$CCM)"
If rc>8 Then Do
Call WMsg "DEFRO004W ISPF Service VGET gave rc" rc||".", no_add2imsg
Parse Value "" With zfsm$dsn zfsm$mbr zfsm$dsp zfsm$dcl zfsm$mcl,
zfsm$scl zfsm$hdm zfsm$ccm
End
If zfsm$dsn="" Then zfsm$dsn = Userid()||".ZFS.REORG.DEFINE"
If zfsm$dsp="" Then zfsm$dsp = "APPEND"
cmntline = Left("#" Copies("----",17) "#",80)
blnkline = Left("",80)
cline.1 = cmntline
cline.2 = Left("ZFS_REORG_DEFINE_DSN="||zfsm$dsn,80)
cline.3 = Left("ZFS_REORG_DEFINE_MBR="||zfsm$mbr,80)
cline.4 = Left("ZFS_REORG_DEFINE_DSP="||zfsm$dsp,80)
cline.5 = cmntline
cline.6 = blnkline
cline.7 = cmntline
cline.8 = Left("ZFS_DEF_DATACLASS="||zfsm$dcl,80)
cline.9 = Left("ZFS_DEF_MANAGEMENTCLASS="||zfsm$mcl,80)
cline.10 = Left("ZFS_DEF_STORAGECLASS="||zfsm$scl,80)
cline.11 = cmntline
cline.12 = blnkline
cline.13 = cmntline
hdm_words = Max(Words(zfsm$hdm),1)
Do i=1 To Max(Words(zfsm$hdm),1)
clines = 13+i
cline.clines = Left("ZFS_DATA_SETS_TO_REORG="||Word(zfsm$hdm,i),80)
End
clines = 13+hdm_words+1
cline.clines = Left("ZFS_AGGRNAME_CHANGE_CMD="||zfsm$ccm,80)
clines = clines+1
cline.clines = cmntline
"EXECIO" clines "DISKW" defroddn "(STEM CLINE. FINIS"
If rc<>0 Then Do
Call Disp_Msg "DEFRO005E EXECIO error occurred, Rc("||rc||")"
Call Final_Exit 8
End
Do Forever
no_error_found = 1
Address ISPEXEC "EDIT DATAID("||defrodid||") MACRO(DZRP$MAC)"
Select
When rc=0 Then Nop
When rc=4 Then Do
Call Disp_Msg "DEFRO007W Define processing canceled..."
Call Final_Exit 4
End
Otherwise Do
Call Disp_Msg "DEFRO008E Error on editing occurred,",
"Rc("||rc||")"
Call Final_exit 8
End
End
End /* Do Forever */
mlines = mline00
If defreorg_mbr="" Then Do
defreorg_ctl = defreorg_dsn
If defreorg_dsp="APPEND" Then acc_mode = "MOD"
Else acc_mode = "OLD"
End
Else Do
defreorg_ctl = defreorg_dsn||"("||defreorg_mbr||")"
acc_mode = "SHR"
End
msg.0 = 0
Call Bpxwdyn "ALLOC DSN("||defreorg_ctl||") RTDDN(DEFRCDDN)" acc_mode,
"MSG(MSG.)"
If result<>0 | defrcddn="" Then Do
dyn_rc = result
If msg.0=0 | msg.0>1 Then Do
Do i=1 to msg.0
Call WMsg Strip(msg.i)
End
Call Disp_Msg "DEFRO030E Error allocating DEFREORG control file,",
"Rc("||dyn_rc||")"
End
Else Call Disp_Msg Strip(msg.1)||", Rc("||dyn_rc||")"
If mlines>mline00 Then Do
Call Write_MFile
End
Call Final_Exit 8
End
dsn = ""
Do Forever
Address ISPEXEC "LMDLIST LISTID("||defrddid||") DATASET(DSN)",
"STATS(YES) OPTION(LIST)"
Select
When rc=0 Then Do
listaccd = 1
If zdlmigr="YES" Then Call WMsg,
"DEFRO033W Migrated data set" dsn "has been skipped."
Else Do
If not_dsnref.dsn Then Do
not_dsnref.dsn = 0
dsns = dsns+1
dsn.dsns = dsn
Call WMsg "DEFRO048I Data set" dsn "will be examined."
End
Else Call WMsg,
"DEFRO034I Data set" dsn "has been processed already"
End
End
When rc=4 Then Do
Call WMsg "DEFRO035E No data sets match """||dsnp||"""."
Leave
End
When rc=8 Then Leave /* All data set names processed */
Otherwise Do
Call Disp_Msg,
"DEFRO036E ISPF Service LMDLIST/LIST gave rc" rc||"."
Call Final_Exit 8
End
End /* Select */
End /* Do Forever */
If listaccd Then Do
Address ISPEXEC "LMDLIST LISTID("||defrddid||") OPTION(FREE)"
If rc<>0 Then Do
If rc=8 Then message = "" Strip(zerrmsg) Strip(zerrlm)
Else message = ""
Call Disp_Msg "DEFRO037E ISPF service LMDLIST gave RC" rc "on",
"freeing storage for data ID DEFRDDID."||message
Call Final_Exit 8
nn = 32
Call WMctl " "
Call Rxlsaggr /* Retrieve information about all currently active zFSs */
zfss = 0
Do i=1 To dsns
aggr_name = dsn.i
/* ----------------------------------------------------------- */
/* Step 1: Verifying aggr_name is a VSAM cluster */
/* ----------------------------------------------------------- */
lc. = ""
Call OUTTRAP "LC."
"LISTCAT ENTRIES('"||aggr_name||"') CLUSTER NAME"
retc = rc
Call OUTTRAP "OFF"
Select
When retc=0 Then Nop
When retc=4 & Word(lc.1,1)="IDC1565I" Then Do
/* IDC1565I aggr_name NOT A REQUESTED TYPE */
Call WMsg "DEFRO056I Data set" aggr_name "is not a VSAM cluster",
"and will be skipped."
Iterate i
End
Otherwise Do
Call WMsg "DEFRO057E Unexpected LISTCAT error occurred, rc=" retc
Call WMsg "DEFRO058I" lc.1
Call WMsg "DEFRO059I Data set" aggr_name "will be skipped."
Iterate i
End
End /* Select */
/* ----------------------------------------------------------- */
/* Step 2: Retrieving total number 8K blks and free percentage */
/* ----------------------------------------------------------- */
If not_aggr_attached.aggr_name Then Do
Call Rxattach /* aggr_name */
If not_OK Then Do
Call WMsg "DEFRO060W Data set" aggr_name "seems to be no valid",
"zFS and will be skipped."
Iterate i
End
End
/* ----------------------------------------------------------- */
/* Step 3: Retrieving DSINFO data for the cluster part */
/* ----------------------------------------------------------- */
Address ISPEXEC "ISPEXEC DSINFO DATASET('"||aggr_name||"')"
Select
When rc=8 Then Do
Call WMsg "DEFRO039I Data set" aggr_name "could not be found."
zfss = zfss-1
Iterate i
End
When rc<>0 Then Do
Call WMsg "DEFRO040E ISPF Service DSINFO gave rc" rc||"."
Call WMsg "DEFRO041W Data set" aggr_info "will be skipped."
zfss = zfss-1
Iterate i
End
Otherwise Nop /* OK */
End
zfo_mc = Strip(zdsmc) /* Management class */
If zfo_mc=no_sms_class Then zfo_mc = ""
zfo_sc = Strip(zdssc) /* Storage class */
If zfo_sc=no_sms_class Then zfo_sc = ""
zfo_dc = Strip(zdsdc) /* Data class */
If zfo_dc=no_sms_class Then zfo_dc = ""
/* ----------------------------------------------------------- */
/* Step 4: Retrieving the cluster data part name */
/* ----------------------------------------------------------- */
ldsdata. = ""
Call Outtrap "LDSDATA."
"LISTCAT ENTRIES('"||zfo_name||"') NAMES"
retc = rc
Call Outtrap "OFF"
/* ----------------------------------------------------------- */
/* Step 5: Retrieving DSINFO data for the data part */
/* ----------------------------------------------------------- */
Address ISPEXEC "ISPEXEC DSINFO DATASET('"||zfo_lds_data||"')"
Select
When rc=8 Then Do
Call WMsg "DEFRO066I Data part" zfo_lds_data "could not be found."
Call WMsg "DEFRO067W Data set" aggr_info "will be skipped."
zfss = zfss-1
Iterate i
End
When rc<>0 Then Do
Call WMsg "DEFRO068E ISPF Service DSINFO gave rc" rc||"."
Call WMsg "DEFRO069W Data set" aggr_info "will be skipped."
zfss = zfss-1
Iterate i
End
Otherwise Nop /* OK */
End
zfo_firstvol = zdsvol /* First volume serial */
zfo_#volumes = Strip(zds#vols) /* Number of volumes */
zfo_devt = Strip(zdsdevt) /* Device type */
zfo_primu = zdsspc /* Primary space units */
zfo_prima = C2n(zds1ex) /* Primary space alloc */
zfo_seca = C2n(zds2ex) /* Secondary space alloc */
zfo_spaca = C2n(zdstota) /* Allocated space units */
/* ----------------------------------------------------------- */
/* Step 6: Putting all the information together */
/* ----------------------------------------------------------- */
zfo_name_sav = Strip(Strip(Left(zfo_name,40)),"T",".")||".SAV"
/* Name for the bkup zFS */
zfs_name = zfo_name /* zFS LDS name */
If defreorg_mbr<>"" Then Do
Address ISPEXEC "LMINIT DATAID(DEFRCDID) DATASET('"||defreorg_dsn||,
"')"
If rc<>0 Then Do
If rc=8 Then message = "" Strip(zerrmsg) Strip(zerrlm)
Else message = ""
Call Disp_Msg "DEFRO043E ISPF service LMINIT gave RC" rc "on",
"generating a data ID DEFRCDID."||message
Call Final_Exit 8
End
If mbr_exists Then Do
Address ISPEXEC "LMOPEN DATAID("||defrcdid||")"
If rc<>0 Then Do
Call Disp_Msg "ISPF gave RC" rc "on opening DEFRCDDN."
Call Final_Exit 8
End
defrcopn = 1
Address ISPEXEC "LMMFIND DATAID("||defrcdid||") MEMBER("||,
defreorg_mbr||") STATS(YES)"
reorgcntl.0 = clines
"EXECIO * DISKW" defrcddn "(STEM REORGCNTL. FINIS"
If rc<>0 Then Do
Call Disp_Msg "DEFRO044E EXECIO error occurred, Rc("||rc||")"
Call Final_Exit 8
End
If defreorg_mbr<>"" Then Do
If zlmod="" Then zlmod = 0
Else If Verify(zlmod,"1234567890")=0 & zlmod<99 Then zlmod = zlmod+1
lmmstats_parm = "MODLEVEL("||zlmod||")"
If zlcdate<>"" Then
lmmstats_parm = lmmstats_parm "CREATED("||zlcdate||")"
If zlc4date<>"" Then
lmmstats_parm = lmmstats_parm "CREATED4("||zlc4date||")"
If zlinorc<>"" Then
lmmstats_parm = lmmstats_parm "INITSIZE("||zlinorc||")"
Address ISPEXEC "LMMSTATS DATAID("||defrcdid||") MEMBER("||,
defreorg_mbr||")" lmmstats_parm
If rc<>0 Then Do
Call Disp_Msg "ISPF gave rc" rc "on generating statistics for",
"DEFRCDID."
Call Final_Exit 8
End
End
If mlines>mline00 Then Do
Call Write_MFile
message = "Enter DM to display most recent messages collected. "
End
Else message = ""
message = message || "Change the data as needed. Enter CH to show",
"further REORG processing information."
Call Disp_Msg Strip(ispfmsg message)
Address ISPEXEC "EDIT DATASET('"||defreorg_ctl||"') MACRO(DZRP$MAC)"
Select
When rc=0 Then Nop
When rc=4 Then Nop
Otherwise Do
/* ------------------------------------------------------------------ */
/* End of processing */
/* ------------------------------------------------------------------ */
Call Final_Exit 0
Exit 9999
/* ------------------------------------------------------------------ */
/* Subroutines */
/* ------------------------------------------------------------------ */
Final_Exit: Trace O
Parse Arg final_rc
If Symbol("DEFRODID")="VAR" Then
Address ISPEXEC "LMFREE DATAID("||defrodid||")"
If defroddn<>"" Then Call Bpxwdyn "FREE DD("||defroddn||")"
If Symbol("DEFRMDID")="VAR" Then Do
Address ISPEXEC "LMFREE DATAID("||defrmdid||")"
Address ISPEXEC "VERASE (ZFSM$DID)"
End
If defrmddn<>"" Then Call Bpxwdyn "FREE DD("||defrmddn||")"
If Symbol("DEFRCDID")="VAR" Then Do
If defrcopn Then Address ISPEXEC "LMCLOSE DATAID("||defrcdid||")"
Address ISPEXEC "LMFREE DATAID("||defrcdid||")"
End
If defrcddn<>"" Then Call Bpxwdyn "FREE DD("||defrcddn||")"
If Symbol("DEFRDDID")="VAR" Then Do
If listaccd Then
Address ISPEXEC "LMDLIST LISTID("||defrddid||") OPTION(FREE)"
Address ISPEXEC "ISPEXEC LMDFREE LISTID("||defrddid||")"
End
If switched Then Do
Call Syscall_Cmd "setreuid" cur_uid cur_euid, noexit_on_error
If not_OK Then
Say "DEFRO055E UID settings could not be switched back..."
End
Exit final_rc
Syntax_Error:
Say "DEFRO096W REXX error in sourceline" sigl "of" myname
Say "DEFRO097I Line" sigl||":" Strip(Sourceline(sigl))
Say "DEFRO098I This may be caused by invalid data that was received."
Say "DEFRO099E" Errortext(rc)||", Rc("||rc||")"
Call Final_Exit 12
Exit 9999
Novalue_Error:
Say "DEFRO100W REXX error in sourceline" sigl "of" myname
Say "DEFRO101I Line" sigl||":" Strip(Sourceline(sigl))
Say "DEFRO102E Variable not initialized..."
Halt_Request:
Say "DEFRO103W REXX processing halted at line" sigl "of" myname
Say "DEFRO104I Line" sigl||":" Strip(Sourceline(sigl))
Call Final_Exit 8
Exit 9999
C2n: Procedure
Parse Arg cstring
cstring = Strip(cstring)
Do Forever
cpos = Pos(",",cstring)
If cpos>0 Then cstring = Delstr(cstring,cpos,1)
Else Leave
End
Return cstring
IsNotValid: Procedure
Parse Arg clname
Select
When Length(clname)>8 Then is_not_valid = 1
When Verify(Left(clname,1),"1234567890")=0 Then is_not_valid = 1
When Verify(clname,"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@#$")=0 Then
is_not_valid = 0
Otherwise is_not_valid = 1
End
Return is_not_valid
IsInvalidStr: Procedure
Parse Arg string
If Verify(string,"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@#$.")=0 Then
is_not_valid = 0
Else is_not_valid = 1
Return is_not_valid
WMsg: Trace O
Parse Arg msgline, add2ispfmsg
add2ispfmsg = (add2ispfmsg<>0)
If msg_say Then add2ispfmsg = 0
If add2ispfmsg & ispfmsg = "" Then ispfmsg = msgline
If msg_say Then Say msgline
Do While Length(msgline)<>0
mlines = mlines+1
Parse Var msgline mline.mlines 81 msgline
End
Return
WMctl: Trace O
Parse Arg mdcline
clines = clines+1
reorgcntl.clines = mdcline
Return
If Symbol("defrmdid")="LIT" Then Do
Address ISPEXEC "LMINIT DATAID(DEFRMDID) DDNAME("||defrmddn||")"
If rc<>0 Then Do
If rc=8 Then message = "" Strip(zerrmsg) Strip(zerrlm)
Else message = ""
Call Disp_Msg "DEFRO047E ISPF service LMINIT gave RC" rc "on",
"generating a data ID DEFRMDID."||message
Call Final_Exit 8
End
zfsm$did = defrmdid
Address ISPEXEC "VPUT (ZFSM$DID)"
End
Return
Disp_Msg: Procedure
Trace O
Parse Arg zedlmsg, type
zedsmsg = ""
type = (type<>"I")
Address ISPEXEC
"VPUT (ZEDSMSG ZEDLMSG)"
"SETMSG MSG(ISRZ00"||type||")"
"CONTROL DISPLAY REFRESH"
Return
Syscall_Cmd: Trace O
Parse Arg syscall_cmd, call_type, no_display
display_msgs = (no_display<>"1")
exit_on_error = (call_type="")
Address SYSCALL syscall_cmd
If errno="8A" & errnojr="EF18626F" Then display_msgs = 0
If rc=0 & retval=-1 & errno=70 & errnojr="59D0135" Then not_OK = 0
Else not_OK = (rc<>0 | retval<0 | retval=0 & (errno<>0 | errnojr<>0))
If get_size_needed & errno="91" & errnojr="EF176274" Then Do
not_OK = 0
get_size_needed = 0
End
OK = (not_OK = 0)
If not_OK & display_msgs Then Do
Say "SYSCALL Service:" syscall_cmd
Say "Syscall Return Code=" rc
Say "OMVS Return Value =" retval
Say "OMVS Return Code =" errno
Say "OMVS Reason Code =" errnojr
is_omvs_range = X2d(Left(Right(errnojr,8,"0"),4))<=X2d(20FF)
is_zfs = (Left(Right(errnojr,8,"0"),2)="EF")
/* ------------------------------------------------------------------ */
/* */ Rxattach: /* */
/* Attaching an aggregate locally with NBS + aggr_grow */
/* Attach aggregate/opcode 105 for pfsctl API ZFSCALL_AGGR command */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* */ Rxdetach: /* */
/* Detaching an aggregate */
/* Detach aggregate/opcode 104 for pfsctl API ZFSCALL_AGGR command */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* */ Return /* from Rxdetach */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* */ Rxlsaggr: /* */
/* Retrieving information for all attached aggregates */
/* List attached aggregate names (version 2)/opcode 140 */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* */ Return /* from Rxlsaggr */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* */ Rxaggrinfo: /* */
/* Retrieving attributes for a specific (attached) aggregate */
/* List aggregate status (Version 2)/opcode 146 - ZFSCALL_AGGR cmd */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* */ Return /* from Rxaggrinfo */
/* ------------------------------------------------------------------ */
Trace O
Parse Source . . myname .
"ISREDIT MACRO"
If rc<>0 Then Do
message = "MACRO" myname "gave Rc=" rc
If rc=28 Then message = message||", probably pending prefix",
"commands..."
Call Disp_Msg message
Exit rc
End
"CPYRHELP"
Exit rc
Disp_Msg: Procedure
Trace O
Parse Arg zedlmsg, type
zedsmsg = ""
type = (type<>"I")
Address ISPEXEC
"VPUT (ZEDSMSG ZEDLMSG)"
"SETMSG MSG(ISRZ00"||type||")"
"CONTROL DISPLAY REFRESH"
Return
Trace O
Parse Source . . myname .
"ISREDIT MACRO"
If rc<>0 Then Do
message = "MACRO" myname "gave Rc=" rc
If rc=28 Then message = message||", probably pending prefix",
"commands..."
Call Disp_Msg message
Exit rc
End
"DEFRHELP"
Exit rc
Disp_Msg: Procedure
Trace O
Parse Arg zedlmsg, type
zedsmsg = ""
type = (type<>"I")
Address ISPEXEC
"VPUT (ZEDSMSG ZEDLMSG)"
"SETMSG MSG(ISRZ00"||type||")"
"CONTROL DISPLAY REFRESH"
Return
Trace O
Parse Source . . myname .
"ISREDIT MACRO"
If rc<>0 Then Do
message = "MACRO" myname "gave Rc=" rc
If rc=28 Then message = message||", probably pending prefix",
"commands..."
Call Disp_Msg message
Exit rc
End
Disp_Msg: Procedure
Trace O
Parse Arg zedlmsg, type
zedsmsg = ""
type = (type<>"I")
Address ISPEXEC
"VPUT (ZEDSMSG ZEDLMSG)"
"SETMSG MSG(ISRZ00"||type||")"
"CONTROL DISPLAY REFRESH"
Return
Trace O
Parse Source . . myname .
"ISREDIT MACRO"
If rc<>0 Then Do
message = "MACRO" myname "gave Rc=" rc
If rc=28 Then message = message||", probably pending prefix",
"commands..."
Call Disp_Msg message
Exit rc
End
Exit 0
Disp_Msg: Procedure
Trace O
Parse Arg zedlmsg, type
zedsmsg = ""
type = (type<>"I")
Address ISPEXEC
"VPUT (ZEDSMSG ZEDLMSG)"
"SETMSG MSG(ISRZ00"||type||")"
"CONTROL DISPLAY REFRESH"
Return
Trace O
Parse Source . . myname .
"ISREDIT MACRO"
If rc<>0 Then Do
message = "MACRO" myname "gave Rc=" rc
If rc=28 Then message = message||", probably pending prefix",
"commands..."
Call Disp_Msg message
Exit rc
End
Disp_Msg: Procedure
Trace O
Parse Arg zedlmsg, type
zedsmsg = ""
type = (type<>"I")
Address ISPEXEC
"VPUT (ZEDSMSG ZEDLMSG)"
"SETMSG MSG(ISRZ00"||type||")"
"CONTROL DISPLAY REFRESH"
Return
The publications listed in this section are considered particularly suitable for a more detailed
discussion of the topics covered in this paper.
You can search for, view, download, or order these documents and other Redbooks,
Redpapers, Web Docs, draft and additional materials, at the following website:
ibm.com/redbooks
Other publications
These publications are also relevant as further information sources:
z/OS Distributed File Service zSeries File System Administration, SC24-5989
Online resources
These websites are also relevant as further information sources:
Get the file zfs.zfsreorg.unload.bin from:
ftp://www.redbooks.ibm.com/redbooks/REDP4769/Description2
Redpaper ™
REDP-4769-00