Storage Strategies Inexpensive Storage Information Solutions By Steve Pryor Callout: There are a number of facilities available within the MVS/ESA operating system which provide information about the contents and status of DASD volumes. Callout: Storage administrators in most installations have access to an extensive set of space management and monitoring tools. Often, however, these tools are too powerful, esoteric or expensive to allow most users access to them. In order to keep the storage subsystem operating smoothly and efficiently, the storage administrator needs information about the status of the volumes under its control. When problems are encountered, the storage administrator must be able to answer questions such as, "What volumes have the most free space available?" or "Are there any storage groups with volumes in QUIESCE NEW status?" While the particular questions that must be answered to solve a problem may not be always be foreseeable, the need for information certainly is. Nearly all the large mainframe software vendors provide sophisticated systems for storage management analysis and reporting. These systems can be invaluable for monitoring conditions in the storage system, diagnosing problems, and even taking actions automatically when problems occur, such as defragmenting volumes or migrating data. Large and powerful systems such as these are often expensive, and require considerable training and skill to operate. Their use is often restricted to storage administrators to prevent misuse. As a result, even installations that can afford the expense of buying such systems and training staff in their use sometimes have a need for less-sophisticated methods of providing storage information which are less expensive, easier to use, and can be made accessible to users as well as storage administrators. There are a number of facilities available within the MVS/ESA operating system which provide information about the contents and status of DASD volumes. One of the oldest is the LSPACE macro (SVC 78). Because it provides basic space information about an entire DASD volume with a simple invocation and returns data in a simple format, it is used by many different components of the operating system, including SMS, SMF and DFSMShsm, as well as many others. LSPACE can return data in two different formats: a printable message which indicates the free space on the volume in cylinders and tracks, or a control block which contains both free space information and some additional information such as whether the VTOC index has been disabled for the volume and the volume's fragmentation index. As input, LSPACE requires the UCB address of the disk volume which is to be examined. This can be obtained with the UCBSCAN macro, which returns the address of a copy of the UCB or the actual address of the UCB (if the caller is APF-authorized). When combined in a loop, UCBSCAN and LSPACE can provide a simple way to obtain free space information on any volume or set of volumes in the system. Figure 1 shows part of a sample program which uses UCBSCAN and LSPACE to display space data and fragmentation index. (The entire program is available for download from the NaSCOM BBS as file NOV95001.EX1 of the TECHSUPT LIB.) One consideration when using the LSPACE macro is that it obtains an exclusive ENQ for the VTOC of the volume being examined. If the volume is unavailable, the program that issued LSPACE waits until it becomes available. If another program is holding the VTOC with a long-duration ENQ (a volume backup program, for example), then the program which issued LSPACE may wait for a long time. This has occasionally led to problems with system programs such as SMF. When collecting SMF 19 (volume statistics) records during a SWITCH of SMF recording datasets, SMF issues an LSPACE against every online volume to gather statistics. If this occurs at backup time, the SMF SWITCH command may appear to "hang" until the required volumes are available. Dataset Information LSPACE provides volume-level data, but does not provide any information about datasets. To obtain information about the datasets on a volume, it is necessary to read the DSCBs on the volume. This can be done with the older OBTAIN macro or the more modern CVAF (Common VTOC Access Facility) macros. Creating programs which use these interfaces, however, is tedious and difficult, since space data must be accumulated from all of the DSCBs which exist for each dataset. An easier-to-use facility which can provide volume information similar to that provided by LSPACE, as well as a great deal of other information, is the DCOLLECT function of IDCAMS. While DCOLLECT actually uses LSPACE to obtain volume information, it uses other facilities, including DFSMShsm, and an internal catalog management function called the Fast VTOC/VVDS Processor to obtain information about individual datasets, whether migrated or on primary DASD. DCOLLECT places the information it gathers into a dataset, which can then be read by programs requiring the collected data. SMS Information Beginning with DFSMSdfp release 1.2, DCOLLECT can also provide information about the SMS classes defined in an SMS configuration dataset. This is an important new function, because previously there was no documented facility available to users to obtain this information from within a program. ISMF could be used to get SMS information interactively, and there were interfaces within DFSMS that could perform this function, but they were available only to vendors. The IDCDOUT and ARCUTILP DSECTs in SYS1.MACLIB map the records written by DCOLLECT. Figure 2 shows a sample IDCAMS job which uses DCOLLECT to obtain information about the active SMS configuration, while Figure 3 shows a sample REXX program which is used to obtain a list of management classes for which space release has been specified. The PARSE ARG function of REXX is used to select the desired record type and to identify the fields within the record. In this case, the 'M', or management class, record is of interest. Records are also available from DCOLLECT which describe the data classes, storage classes, storage groups, SMS volume status, and the SMS base configuration. The REXX program assumes that the DCOLLECT function has already been called and that data has been written into the file. This is necessary because programs which invoke IDCAMS directly to perform DCOLLECT must be APF-authorized. Also, users who invoke the DCOLLECT function must have READ authority to the STGADMIN.IDC.DCOLLECT resource. Storage administrators in most installations have access to an extensive set of space management and monitoring tools. Often, however, these tools are too powerful, esoteric or expensive to allow most users access to them. Yet, timely and accurate storage information is often important to users outside the storage administrator's domain. One way to provide such information is to develop simple "home-grown" tools using the facilities already available within the operating system. Was this column of value to you? If so, please circle Reader Response Card No. Figure 1: Sample Code to Obtain LSPACE Data for All Online Volumes * * ISSUE UCBSCAN TO OBTAIN A COPY OF THE UCB FOR EACH VOLUME * UCBLOOP DS 0H UCBSCAN COPY, GET A UCB COPY X UCBAREA=UCBAREA, POINTER TO UCB (RETURNED) X WORKAREA=WORKAREA, WORK AREA FOR UCBSCAN X DEVCLASS=DASD, TYPE OF DEVICE TO SCAN FOR X DYNAMIC=YES INCLUDE DYNAMICALLY DEFINED DASD CH R15,=H'4' ANY MORE VOLUMES? BE RETURN IF NOT-> LTR R15,R15 SUCCESSFUL? BNZ SCANERR IF NOT->UCBSCAN ERROR SPACE LA R2,UCBAREA ADDRESS OF COPY OF UCB USING UCBOB,R2 TM UCBSTAT,UCBONLI IS THE VOLUME ONLINE? BNO UCBLOOP IF NOT-->CONTINUE WITH NEXT UCB * * ISSUE LSPACE USING THE EXPANDED MESSAGE FORMAT TO OBTAIN SPACE INFO * LSPACE UCB=(2),EXPMSG=EXPMSG,MF=I LTR R15,R15 LSPACE SUCCESSFUL? BNZ LSPERR IF LSPACE ERROR-> ...save and process volume data... * * ISSUE LSPACE USING THE DATA FORMAT TO OBTAIN ADDITIONAL INFO * LSPACE UCB=(2),DATA=LDATA,MF=I LTR R15,R15 WAS LSPACE SUCCESSFUL? BNZ ERRLSPAC IF NOT->PROCESS LSPACE ERROR LA R1,LDATA BASE ADDRESS OF RETURNED DATA USING LSPA20S,R1 ADDRESSABILITY ON RETURNED DATA ...save and process VTOC data and fragmentation index... B UCBLOOP CONTINUE WITH NEXT VOLUME * WORK AREAS AND DSECTS WORKAREA DC XL100'00' WORK AREA FOR UCBSCAN UCBAREA DS CL48 COPY OF UCB OBTAINED BY UCBSCAN EXPMSG DS CL40 AREA FOR INFO FROM LSPACE EXPMSG LDATA DS (LSPACEL)X AREA FOR INFO FROM LSPACE DATA LSPACE MF=(D,DATA) DSECT FOR LSPACE DATA AREA MAPPING LSPACEL EQU *-LSPA20S LENGTH OF LSPACE DATA AREA DASDUCB DSECT , DSECT FOR UCB MAPPING IEFUCBOB Figure 2: Sample JCL to Obtain SMS Configuration Information //IDC EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //OFILE DD DSN=USER.DCOLLECT.DATA,UNIT=SYSDA,SPACE=(CYL,(1,1)), // RECFM=VB,LRECL=644,DISP=(,CATLG) //SYSIN DD * DCOLLECT OFILE(OFILE) SMSDATA(ACTIVE) Figure 3: Sample REXX Program to Examine Management Class Information /* REXX */ ADDRESS TSO "ALLOC FI(INDD) DA('USER.DCOLLECT.DATA') SHR" EXECIO '*' 'DISKR INDD (STEM' RECORD. 'OPEN FINIS )' SAY 'LIST OF MANAGEMENT CLASSES FOR WHICH RELEASE IS SPECIFIED' DO N=1 TO RECORD.0 PARSE VAR RECORD.N , 0 DCURDW , /* XL4 RECORD DESCRIPTOR WORD */ 5 DCURCTYP , /* CL2 RECORD TYPE */ 7 RESTOFHDR , /* REMAINDER OF RECORD HEADER */ 27 DMCNAME , /* CL30 MGMT CLASS NAME */ 57 DMCUSER , /* CL8 USERID OF LAST UPDATER */ 65 DMCDATE , /* CL10 DATE OF LAST UPDATE */ 75 RESTOFMC , /* OTHER FIELDS */ 207 DMCRLF , /* XL1 PARTIAL RELEASE FLAGS */ 208 RESTOFREC /* REMAINDER OF RECORD */ IF (DCURCTYP = 'MC' & C2D(DMCRLF) >= 128) THEN SAY DMCNAME DMCUSER END