      REM ERROR.EXIT
*PIC-LAN
*INCLUDE
*
*
*N
*
*
*
*
*
******************************************************************************
******************************************************************************
***                                                                        ***
*** (C) Copyright 1990-2005 Doug Dumitru, All Rights Reserved.             ***
***                                                                        ***
*** This program is licensed under the terms of the GNU General Public     ***
*** License, version 2.0 with attached notices.                            ***
***                                                                        ***
*** The full text can be found in the LICENSE.TXT file in the              ***
*** PLIP.BP database file (the /usr/qmweb/PLIP.BP/PLIP.BP directory).      ***
***                                                                        ***
******************************************************************************
******************************************************************************
*
90000 REM Exit cleanup routine
*
      FOR I$$$ = 1 TO DCOUNT(RESOURCE.LIST<1>,VM)
         LOOP
            PL_CLOSE RESOURCE.LIST<1,I$$$> ELSE NULL
         UNTIL ERR OR RES DO
            PL_SHORT.SLEEP
         REPEAT
         PL_DEALLOC.PLCB RESOURCE.LIST<1,I$$$> ELSE NULL
      NEXT I$$$
      LOOP WHILE RESOURCE.LIST<2> # '' DO
         PL_BCB.DEALLOC RESOURCE.LIST<2,1>
      REPEAT
*
      RETURN
*
99999 REM Error Exit routine
*
      S.ERR = ERR
      S.RES = RES
*
      GOSUB 90000
*
      IF S.ERR OR S.RES THEN
         CALL PL.ERRMSG(S.RES,S.ERR,RESULT)
         STOP 'PL-90',RESULT<1>
      END
*
      STOP
