1 FRAG

  Invokes a program to display fragmentation statistics of a disk or
  set of files. The following sets of statistics can be shown:

  a) Fragmentation of allocated blocks of a file or group of files.
  b) Fragmentation of allocated blocks of a whole disk.
  c) Fragmentation of free blocks of a whole disk.

  It is also possible to combine reports b) and c).

  Format:

  $ FRAG [/FILE] infile [/qualifiers]
  $ FRAG /DEVICE disk [/qualifiers]
2 More_about_FRAG
  Yes, yes, I know: the last thing you need is another disk fragmentation
  diagnostic. And it's called FRAG as well.

  I do not propose to join in the general discussion about disk fragmentation.
  There are lots of packages on the market which claim to defragment your
  disks in the background. All of them claim to be the only one which does
  this safely. Does this tell you something ?

  I am personally opposed to disk defragmenters, on the grounds that the
  performance improvements they actually realise is minimal. Obviously if
  your three largest, most critical database files are split into 20000
  fragments each, then it will pay you to defragment them. But in general,
  "disk fragmentation" means only a microscopic overhead for typical users
  of sequential files.

  Generally, the few files you need defragmenting are large, valuable, and
  complex. They may well be databases that are on-line all day. FOCUS(TM) is
  particularly bad at fragmenting its databases. Because the files are large,
  complex, and valuable, however, you may want to think twice before you let
  an on-line defragmenter loose on them (INGRES files are a nightmare). Even
  off-line defragmenters can give you hassle if the system crashes. So you
  make a backup beforehand. Since the critical files are about 75% of your
  disk, you might as well make an image backup. And rolling that back from
  tape will defragment your disk...

  Use FRAG to see what the fragmentation state of your disk really is. You can
  analyse the free space on the disk (this tells you how much trouble VMS
  takes to find the block of the size you need), the occupied space (this
  gives you an indication of how fragmented the files are), or individual files
  (zoom in to see which files could benefit from defragmentation, possibly
  as simply as COPY/CONTIGUOUS). Maybe it will save you the price of a disk
  defragmenter (or the consequences of using the wrong one...)

  FRAG opens the INDEXF.SYS and BITMAP.SYS files read-only, so it does not
  attempt to modify your disks at any stage. You need SYSPRV (or enough other
  privileges to allow you to access the top-level files on a volume). If you
  have linked FRAG with /NOTRACE, you might consider installing it with
  privilege, so that everyone can run it. Then again, you might not.

  This program is FREE. Users of PC software may be familiar with a phenomenon
  called shareware, whereby you pay for software after you use it. I do not
  exclude the possibility that this program may evolve into shareware or even
  prepaid software at some future time, and I reserve all rights to the
  software. You may copy it freely and give it away to anybody you like,
  as long as this text, and the equivalent notices in the sources, remain
  intact. If you find FRAG so useful that you feel an urge to pay for it,
  send $10 to your favourite charity.

  You should have received the C source of FRAG. If you have access to VAX C,
  you are encouraged to review the program and compile it yourself before
  using it, not because I think that the software is so wonderful you must
  read it, but because this is a good way to protect yourself against some
  of the less savoury characters out there.

  If you have any questions, comments, or bugs to report, please contact:

         Nick Brown
         c/o Albert van Dalsumlaan 119
         3584 HC Utrecht
         The Netherlands

  Please do not send tapes in the first instance as the above address is only
  for forwarding of letters; anything heavier will be thrown away. If you
  report a fixable bug I will endeavour get in touch with you to arrange a fix.
  If you require a reply, please send an International Reply Coupon; this is
  a kind of stamp that works anywhere, available from any Post Office. Send one
  that is valid for anywhere in the world, since I don't know where I'm going
  to be.

  Naturally, since this is free software, I accept no responsibility for any
  loss or damage to any data. Nor do I offer any warranty that this software
  works as described under any particular circumstances. In other words,
  no price, no guarantee.

  Quick advertisement: my other masterpieces, XCOPY (enhanced file copying),
  and WHO (a sort of super network-wide SHOW USERS/SYSTEM/etc), should also
  be available somewhere in the vicinity of this program. Please feel free
  to use and/or distribute them.
