hanyak@garnet.bucknell.EDU ("M.E. Hanyak") (12/30/88)
Can anyone assist me on the use of PFM_$CLEANUP? I'm using it in a menu-driven program to trap either runtime errors or <CTRL/Q>. My intent is to allow the user to use <CTRL/Q> to get from anywhere in the menu tree back to the top-level menu. However, I am running into the following problem. Whenever the user types <CTRL/Q> in respond to a menu prompt, an interrupt occurs in the middle of a FORTRAN READ and the cleanup handler functions properly, but when the next READ is down the following error occurs: ?(ftnlib) Using Unit 5 connected to input pad for formatted sequential access - recursive use of FORTRAN IO (library/IO) How do I prevent this error from being issued? A synopsis of my cleanup handler code is given below: PROGRAM MAIN C INTEGER*4 HANDLR(2) INTEGER*4 STATUS CHARACTER REPLY*80 C C: HANDLR - unique identifier for the cleanup handler. C: STATUS - status code returned by cleanup handler. C: REPLY - the reply line supplied by the user. C C C: Mark the next statement to which control passes C: when either the <CTRL/Q> sequence is hit or a C: runtime error happens. C: STATUS = PFM_$CLEANUP (HANDLR) C C: Start the BUTS program. This is the normal startup. C IF (STATUS .EQ. PFM_$CLEANUP_SET) THEN CALL BUTS C C: Execute cleanup by closing the following files C: before proceeding with the BUTS menu prompt: C: C: Unit 1 - a BUTS user library file. C: Unit 2 - a BUTS public library file. C: Unit 29 - a TAKE file of input responses. C: Unit 98 - a read/write temporary file. C: Unit 99 - a read/write temporary file. C: C: This step only occurs when either <CTRL/Q> is hit C: or a runtime error happens. C ELSE CLOSE ( UNIT = 1 ) CLOSE ( UNIT = 2 ) CLOSE ( UNIT = 29 ) CLOSE ( UNIT = 98 ) CLOSE ( UNIT = 99 ) C CALL PFM_$RESET_CLEANUP (HANDLR, STATUS) C C C: Ask user if he or she wishes to continue. C PRINT* CALL AREPLY (1, 'Continue menu prompts (y/n)...? ', REPLY) C IF (REPLY(1:1) .EQ. 'Y') CALL DRIVER ENDIF C END Thanks in Advanced, Mike Hanyak Chem. Eng. Dept. Bucknell University Lewisburg, PA