[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Introduction

 Fundamental to the disk functions

 Fault tolerance and more

     One of the biggest problems in stable application development is how to
     handle errors.  Errors that occur during hard or floppy disk operations
     are especially frustrating.  You may also encounter critical errors,
     which disable the program or operating system.  The result, known to all
     CA-Clipper programmers, are the DOS error choices:  (A)bort, (R)etry,
     (I)gnore.

 Avoiding Errors

     Error trap functions allow you to react to this type of error, but a
     strategy to avoid them completely is better.  Therefore, CA-Clipper
     Tools includes functions to make it easier to handle floppy and hard
     disk errors.

 Backup Systems

     Backup systems, another component of the CA-Clipper application, are
     also discussed in this chapter.  The recursive FILESEEK() system, which
     allows you to format disks with DISKFORMAT(), is particularly useful.
     Complete directories can be scanned recursively, and queries regarding
     detailed information for every file can be made.  The ideal time to
     carry out this process is during source and target drive back ups,
     because only the information that has changed is copied.

     To avoid the annoying and not particularly fault-tolerant "RUN FORMAT",
     you can format the file disks directly from the application in all
     commonly available formats.  Since the control UDF for DISKFORMAT() uses
     a concept similar to DBEDIT(), you can display the format procedures on
     the screen as desired.

     You can also determine a good deal of varied information about disk
     drives, files, and other things.  This information far exceeds that of
     the FILESEEK() system.

 File Attributes

     Following is the coding for each function where a file can be
     designated:

     Table 1:
     ------------------------------------------------------------------------
     Value   Symb. constants     Assigned attribute
     ------------------------------------------------------------------------
     0       FA_NORMAL
     1       FA_READONLY         READ ONLY
     2       FA_HIDDEN           HIDDEN
     4       FA_SYSTEM           SYSTEM
     8       FA_VOLUME           VOLUME
     16      FA_DIRECTORY        DIR
     32      FA_ARCHIVE          ARCHIVE
     ------------------------------------------------------------------------

     If multiple attributes are implemented for a file, then the table
     values are added accordingly.  For example, if the HIDDEN and SYSTEM
     attributes are implemented, the function must pass a 6 (2 + 4) as the
     attribute mask.

     All file attributes do not behave the same.  To initiate a file into the
     process, you must explicitly specify the HIDDEN, SYSTEM, VOLUME and DIR
     attributes.  However, if either no attribute, R/O, or ARCHIVE is
     implemented with a file, it does not matter which value is passed.
     These rules for attribute handling are grounded in DOS, which compares
     the specified value with the actual file attributes in this way.  Since
     in some circumstances this may lead to problems, the FILESEEK() function
     allows you to switch on an additional EXACT ATTRIBUTE MATCHING.

 Share Modes

     For DOS version 3.0 or higher, if a function uses the DOS OPEN FILE call
     internally, it must pass a share mode.  This way, one station determines
     how all other stations in the network can access the open file. This is
     valid for as long as the file remains open.  The following variations
     exist:

     Table 3:  Share Mode
     ------------------------------------------------------------------------
     Code    Symb. constants     Share Modes
     ------------------------------------------------------------------------
     0       SHARE_COMPAT        Compatibility mode.  Here, DOS or the
                                 network software itself, determines the
                                 share mode.  In Novell networks, the
                                 SHAREABLE attribute plays an important role
                                 in this relationship.
     1       SHARE_EXCLUSIVE     Both read and write by other programs are
                                 locked out
     2       SHARE_DENYWRITE     Write by other programs are locked out
     3       SHARE_DENYREAD      Read by other programs are locked out
     4       SHARE_DENYNONE      Not locked.  Read and write by other
                                 programs is allowed
     ------------------------------------------------------------------------

     With the basic setting, all files are opened in the compatibility mode
     (relating to older DOS).  As a rule, the share mode depends on file
     attributes or the network software setting.

     Also in this chapter is the SETSHARE() function, which determines the
     share mode that enables all CA-Clipper Tools functions to open a file.
     CA-Clipper commands or functions are not affected in any way.

 CSETSAFETY()

     Use the CSETSAFETY() function as a safety switch to protect existing
     files from unwanted overwriting during file operations with CA-Clipper
     Tools functions.  You will find this function in the chapter on Switches
     and Status Information, since it concerns all CA-Clipper Tools file
     operations.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson