Compaktor

Compaktor, sometimes called FDRCPK, is a useful tool for managing z/OS mainframe disks (or DASD volumes as they are called in the mainframe world). FDRCPK will map out the exact file segment locations on a disk, will consolidate fragmented files into single extents, will consolidate all the free space on a volume, and will maintain system files like VTOCs (Volume Table of Contents) and VVDSs (VSAM Volume Data Set). Compaktor does not need exclusive use of a disk, it can run alongside open datasets, in which case it will do the best job it can to optimize space on a disk. You can also run Compaktor in simulate mode to see what benefit you would get before running it for real.

Compaktor has three main control statements, MAP, CPK and SIM. The default statement is SIM, to simulate an action.

Disk mapping

The MAP statement will map out the track locations on disk volumes, or from full FDR backups of disk volumes. You can either map individual volumes, or all the volumes in an SMS storage pool with a single control statement. These reports were very useful if you had a faulty track on an old disk and you wanted to know exactly which dataset was goosed. A CPK MAP will report on any VTOC errors or inconsistencies that it finds. Also the summary report provides some useful information on the state of the disks and the datasets thereon. Sample JCL is

//STEP1    EXEC PGM=FDRCPK
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN    DD *
  MAP   VOL=volser
or
    STORGRP=poolname

//STEP1    EXEC PGM=FDRCPK
//SYSPRINT DD SYSOUT=*
//TAPE1 DD DISP=OLD,
//   DSN=FDRABR.Vvolser.C1014200
//SYSUDUMP DD SYSOUT=*
//SYSIN    DD *
  MAP   FROMDD=TAPE1

Consolidating Free Space

As a general comment, modern RAID disks with a large cache capacity remove the need to worry about file fragmentation. However, free space fragmentation is very important.

If your objective is simply to release unused space inside datasets then you can do this very quickly with compactor. You specify TYPE=RLSE on the COMPAKT control statement, specify some criteria for how much space to release then run the job. Compaktor will then release free space from PS, PO, and VSAM datasets in few seconds or so and report on what it did. FASTCPK needs some existing free space on a disk before it can work, so it is worth running a free space release as a separate, pre-requisite step to a compakt.

This sample JCL will leave 10% of free space in all files for growth and release the rest, unless the file is allocated without secondary extents, in which case it is not processed

//CPKRLSE EXEC PGM=FDRCPK,REGION=0M
//SYSPRINT DD SYSOUT=*
//SYSMA    DD SYSOUT=*
//SYSSUMM  DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD *
  COMPAKT TYPE=RLSE,VOL=(TSO*,TEST*),
  PSRLSE=ALL,PORLSE=ALL,VSRLSE=ALL,
  NOSECOND=NORLSE,%FREE=10

The control statement TYPE=CPK will consolidate free space on a volume. CPK can do a number of things, including releasing free space from datasets as above, consolidating multiple extent datasets into a single extent and consolidating all the free space on a volume into one or two extents. The older version of CPK used to take a full dump of a disk then restore it back in a consolidated format. To do this, it needed exclusive use of the volume and that was not always easy to arrange. More recent versions use FASTCPK which shuffles data around on the disk to optimize it, in a similar way to the Windows Defragmentation tools. A FASTCPK of a disk should take less than 3 minutes, compared to the 10 minutes for the full CPK.

With FASTCPK you are processing active volumes. FASTCPK works and is very effective, but you need to make sure you understand the implications of working on active volumes before you start. Be aware that some system utilities read the VTOC once to find their data, then access that data directly from its track location. This means that if you move the datasets with the utility active, it loses its files and crashes. Utilities that spring to mind are IMS and CICS. I tend to be nervous about the entire utility, but it is probably just the journals that are the problem. You need to ensure that Compakt does not move these files as shown in the example below.

Some sample JCL for a compakt of a single volume

//STEP1    EXEC PGM=FDRCPK
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN    DD *
  CPK   TYPE=FASTCPK,VOL=volser,
        LOG=YES,UNABLE=IGNORE
  SELECT   DSN=CICP.**,POS=KEEP
  SELECT   DSN=HSM.**,POS=KEEP
  SELECT   DSN=MVS.**,POS=KEEP

In this example, LOG=YES means that FDRCPK will issues messages to the SYSLOG to keep the operators informed of progress. FASTCPK will always write a recovery log so you can recover automatically if the job fails. UNABLE=IGNORE means ignore recoverable errors. The SELECT DSN=..,POS=KEEP statements mean that FDRCPK will not attempt to move files fitting these patterns. This is one way to avoid unmovable datasets. By default, a FASTCPK will use DSNENQ=USE, which means that it will attempt to get exclusive use of all files on the disk, and will exclusively hold those files it gets until the end of the job. Compaktor will not try to move files that are in use. You may think that this will resolve issues with direct access files, because if those files were in use then they would be ENQd and Compaktor could not move them. However, applications like IMS and CICS have a habit of holding journal files without an ENQ, so this is not an assured way to avoid problems.

