advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ERDEV, ERDEV$ Functions Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 ERDEV
 ERDEV$
 
 Usage Notes
   ■ ERDEV is set by the critical error handler (interrupt 24H) when MS-DOS
     detects a critical MS-DOS call error from a character or block device.
     It also is set by a timeout error on a communications port.
 
   ■ For block device errors, bits 0 - 7 (the low byte) of ERDEV contain the
     MS-DOS error code. Bits 8 - 15 (the high byte) contain the following
     device-attribute information:
 
         Bit(s)     Value     Meaning
         ══════     ═════     ══════════════════════════════════════════════
         0 - 7      xxH       Contains MS-DOS error code xxH
         8          0         Read operation
                    1         Write operation
         9 - 10               Indicates the affected disk area:
                    00        • MS-DOS
                    01        • File allocation table
                    10        • Root directory
                    11        • Files area
         11(1)      0         Fail response not allowed
                    1         Fail response allowed
         12(1)      0         Retry response not allowed
                    1         Retry response allowed
         13(1)      0         Ignore response not allowed
                    1         Ignore response allowed
         14                   Not used
         15         0         Always zero
         ───────────────────────────────────────────────────────────────────
         (1) Bits 11, 12, and 13 apply only to MS-DOS version 3.1 and later
 
   ■ For character device errors, bits 0-7 contain the MS-DOS error code. The
     upper bits are not significant.
 
   ■ For COM timeout errors, ERDEV returns a value indicating which option
     in the OPEN COM statement is experiencing the timeout. Therefore, it's
     not necessary to break ERDEV into low and high bytes:
 
          ERDEV Value     OPEN COM Option Timeout
          ═══════════     ══════════════════════════════════════════════════
          80H             CS (CTS timeout)
          81H             DS (DSR timeout)
          82H             CD (RLSD timeout)
 
     See: OPEN COM Statement
 
   ■ Because ERDEV and ERDEV$ return meaningful information only after an
     error, they usually are used in error handlers specified by an ON ERROR
     statement. See: ON ERROR Statement
 
   ■ ERDEV and ERDEV$ cannot be used on the left side of an assignment.
 
   ■ The following example extracts the low and high bytes from the ERDEV
     value. DosErrCode stores the block or character device error code, while
     DevAttr stores the block device attribute information:
 
         DosErrCode = ERDEV AND &HFF             'Low byte of ERDEV
         DevAttr    = (ERDEV AND &HFF00) \ 256  'High byte of ERDEV