;
                                   SAPZ.COM                                   

             Size (recs) CRC   Version    Author/Latest Issue      Disk
               2k (16)   C3BF  1.2        Howard Goldstein 10/91   Z3COM12

  1- Syntax  2- Erasing Files  3- Datestamps  4- Relog  5- Config  6- Notes   

   SAP-Z is a ZCPR3 utility that sorts and packs a disk  directory.   It reads
the disk directory tracks,  sorts them alphabetically,  erases the tracks with
E5's, and then rewrites them.   Sorting the  directory in this  manner  offers
several advantages:  (1) it allows  DIR to show an  alphabetized listing;  (2)
it minimizes problems when using UNERASE; (3) it speeds up access by directory
programs;  (4) it assists on working directly on the disk with disk  utilities
such as DU;  (5) it prevents somebody else from reading files you erased;  and
(6) it optionally erases all null  (zero-length)  files,  except  disk  labels
starting with a special tag character.

   Original (10/6/90) by Gene Pizzetta.  Based on SAP60 (7/27/87) by Irv Hoff,
original by L. E. Hughes (1977).
:1
 Syntax   SAPZ dir:

   Either a DU or a DIR specification must be used; for safety, the default DU
is not assumed.   Only the drive is significant, but if only a user specifica-
tion is given, the default drive is selected.   If run in a non-ZCPR3 environ-
ment, only a drive letter followed by a colon should be specified.

   If no drive specification is given, a brief usage message is displayed.
 WHAT IT DOES 

   SAP-Z is a program developed through the  years to clean up the disk direc-
tory tracks of a  CP/M disk.   It works equally well on tiny  floppy drives or 
gigantic hard drives with a capacity in  excess of 100 megabytes.   The direc-
tory is checked to see how many files it contains and memory is checked to see
if it is  sufficient.   (At 32 bytes per filename more than 1500 filenames can 
be easily handled with a 50k TPA, and most users have more TPA than that.)

   The filenames are read into  memory from the  directory  tracks,  then  the
entire directory track area is  cleaned off  using E5h characters.   The file-
names are sorted using the same fast sort routine in current versions of Super
Directory (SD), and then  writes  them  back  to  the  directory in alphabetic
order.

   SAP-Z can do strange things if there are garbaged  entries on the directory
tracks, so it's best to use a program like CHKDIR first and make any necessary
corrections before running SAP-Z.
:2
 ERASING FILES 

   SAP-Z erases files  with  a filetype  of "$$$" and, optionally, erases null
("zero-length") files (see "Configuration", below).

   Many people use  names on their user  areas to  identify  that directory or
disk labels for cataloging with FATCAT, MCAT, or NCAT.  These are usually null
(zero-length) files:

     -UPLOADS       0k   ; for RCP/M directory identification
     #GAMES  .123   0k   ; for catalog programs

You obviously don't want these files erased by SAP-Z,  so ZCNFG can be used to
configure SAP-Z to keep all null  files,  erase all null  files,  or erase all
null files except those beginning with  your label tag character (see "Config-
uration", below).
:3
 DATE STAMPED FILES 

   SAP-Z preserves DateStamper file date stamps.  These routines were added by
Bridger Mitchell of Plu*Perfect  Systems.   After the  directory is sorted and
written back to the  directory  tracks,  the !!!TIME&.DAT  file is  sorted and
rewritten also, so all date stamps are kept in the right order.
:4
 RELOGGING 

   SAP-Z no longer requires  calling  RELOG  or  DISKRST  to reset hard disks.
This is done using function 37 in a manner that is safe even under DRI's BDOS.
:5
 CONFIGURATION - 1/2 

   SAP-Z can be used without alteration on any size  floppy or hard drive.  It
is intended only for a CP/M 2.2 compatible BIOS.   The program will abort with
a message if it run under Z3PLUS.

   Two configuration options are  available and may be set using ZCNFG and the 
SAPZnn.CFG file.   Do not change the  name of the CFG file.   The name ensures
that ZCNFG will be  able to find the correct  configuration  file  even if the
name of SAP-Z is changed.

   The first  configuration  option  determines  whether null  files  will  be
erased.  By default null files are left alone.   A "YES" (non-zero value) here
allows them to be erased.
 CONFIGURATION - 2/2 

   The second  configuration  option  has no  effect  unless the  first option
(above) is set to "YES".  The option sets the tag character.   The tag charac-
ter is the first  character of disk  labels,  such as those used by cataloging
programs.   This character is usually "-" (2Dh), "#" (23h),  or "!" (21h).  If
this option is configured to a non-zero value, disk labels beginning with that
value will not be erased, even if Option 1 is "YES".  If you don''t want disk'
labels preserved, make this option null (00h).
:6
 SAPZ Notes - 1/2 

   a. Vs 1.2 updates (9/27/91, Howard Goldstein):
      - Converted to Zilog mnemonics.  
      - Enlarged stack to  eliminate  strange  behavior  reported  by  various
        users.  
      - Eliminated ZCPR3 requirement.  
      - Fixed treatment of S2 byte for compatibility  with  ZSDOS' larger file
        capacity.  
      - Shortened and cleaned up code.  
      - Simplified RELOG routine and  moved  initial disk reset to before disk
        select.

   b. Vs 1.1 updates (10/13/90, Gene Pizzetta):
      - Added relogging.   Under CP/M  and ZRDOS all drives are relogged using
        both functions 37 and 13.   Under  ZSDOS and  ZDDOS only the  specific
        drive is relogged using function 37.
 SAPZ Notes - 2/2 

   c. Vs 1.0 updates (10/06/90, Gene Pizzetta):
      - Based on SAP v60.  For ZCPR3 only.  
      - Now requires drive spec, or gives usage message.  
      - Accepts DU or DIR form, but only drive is significant.  
      - Now uses Z80 opcodes, including relative jumps.  
      - Changed from absolute to relocatable code, and added version 4 library
        routines.  
      - Made configurable with ZCNFG.
