When I was first learning about subprocedures I wrote one to deal with record locks. It will pop up a screen and tell the user who has a lock on the file. If the status code is not 01218 it pops up a different screen to tell the user that an unknown error has occurred and to contact the IT department. Here are the programs and screens. Bear in mind that I wrote this about five years ago. I am sure that there are at least a half dozen ways that this code could be improved upon. ;-) In your main program set up the SDS like so: **************************************************************** * SYSTEM STATUS DATA STRUCTURE. * **************************************************************** D SDS D STSERRMSG 91 170 Use the (E) extender on the opcode. If an error is found, execute the subroutine to determine the type of error and display the appropriate screen. C READ(E) file **************************************************************** * PROCESS RECORD LOCK. * **************************************************************** C IF %ERROR C EXSR CHECK4LOCK *************************************************************** * SUBROUTINE TO PROCESS RECORD LOCKS. * *************************************************************** C CHECK4LOCK BEGSR C IF %STATUS = 01218 C CALLP RCDLOCKR(STSERRMSG) C ELSE C CALLP UNKNOWNERR C ENDIF C ENDSR Terry Anderson