Returns, as an INTEGER value, an ABL error code that indicates whether an execution error occurred during the last OS-APPEND, OS-COPY, OS-CREATE-DIR, OS-DELETE, OS-RENAME or SAVE CACHE statement.
The following procedure prompts the user to enter a file to delete, attempts to delete the file, and then calls the OS-ERROR function to check for an execution error. If an error occurs, the procedure branches based on the error number and responds accordingly.
r-os-err.p
DEFINE VARIABLE err-status AS INTEGER NO-UNDO. DEFINE VARIABLE filename AS CHARACTER NO-UNDO FORMAT "x(40)" LABEL "Enter a file to delete". UPDATE filename. OS-DELETE VALUE(filename). err-status = OS-ERROR. IF err-status <> 0 THEN CASE err-status: WHEN 1 THEN MESSAGE "You are not the owner of this file or directory.". WHEN 2 THEN MESSAGE "The file or directory you want to delete does not exist.". OTHERWISE DISPLAY "OS Error #" + STRING(OS-ERROR,"99") FORMAT "x(13)" WITH FRAME b. END CASE. |
Error number | Description |
---|---|
0 | No error |
1 | Not owner |
2 | No such file or directory |
3 | Interrupted system call |
4 | I/O error |
5 | Bad file number |
6 | No more processes |
7 | Not enough core memory |
8 | Permission denied |
9 | Bad address |
10 | File exists |
11 | No such device |
12 | Not a directory |
13 | Is a directory |
14 | File table overflow |
15 | Too many open files |
16 | File too large |
17 | No space left on device |
18 | Directory not empty |
999 | Unmapped error (ABL default) |