2 Parameters
Infile
 Infile

  The file, or wildcard filespec, for which a fragmentation report is to
  be produced.

Disk
 Disk

  In the case of FRAG /DEVICE, the name of the disk to be checked.
2 Qualifiers

/ALLOCATED_BLOCKS
 /ALLOCATED_BLOCKS (default)
 /NOALLOCATED_BLOCKS

  In combination with /DEVICE, specifies that the report should include
  statistics about allocated blocks on the disk. If /FREE_BLOCKS is
  specified, and the allocated block report is also required, then
  /ALLOCATED_BLOCKS must be explicitly specified.

/DETAIL
 /DETAIL[=(option[,...])]
 /NODETAIL

  Specifies whether a detail record is to be output for each file with
  at least the specified number of fragments (see /MIN_FRAGMENTS).
  If options are specified, they increase the amount of data in the
  detail record, as follows:

         DIRECTORY                       directory name
         FILE_ID                         file identifier (a,b,c)
         BLOCKS                          file allocation in blocks
         ALL                             all options

  If no options are specified (the default), only the file name and
  number of fragments are listed.

  The default is /DETAIL if /FILE is specified, and /NODETAIL if
  /DEVICE is specified.

/DEVICE
 /DEVICE

  Specifies that the parameter is the name of a disk, or the file
  specification of an index file (normally device:[000000]INDEXF.SYS).
  If /DEVICE is specified, FRAG reports on the whole disk.

  /DEVICE and /FILE are mutually exclusive. The default is /FILE.

/FILE
 /FILE

  Specifies that the parameter is the name of a file, or a wildcard
  referring to a number of files.

  /FILE and /DEVICE are mutually exclusive. The default is /FILE.

/FREE_BLOCKS
 /FREE_BLOCKS
 /NOFREE_BLOCKS (default)

  In combination with /DEVICE, specifies that the report should include
  statistics about free blocks on the disk.

  The fragmentation factor is the number of free extents (groups of
  contiguous clusters) divided by the total number of free clusters,
  expressed as a percentage. This calculation is shamelessly copied from
  the fragmentation utility of DISKIT(TM).

/MIN_FRAGMENTS
 /MIN_FRAGMENTS[=number]

  Specifies the minimum number of fragments that must exist in a file
  before it will appear in a detail record. This number is also used
  to partition the allocated block summary report.

  The default is 2.

/OUTPUT
 /OUTPUT[=file-spec]

  Controls where the output of the command is sent.

  The default is SYS$OUTPUT.

/SUMMARY
 /SUMMARY (default)
 /NOSUMMARY

  Specifies, in the case of /FILE, or /DEVICE with /ALLOCATED_BLOCKS, whether
  a summary record is to be output, summarising statistics for all the files
  scanned by FRAG.

/TOP_EXTENTS
 /TOP_EXTENTS[=number]
 /NOTOP_EXTENTS (default)

  Requests, after a /FREE_BLOCKS report, a summary of the largest free
  extents on the disk. If /TOP_EXTENTS is given without a value, the
  default is 10. The maximum is 50.

  If this qualifier is omitted or explicitly negated, no summary of the
  largest free extents is produced.
2 Examples

  1.   $ FRAG *.* /NOSUMMARY

  Shows all files in the local directory with more than one fragment,
  without a summary.

  2.   $ FRAG /DEVICE DUA2 /MIN_FRAGMENTS=10 /OUT=DUA2.LIS

  Produces, in the file DUA2.LIS, a summary of all files on DUA2.
  with a split into those with 9 or less, and 10 or more fragments.

  3.   $ FRAG /DEVICE DUA2 /FREE_BLOCKS

  Produces a summary of free block fragmentation on DUA2.
