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.
OS-ERRORThe 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.
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 THENCASE err-status:WHEN 1 THENMESSAGE "You are not the owner of this file or directory.".WHEN 2 THENMESSAGE "The file or directory you want to delete does not exist.".OTHERWISEDISPLAY "OS Error #" + STRING(OS-ERROR,"99") FORMAT "x(13)"WITH FRAME b.END CASE.
![]()
Use this function immediately following an OS-APPEND, OS-COPY, OS-CREATE-DIR, OS-DELETE, OS-RENAME, or SAVE CACHE statement to determine whether an error occurred during the statement’s execution. If you do not, the next use of one of these statements overwrites the previous error code.
![]()
Table 49 lists the ABL error codes that the OS-ERROR function can return.
Table 49:
© 2012 Progress Software Corporation and/or its subsidiaries or affiliates. |