errno--Error Return Code Variable

The PSL errno variable is set by various PSL built-in functions to indicate the reason for a failure. All functions that can potentially set errno are also required to reset the errno variable to zero and have it remain zero if the function is successful. Functions that do not set the errno variable do not reset it to zero either. This requirement validates usage styles such as the following: 

x = cat("file");
if (errno != 0)
{
# Error occurred in cat function
# examine errno value for specific error code
}

The user can also write values to the errno variable. However, there should be little cause to set errno since it is reset by all functions that set it.

Tip

The errno variable is reset to zero by many built-in functions at the start of their processing; and in some functions, clearing can occur before arguments are processed, leading to errno being cleared before being processed as an argument. Thus, when passing errno as an argument to a built-in function, BMC Software recommends that you make a copy in a temporary variable and pass the copy.

Where to go from here

Diagnosing PSL Program Errors

Was this page helpful? Yes No Submitting... Thank you

Comments