1!$Id:$
2      logical function readfl(tx)
3
4!      * * F E A P * * A Finite Element Analysis Program
5
6!....  Copyright (c) 1984-2017: Regents of the University of California
7!                               All rights reserved
8
9!-----[--.----+----.----+----.-----------------------------------------]
10!      Purpose: Read data from specified file.
11!               (teminates with: read,end).
12
13!      Inputs:
14!         tx        - Name of file for reads
15
16!      Outputs:
17!         readfl    - Status of mesh input
18!-----[--.----+----.----+----.-----------------------------------------]
19
20      implicit  none
21
22      include  'iofile.h'
23      include  'iosave.h'
24
25      logical   pcomp, lopen, lexist
26      character tx*(*), fnamr*21, fext*8
27      integer   isfile
28
29      save
30
31!     Set the default for returning error or close
32
33      readfl = .false.
34
35!     Close file and reset logical unit number
36
37      if(pcomp(tx,'end',3)) then
38        inquire(file=fnamr,opened=lopen,exist=lexist)
39        if(lexist.and.lopen) close(lfile)
40        if(lread) then
41          ior    = isfile
42          lread  = .false.
43          readfl = .false.
44        endif
45
46!     Open file and set new logical unit number
47
48      else
49        fnamr    = tx
50        fext     = tx
51        call opnfil(fext,fnamr,-2,lfile,lread)
52        if(.not.lread) return
53        isfile = ior
54        ior    = lfile
55        readfl = .true.
56      endif
57
58      end
59