The Compaktor Unmovable Table

A more reliable way to exclude data sets is to use the COMPAKTOR unmovable table. You edit this through the ISP panels, options

I  INSTALL     - INSTALLATION AND MAINTENANCE OF FDR AND OPTIONAL PRODUCTS
5  SETCPK   - SET UP THE COMPAKTOR UNMOVABLE TABLE

From here you can add datasets or dataset groups and these will always be excluded from FDRCPK processing unless you specifically put OVERRIDE=YES on a SELECT statement. It is advisable to exclude ISPF profiles from Compaktor to avoid problems for users trying to log on by excluding DSN=*.*.ISPPROF.

Using Compaktor to fix problems with System Datasets

If you have errors in your VTOC then FDRCPK will automatically fix them. You can also use FDRCPK to increase the size of the VTOC, VVDS or VTOC Index, but you need a full dump compakt for this so you must specify DUMP=YES in your control statements

Sample JCL

//COMPAKT EXEC PGM=FDRCPK
//SYSPRINT DD SYSOUT=*
//SYSMAP   DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//TAPE1    DD UNIT=CART,DISP=(,CATLG),
//            DSN=DMB.V03904,VOL=(,,,99)
//SYSIN    DD *
 DUMP TYPE=FDR,DATA=USED,DSNENQ=USE
 CPK DUMP=YES,VOL=V03904,SIZEKEEP=0,
 VTOC=COMPAKT,OVERRIDE=YES
  SELECT ***VTOC,SIZE=40,POS=BEGIN
  SELECT DSN=SYS1.VTOCIX.**,POS=VTOC
  SELECT DSN=SYS1.VVDS.**,POS=VTOC

This job will increase the VTOC to 40 tracks, place it at the front of the disk and then place the VTOC index and the VVDS next to it.

If your VVDS is in multiple extents it can cause performance problems. You can consolidate your VVDS into a single extent with FDRCPK, but you need to use the override parameter as FDRCPK considers a VVDS as unmovable. Sample JCL would be

//COMPAKT EXEC PGM=FDRCPK
//SYSPRINT DD SYSOUT=*
//SYSMAP   DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//TAPE1    DD UNIT=CART,DISP=(,CATLG),
//          DSN=DMB.V03904,VOL=(,,,99)
//SYSIN DD *
 DUMP TYPE=FDR,DATA=USED,DSNENQ=USE
  CPK DUMP=YES,VOL=V03904,SIZEKEEP=0,
  SELECT DSN=SYS1.VVDS.**,POS=VTOC,OVERRIDE=YES

You need exclusive use of the VVDS to do this, so it is safest to vary the disk offline to any other sharing LPARS before running the job.

Simulation

It is possible and advisable to test all compakts by using the SIM statement. This will run through the compakt process and report on what action would be taken, without moving any data. The simulate a compakt you simply replace the CPK statement with SIM, so in the example above,

CPK DUMP=YES,VOL=V03904,SIZEKEEP=0,

would become

SIM DUMP=YES,VOL=V03904,SIZEKEEP=0,

Hints and tips

FDRCPK will not release space from multi-volume VSAM components. FDRCPK will only merge extents from the first volume of a multi-volume dataset.

FDRCPK will not touch Catalogs by default, if you REALLY want to start moving or releasing space from catalogs you must use OVERRIDE=YES and select them specifically. Use the F CATALOG console command to close catalogs first, and take a backup. See the ICF Catalog page for details.

FDRCPK will not release space from a VVDS.

A compactor job should not be cancelled as that could leave a disk in an unusable state. If an operator tries to cancel a compakt, a FDRW99 message will be issued to the system console. The best reply to this message is 'S', which means terminate the job at the end of the current disk. You should set automation up to reply 'S' to the message to prevent errors.

If a compaktor job is cancelled for any reason then just resubmit it and FDRCPK will automatically fix the volume. If you were compakting a group of volumes and do not know which volume was being processed when the job was cancelled. Then run an FDRCPK map job with the input command

MAP VOL=*,MAPS=SUMMARY.

and Compaktor will print a warning message for each disk that needs recovery.

A FASTCPK needs a certain amount of free space on the disk to move files around. If this free space is not available, the job will end CC=12 or with a U0888 abend depending on how your options are set. The actual CPK554E error message will be in the SYSPRINT file. This can be a bit annoying as if a disk has very little free space there is not much point in compakting it anyway. To suppress the job failure, add UNABLE=IGNORE to the CPK command and the job will run to completion without errors. A better solution is to run the COMPAKT as a two step job, the first step being free space release and the second step a fast COMPAKT. The free space release should create enough room for the COMPAKT to work.