 SUBROUTINE tempfile_F (ifile, honoff)
! ... Manages a temporary file .........................................
 CHARACTER h, honoff*(*)
 h = 'F'; CALL temp_file (h, ifile, honoff)
 RETURN
 ENTRY tempfile_U (ifile, honoff)
 h = 'U'; CALL temp_file (h, ifile, honoff)
 RETURN
 END !END!

 SUBROUTINE temp_file (hformatted, ifile, honoff)
! ... Manages a temporary file .........................................
 CHARACTER hformatted, honoff*(*), form*11, htime*10
 CHARACTER (LEN=255) :: hbuffer, scratch='/tmp/1038_'
 INTEGER getpid ! GETPID
 IF (honoff == 'on') THEN; CALL DATE_AND_TIME (TIME=htime)
! ... 'ifile' becomes 'getpid'
!!!    WRITE (hbuffer, *) GETPID(); READ (hbuffer, *) ifile
    ifile = getpid()
    ifile = MAX(101, ifile)
    WRITE (hbuffer, *) htime(:6)//htime(8:); READ (hbuffer, *) itime
    ifile = ifile + itime
    WRITE (hbuffer, *) ifile
    scratch = TRIM(scratch) // TRIM(ADJUSTL(hbuffer))
    form = 'UNFORMATTED'; IF (hformatted == 'F') form = 'FORMATTED'
    OPEN (ifile, FILE=TRIM(scratch), FORM=TRIM(form), STATUS='UNKNOWN')
 ELSE IF (honoff == 'off') THEN; CLOSE (ifile, STATUS='DELETE')
 ELSE; CALL error ('Wrong file action.')
 END IF
 RETURN
 END SUBROUTINE !END!

 SUBROUTINE error (htext)
! ... ..................................................................
 CHARACTER htext*(*)
 WRITE (*, "(' %Err ', A, ' Stop.')") htext; STOP
 ENTRY warning (htext)
 WRITE (*, "(' %Wrn ', A)") htext
 RETURN
 END SUBROUTINE !END!
