Top  Previous  Next


The STATUS() function returns information following execution of certain other statements. In many cases, this information gives details of an error condition.








The STATUS() function is used to fetch status information set by other statements as documented in their descriptions. Where the value relates to an error condition, the tokens in the ERR.H record of the SYSCOM file can be used. Use of the actual values of error status codes is discouraged.


The STATUS() function can be used any number of times to retrieve the current status value but this value may be changed by other statements. In general, the STATUS() function should be used as close as possible to the statement that set the value to be retrieved. In particular, use of CALL and EXECUTE are very likely to result in execution of statements that destroy the previous value of the STATUS() function.


There is a standard subroutine, !ERRTEXT(), that can be used to translate an error number to an equivalent text message.


See the OS.ERROR() function for a way to access operating system level error numbers.






  ABORT "Open failed : Error code " : STATUS()



This program fragment attempts to open a file and, if the OPEN fails, reports the error code.