C$RERR
The C$RERR library routine retrieves extended information about the status of a file after an I/O operation.
Syntax:
 CALL "C$RERR" USING extendStat 
                    [textMessage]
Parameters:
extendStat
any alphanumeric data item
Specifies the extended file status.
 
The first two characters of the extended file status are identical to the normal FILE STATUS value returned by the runtime for a file operation. The last two characters further clarify the reason for the particular FILE STATUS value. The values used here are listed in File Status Codes.
 
In thin client environment, having iscobol.file.lock_manager=com.iscobol.as.locking.InternalLockManager, when a lock timeout error occurs, extendStat is set to a concatenation of the file status and the thread ID of the client holding the lock. The thread ID is stored in extendStat(3:). Note that a thread ID can be up to 10 digits long.
If a "file locked" error occurs during a OPEN I-O WITH LOCK due to another client that opened the file for input, then TID=0 is returned, because the OPEN INPUT doesn’t put a real lock and it's also possible to open for input the same file from many clients, so the runtime doesn’t know which TID to return.
 
Due to the variable lenght of this value, you should consider to define this parameter as PIC X ANY LENGTH.
textMessage
any alphanumeric data item
Optional. It contains a text message coming from the host system if available.
Examples:
Example - Display extended information on a file error
*> define crerr-status and rerrname as pic x(n)
 
display-file-error.
  call "C$RERR"     using crerr-status
  call "C$RERRNAME" using rerrname
 
  display message "Error " file-status crerr-status " on " rerrname