Home Web Design Programming Fairlight CMI Soap Box Downloads Links Biography About... Site Map

The Holmes Page DOS Error Message Function

CA-Clipper Opportunities Tips and Tricks Networking Internal Errors Source Code CA-VO



BACK TO
CA-CLIPPER
TIPS & TRICKS

When CA-Clipper applications are unable to open a file, the reason can be determined by checking the built-in ferror() or doserror() functions. These functions return the DOS error number as an integer numeric value. 
The ferror() function returns the error number from the last low-level (binary) file operation. The low-level functions include fclose(), fcreate(), ferase(), fopen(), fread(), freadstr(), and frename(). If there is no error, ferror() returns zero. 
The doserror() function returns the error number from various other file operations, like opening a DBF file (with use filename) or an index (set index to filename). Specifically, the doserror() value is set by CA-Clipper when it creates the runtime error object which is later passed to the error handler. The default error handler displays an alert box with the choices Quit, Retry, and Default. If the failed operation has no associated DOS error, then doserror() returns zero. 
Since both of these functions return only a number, the error can often be unclear. The DosErrMsg() function (see below) converts the number into a more readable message. 
Notice that this so-called "DOS" error list includes errors that occur in the network shell, as well as memory and printer errors. The DOS error is also properly reported to CA-Clipper programs running under the various versions of Windows. 

*-----------------------------------------------------------
* Function   | DosErrMsg
* Purpose    | Return the message for a DOS error.
* Parameters | pnErr   - the DOS error number
* Returns    | cResult - the message
*-----------------------------------------------------------
function DosErrMsg ( pnErr )
   local cResult

   do case
      case pnErr == 1
         cResult := "Invalid function number"
      case pnErr == 2
         cResult := "File not found"
      case pnErr == 3
         cResult := "Path not found"
      case pnErr == 4
         cResult := "Too many open files (no handles left)"
      case pnErr == 5
         cResult := "Access denied"
      case pnErr == 6
         cResult := "Invalid handle"
      case pnErr == 7
         cResult := "Memory control blocks destroyed"
      case pnErr == 8
         cResult := "Insufficient memory"
      case pnErr == 9
         cResult := "Invalid memory block address"
      case pnErr == 10
         cResult := "Invalid environment"
      case pnErr == 11
         cResult := "Invalid format"
      case pnErr == 12
         cResult := "Invalid access mode"
      case pnErr == 13
         cResult := "Invalid data"
      case pnErr == 15
         cResult := "Invalid drive"
      case pnErr == 16
         cResult := "Attempt to remove current directory"
      case pnErr == 17
         cResult := "Not same device"
      case pnErr == 18
         cResult := "No more files"
      case pnErr == 19
         cResult := "Attempt to write on protected disk"
      case pnErr == 20
         cResult := "Unknown unit"
      case pnErr == 21
         cResult := "Drive not ready"
      case pnErr == 22
         cResult := "Unknown command"
      case pnErr == 23
         cResult := "Data error (CRC)"
      case pnErr == 24
         cResult := "Bad request structure length"
      case pnErr == 25
         cResult := "Seek error"
      case pnErr == 26
         cResult := "Unknown media type"
      case pnErr == 27
         cResult := "Sector not found"
      case pnErr == 28
         cResult := "Printer out of paper"
      case pnErr == 29
         cResult := "Write fault"
      case pnErr == 30
         cResult := "Read fault"
      case pnErr == 31
         cResult := "General failure"
      case pnErr == 32
         cResult := "Sharing violation"
      case pnErr == 33
         cResult := "Lock violation"
      case pnErr == 34
         cResult := "Invalid disk change"
      case pnErr == 35
         cResult := "FCB unavailable"
      case pnErr == 36
         cResult := "Sharing buffer overflow"
      case pnErr == 38
         cResult := "Unable to complete file operation"
      case pnErr == 50
         cResult := "Network request not supported"
      case pnErr == 51
         cResult := "Remote computer not listening"
      case pnErr == 52
         cResult := "Duplicate name on network"
      case pnErr == 53
         cResult := "Network name not found"
      case pnErr == 54
         cResult := "Network busy"
      case pnErr == 55
         cResult := "Network device no longer exists"
      case pnErr == 56
         cResult := "NetBIOS command limit exceeded"
      case pnErr == 57
         cResult := "Network adapter hardware error"
      case pnErr == 58
         cResult := "Incorrect network response"
      case pnErr == 59
         cResult := "Unexpected network error"
      case pnErr == 60
         cResult := "Incompatible remote adapter"
      case pnErr == 61
         cResult := "Print queue full"
      case pnErr == 62
         cResult := "No space for print file"
      case pnErr == 63
         cResult := "Print file deleted (not enough space)"
      case pnErr == 64
         cResult := "Network name deleted"
      case pnErr == 65
         cResult := "Access denied"
      case pnErr == 66
         cResult := "Network device type incorrect"
      case pnErr == 67
         cResult := "Network name not found"
      case pnErr == 68
         cResult := "Network name limit exceeded"
      case pnErr == 69
         cResult := "NetBIOS session limit exceeded"
      case pnErr == 70
         cResult := "Temporarily paused"
      case pnErr == 71
         cResult := "Network request not accepted"
      case pnErr == 72
         cResult := "Print or disk redirection paused"
      case pnErr == 80
         cResult := "File already exists"
      case pnErr == 82
         cResult := "Cannot make directory entry"
      case pnErr == 83
         cResult := "Fail on INT 24H"
      case pnErr == 84
         cResult := "Too many redirections"
      case pnErr == 85
         cResult := "Duplicate redirection"
      case pnErr == 86
         cResult := "Invalid password"
      case pnErr == 87
         cResult := "Invalid parameter"
      case pnErr == 88
         cResult := "Network device fault"
      case pnErr == 89
         cResult := "Function not supported by network"
      case pnErr == 90
         cResult := "Required system component not installed"
      otherwise
         cResult := "<Unknown DOS error: " + ;
                    alltrim(str(pnErr)) + ">"
   endcase

return cResult


Home Web Design Programming Fairlight CMI Soap Box Downloads Links Biography About... Site Map

Site Map Send comments about this site to Greg at gregh@ghservices.com
All pages copyright © 1996-1999 GH Services™   Created 1997/09/20   Last updated 1999/09/30
All trademarks contained herein are the property of their respective owners