Debian Codegraph @

packages/seacas/applications/ex1ex2v2/ex1_dbiqa.f

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6
7 C=======================================================================
8 SUBROUTINE DBIQA (NDB, OPTION,
9 & MAXQA, MAXINF, NQAREC, QAREC, NINFO, INFO,
10 & EXODUS, *)
11 C=======================================================================
12
13 C --*** DBIQA *** (EXOLIB) Read QA and information records
14 C -- Written by Amy Gilkey - revised 02/08/88
15 C --
16 C --DBIQA reads the QA records and the information records.
17 C --
18 C --Note that the number of QA records and information records to be read
19 C --are read in this routine.
20 C --
21 C --This routine calls DBIV0.
22 C --
23 C --Parameters:
24 C -- NDB - IN - the database number
25 C -- OPTION - IN - ' ' to not store, '*' to store all, else store options:
26 C -- 'Q' to store QA records
27 C -- 'I' to store information records
28 C -- MAXQA - IN - the maximum number of QA records to store
29 C -- MAXINF - IN - the number of information records to store
30 C -- NQAREC - OUT - the number of QA records; <0 if end-of-file
31 C -- QAREC - OUT - the QA records containing: (if OPTION)
32 C -- (1) - the analysis code name
33 C -- (2) - the analysis code QA descriptor
34 C -- (3) - the analysis date
35 C -- (4) - the analysis time
36 C -- NINFO - OUT - the number of information records; <0 if end-of-file
37 C -- INFO - OUT - the information records (if OPTION)
38 C -- EXODUS - OUT - false if GENESIS file, true if EXODUS file so far
39 C -- * - return statement if error encountered, including end-of-file;
40 C -- NOT used if valid GENESIS file; message is printed
41 C --
42 C --Database must be positioned at start of QA records upon entry;
43 C --upon exit positioned at end of information records.
44
45 INTEGER NDB
46 CHARACTER*(*) OPTION
47 INTEGER MAXQA, MAXINF
48 INTEGER NQAREC
49 CHARACTER*8 QAREC(4,*)
50 INTEGER NINFO
51 CHARACTER*80 INFO(*)
52 LOGICAL EXODUS
53
54 CHARACTER*80 ERRMSG
55
56 EXODUS = .FALSE.
57 NQAREC = -999
58 NINFO = -999
59
60 READ (NDB, END=160, ERR=170, IOSTAT=IERR) NQAREC
61
62 C ... If too many records, skip early records and store last written ones.
63 IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'Q') .GT. 0)) THEN
64 iskp = max(0, nqarec - maxqa)
65 DO 110 IQA = 1, iskp
66 READ (NDB, END=180, ERR=180, IOSTAT=IERR)
67 110 CONTINUE
68 DO 100 IQA = 1, MIN (MAXQA, NQAREC)
69 READ (NDB, END=180, ERR=180, IOSTAT=IERR)
70 & (QAREC(I,IQA), I=1,4)
71 100 CONTINUE
72 ELSE
73 DO 120 IQA = 1, NQAREC
74 READ (NDB, END=180, ERR=180, IOSTAT=IERR)
75 120 CONTINUE
76 END IF
77
78 READ (NDB, END=160, ERR=190, IOSTAT=IERR) NINFO
79
80 C ... If too many records, skip early records and store last written ones.
81 IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'I') .GT. 0)) THEN
82 iskp = max(0, ninfo - maxinf)
83 DO 140 I = 1, iskp
84 READ (NDB, END=200, ERR=200, IOSTAT=IERR)
85 140 CONTINUE
86 DO 130 I = 1, MIN (MAXINF, NINFO)
87 READ (NDB, END=200, ERR=200, IOSTAT=IERR) INFO(I)
88 130 CONTINUE
89 ELSE
90 DO 150 I = 1, NINFO
91 READ (NDB, END=200, ERR=200, IOSTAT=IERR)
92 150 CONTINUE
93 END IF
94
95 EXODUS = .TRUE.
96
97 CALL DBIV0 (NQAREC, NINFO)
98
99 160 CONTINUE
100 RETURN
101
102 170 CONTINUE
103 ERRMSG = 'NUMBER OF QA RECORDS'
104 GOTO 210
105 180 CONTINUE
106 ERRMSG = 'QA RECORDS'
107 GOTO 210
108 190 CONTINUE
109 ERRMSG = 'NUMBER OF INFORMATION RECORDS'
110 GOTO 210
111 200 CONTINUE
112 ERRMSG = 'INFORMATION RECORDS'
113 GOTO 210
114 210 CONTINUE
115 CALL DBERR (IERR, ERRMSG)
116 RETURN 1
117 END