AOH :: USESHARE.TXT

Using SHARE




Now, Now, Don't Fight Over Data...It's Nice to Share
====================================================

Use the SHARE command to protect files and disks from hidden data demons.

By: Chris DeVoney (PC/Computing)

Picture The Three Stooges.  Picture Moe and Curly trying to assist a damsel in 
distress.  Moe grabs one sleeve of here mink coat, Curly latches onto the 
other.  A $5000.000 garment is now two furry dish towels.  Under certain 
conditions, this scneario can be re-enacted on your PC when two programs 
wrestle for the same file and ruin your data.

The DOS SHARE command prevents this.  SHARE is typically employed to keep 
network users from accessing the same file simultaneously.  But anyone using 
TSR's that write to files (Borland's Side Kick, for example, or any version of 
Windows) needs SHARE.  In a worst-case senario, you're working with an 
application, you invoke a TSR and both programs try to write to the current 
file.  In the process, the file is damaged and your data is lost.

If you use DOS 4.0 in combination with hard disk partitions larger than 32MB, 
you also need SHARE.  The command prevents disasters caused by programs that 
employan arcane method of file access, one that relies on file control blocks 
(FCB's).  Under the right conditions, FCB's can destroy data or randomly write 
data to a different file.

An FCB is a block of memory set aside by the program.  It contains information 
that allows a program to communicate with DOS about a file.  The CONFIG.SYS 
command FCBS=, like its replacement, the FILES= command, regulates how many 
files a program can open at once.  Some programs require you to increase this 
number.

Many popular programs still employ FCB's, including Side Kick, Helix's 
HeadRoom and applications such as Ashton-Tate's dBASE III Plus.  Other 
programs don't tell you how they manage files, creating hidden danger spots on 
your drive.

Essentially, SHARE will help anyone who runs non-Windows DOS programs through 
Windows or uses a network, ill behaved TSR's or oversized partitions created 
with DOS 4.0.

Ways to Share
=============

SHARE prevents data disasters by double-checking every DOS read and write 
operation.

If you use any DOS version from 3.1 through 3.31, just add SHARE to your 
AUTOEXEC.BAT so that it's installed when you boot up.  But SHARE requires 5K 
of memory, so if you use memory hogs like Xerox Venture Publisher, you may not 
want SHARE loaded all the time.  In this case, enter it manually at the DOS 
prompt when memory isn't at such a premium.

SHARE's default settings suffice for most situations.  Use the switches, as 
described in the following Dossier, when running several programs at once, 
either by mutitasking or by using more than one TSR and an application 
simultaneously.  In these two cases, change the locks swich to 30.  If you use 
long subdirectory path names, change the name-space switch (see Dossier) to 
4096, like so:

SHARE /F:4096 /L:30

FCB's become important as soon as you invoke SHARE.  The FCBS= directive in 
CONFIG.SYS determines the number of open files using FCB's that DOS will 
allow.  If you're using SHARE with DOS 3.0 through 3.31, add this line to your 
CONFIG.SYS:

FCBS=16,8

DOS 4.0 automatically loads SHARE if you've created a hard disk partition 
larger than 32MB with DOS 4.0 and either SHARE is in the root directory or you 
have a SHELL statement in your CONFIG.SYS file that points to any directory 
that contains both COMMAND.COM and SHARE.EXE.  For example, if your CONFIG.SYS 
contains the following statement and SHARE is in your DOS directory, SHARE 
will be automatically installed:

SHELL=C:\DOS\COMMAND.COM

When neither of those conditions exists, load SHARE as described for DOS 
versions 3.0 through 3.31.  If you use DOS 4.0 with any of SHARE's switches, 
enter the INSTALL directive in your CONFIG.SYS file.  This line loads SHARE 
and allots 3K for filenames:

INSTALL=C:\DOS\SHARE.EXE /F:3072

If you use Quarterdek's QEMM-386, Qualitas's 386 to the Max Professional or 
All Computers' All Charge 386, load SHARE in high memory.  If you use the 
INSTALL= directive for this task, DOS will return the message "Error in 
CONFIG.SYS."  Ignore it.

With DOS 4.0, you don't have to add the FCBS= command; your system includes 
adequate default settings.


DOSSIER
=======

SHARE Usage:

SHARE [/F:name-space] [/L:locks]

Name-space is the amount of space for filenames. (The default is 2048)
Locks is the number of files that can be used simultaneously. (Default is 20)
Items in brackets are optional. (Don't type the brackets)

Examples:

To establish locks for 30 files, add the following to AUTOEXEC.BAT or enter at 
the DOS prompt:

SHARE /L:30

For best results when you want to load SHARE automatically with DOS 4.0 or 
later, disregard the command above and add the following line to CONFIG.SYS:

INSTALL=C:\DOS\SHARE.EXE /L:30

=============================================================================
Chris DeVoney is a consutant and the author of several books, including DOS 
Tips, Tricks and Traps.


Make REAL money with your website!

The entire AOH site is optimized to look best in Firefox® 2.0 on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2008 AOH
We do not send spam. If you have received spam bearing an artofhacking.com email address, please forward it with full headers to abuse@artofhacking.com.