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 successfull. Functions that don’t 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 function 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. Hence, 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.