NCEPLIBS-bufr 11.7.1
seqsdx.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS SUBROUTINE DECODES THE TABLE D SEQUENCE INFORMATION
5C> FROM A MNEMONIC DEFINITION CARD THAT WAS PREVIOUSLY READ FROM A
6C> USER-SUPPLIED BUFR DICTIONARY TABLE IN CHARACTER FORMAT BY BUFR
7C> ARCHIVE LIBRARY SUBROUTINE RDUSDX. THESE ARE THEN ADDED TO THE
8C> ALREADY-EXISTING ENTRY FOR THAT MNEMONIC (BUILT IN RDUSDX) WITHIN
9C> THE INTERNAL BUFR TABLE D ARRAY TABD(*,LUN) IN MODULE TABABD.
10C>
11C> PROGRAM HISTORY LOG:
12C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
13C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
14C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
15C> ROUTINE "BORT"
16C> 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
17C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
18C> INTERDEPENDENCIES
19C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
20C> DOCUMENTATION; OUTPUTS MORE COMPLETE
21C> DIAGNOSTIC INFO WHEN ROUTINE TERMINATES
22C> ABNORMALLY; CHANGED CALL FROM BORT TO BORT2
23C> 2007-01-19 J. ATOR -- REPLACED CALL TO PARSEQ WITH CALL TO PARSTR
24C>
25C> USAGE: CALL SEQSDX (CARD, LUN)
26C> INPUT ARGUMENT LIST:
27C> CARD - CHARACTER*80: MNEMONIC DEFINITION CARD THAT WAS READ
28C> FROM A USER-SUPPLIED BUFR DICTIONARY TABLE
29C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
30C>
31C> REMARKS:
32C> THIS ROUTINE CALLS: ADN30 BORT2 NEMOCK NEMTAB
33C> NUMTAB PARSTR PKTDD RSVFVM
34C> STRNUM
35C> THIS ROUTINE IS CALLED BY: RDUSDX
36C> Normally not called by any application
37C> programs.
38C>
39 SUBROUTINE seqsdx(CARD,LUN)
40
41
42
43 COMMON /reptab/ idnr(5,2),typs(5,2),reps(5,2),lens(5)
44
45 CHARACTER*128 BORT_STR1,BORT_STR2
46 CHARACTER*80 CARD,SEQS
47 CHARACTER*12 ATAG,TAGS(250)
48 CHARACTER*8 NEMO,NEMA,NEMB
49 CHARACTER*6 ADN30,CLEMON
50 CHARACTER*3 TYPS
51 CHARACTER*1 REPS,TAB
52
53 DATA maxtgs /250/
54 DATA maxtag /12/
55
56C-----------------------------------------------------------------------
57C-----------------------------------------------------------------------
58
59C FIND THE SEQUENCE TAG IN TABLE D AND PARSE THE SEQUENCE STRING
60C --------------------------------------------------------------
61
62 nemo = card( 3:10)
63 seqs = card(14:78)
64
65C Note that an entry for this mnemonic should already exist within
66C the internal BUFR Table D array TABD(*,LUN); this entry should
67C have been created by subroutine RDUSDX when the mnemonic and its
68C associated FXY value and description were initially defined
69C within a card read from the "Descriptor Definition" section at
70C the top of the user-supplied BUFR dictionary table in character
71C format. Now, we need to retrieve the positional index for that
72C entry within TABD(*,LUN) so that we can access the entry and then
73C add the decoded sequence information to it.
74
75 CALL nemtab(lun,nemo,idn,tab,iseq)
76 IF(tab.NE.'D') GOTO 900
77 CALL parstr(seqs,tags,maxtgs,ntag,' ',.true.)
78 IF(ntag.EQ.0 ) GOTO 901
79
80 DO n=1,ntag
81 atag = tags(n)
82 irep = 0
83
84C CHECK FOR REPLICATOR
85C --------------------
86
87 DO i=1,5
88 IF(atag(1:1).EQ.reps(i,1)) THEN
89
90C Note that REPS(*,*), which contains all of the symbols used to
91C denote all of the various replication schemes that are
92C possible within a user-supplied BUFR dictionary table in
93C character format, was previously defined within subroutine
94C BFRINI.
95
96 DO j=2,maxtag
97 IF(atag(j:j).EQ.reps(i,2)) THEN
98 IF(j.EQ.maxtag) GOTO 902
99
100C Note that subroutine STRNUM will return NUMR = 0 if the
101C string passed to it contains all blanks (as *should* be the
102C case whenever I = 2 '(' ')', 3 '{' '}', 4 '[' ']', or
103C 5 '<' '>').
104
105C However, when I = 1 '"' '"', then subroutine STRNUM will
106C return NUMR = (the number of replications for the mnemonic
107C using F=1 "regular" (i.e. non-delayed) replication).
108
109 CALL strnum(atag(j+1:maxtag),numr)
110 IF(i.EQ.1 .AND. numr.LE.0 ) GOTO 903
111 IF(i.EQ.1 .AND. numr.GT.255) GOTO 904
112 IF(i.NE.1 .AND. numr.NE.0 ) GOTO 905
113 atag = atag(2:j-1)
114 irep = i
115 GOTO 1
116 ENDIF
117 ENDDO
118 GOTO 902
119 ENDIF
120 ENDDO
121
122C CHECK FOR VALID TAG
123C -------------------
124
1251 iret=nemock(atag)
126 IF(iret.EQ.-1) GOTO 906
127 IF(iret.EQ.-2) GOTO 907
128 CALL nemtab(lun,atag,idn,tab,iret)
129 IF(iret.GT.0) THEN
130
131C Note that the next code line checks that we are not trying to
132C replicate a Table B mnemonic (which is currently not allowed).
133C The logic works because, for replicated mnemonics, IREP = I =
134C (the index within REPS(*,*) of the symbol associated with the
135C type of replication in question (e.g. "{, "<", etc.))
136
137 IF(tab.EQ.'B' .AND. irep.NE.0) GOTO 908
138 IF(atag(1:1).EQ.'.') THEN
139
140C This mnemonic is a "following value" mnemonic
141C (i.e. it relates to the mnemonic that immediately
142C follows it within the user-supplied character-format BUFR
143C dictionary table sequence), so confirm that it contains, as
144C a substring, this mnemonic that immediately follows it.
145
146 nemb = tags(n+1)
147c .... get NEMA from IDN
148 CALL numtab(lun,idn,nema,tab,itab)
149 CALL nemtab(lun,nemb,jdn,tab,iret)
150 CALL rsvfvm(nema,nemb)
151 IF(nema.NE.atag) GOTO 909
152c .... DK: I don't think the next test can ever be satisfied
153c .... should probably be IF(N.EQ.NTAG ) GOTO 910
154 IF(n.GT.ntag ) GOTO 910
155 IF(tab.NE.'B') GOTO 911
156 ENDIF
157 ELSE
158 GOTO 912
159 ENDIF
160
161C WRITE THE DESCRIPTOR STRING INTO TABD ARRAY
162C -------------------------------------------
163c .... first look for a replication descriptor
164 IF(irep.GT.0) CALL pktdd(iseq,lun,idnr(irep,1)+numr,iret)
165 IF(iret.LT.0) GOTO 913
166 CALL pktdd(iseq,lun,idn,iret)
167 IF(iret.LT.0) GOTO 914
168
169 ENDDO
170
171C EXITS
172C -----
173
174 RETURN
175900 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
176 WRITE(bort_str2,'(18X,"MNEMONIC ",A," IS NOT A TABLE D ENTRY '//
177 . '(UNDEFINED, TAB=",A,")")') nemo,tab
178 CALL bort2(bort_str1,bort_str2)
179901 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
180 WRITE(bort_str2,'(18X,"TABLE D SEQUENCE (PARENT) MNEMONIC ",A,'//
181 . '" DOES NOT CONTAIN ANY CHILD MNEMONICS")') nemo
182 CALL bort2(bort_str1,bort_str2)
183902 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
184 WRITE(bort_str2,'(18X,"TABLE D SEQUENCE (PARENT) MNEMONIC ",A,'//
185 . '" CONTAINS A BADLY FORMED CHILD MNEMONIC",A)') nemo,tags(n)
186 CALL bort2(bort_str1,bort_str2)
187903 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
188 WRITE(bort_str2,'(9X,"TBL D MNEM. ",A," CONTAINS REG. REPL. '//
189 . 'CHILD MNEM. ",A," W/ INVALID # OF REPLICATIONS (",I3,") AFTER'//
190 . ' 2ND QUOTE")') nemo,tags(n),numr
191 CALL bort2(bort_str1,bort_str2)
192904 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
193 WRITE(bort_str2,'(18X,"TBL D MNEM. ",A," CONTAINS REG. REPL. '//
194 . 'CHILD MNEM. ",A," W/ # OF REPLICATIONS (",I3,") > LIMIT OF '//
195 . '255")') nemo,tags(n),numr
196 CALL bort2(bort_str1,bort_str2)
197905 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
198 WRITE(bort_str2,'(18X,"TBL D MNEM. ",A," CONTAINS DELAYED REPL.'//
199 . ' CHILD MNEM. ",A," W/ # OF REPL. (",I3,") SPECIFIED - A NO-'//
200 . 'NO")') nemo,tags(n),numr
201 CALL bort2(bort_str1,bort_str2)
202906 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
203 WRITE(bort_str2,'(18X,"TABLE D (PARENT) MNEMONIC ",A," CONTAINS'//
204 .' A CHILD MNEMONIC ",A," NOT BETWEEN 1 & 8 CHARACTERS")')
205 . nemo,tags(n)
206 CALL bort2(bort_str1,bort_str2)
207907 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
208 WRITE(bort_str2,'(18X,"TABLE D (PARENT) MNEMONIC ",A," CONTAINS'//
209 . ' A CHILD MNEMONIC ",A," WITH INVALID CHARACTERS")') nemo,tags(n)
210 CALL bort2(bort_str1,bort_str2)
211908 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
212 WRITE(bort_str2,'(18X,"TABLE D (PARENT) MNEMONIC ",A," CONTAINS'//
213 . ' A REPLICATED CHILD TABLE B MNEMONIC ",A," - A NO-NO")')
214 . nemo,tags(n)
215 CALL bort2(bort_str1,bort_str2)
216909 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
217 WRITE(bort_str2,'(18X,"TBL D (PARENT) MNEM. ",A," CONTAINS AN '//
218 . 'INVALID ''FOLLOWING VALUE'' MNEMONIC ",A,"(SHOULD BE ",A,")")')
219 . nemo,tags(n),nema
220 CALL bort2(bort_str1,bort_str2)
221910 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
222 WRITE(bort_str2,'(18X,"TBL D (PARENT) MNEM. ",A," CONTAINS A '//
223 . '''FOLLOWING VALUE'' MNEMONIC ",A," WHICH IS LAST IN THE '//
224 . 'STRING")') nemo,nema
225 CALL bort2(bort_str1,bort_str2)
226911 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
227 WRITE(bort_str2,'(18X,"TBL D (PARENT) MNEM. ",A,", THE MNEM. ",'//
228 . 'A," FOLLOWING A ''FOLLOWING VALUE'' MNEM. IS NOT A TBL B '//
229 . 'ENTRY")') nemo,nemb
230 CALL bort2(bort_str1,bort_str2)
231912 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
232 WRITE(bort_str2,'(18X,"TABLE D SEQUENCE (PARENT) MNEMONIC ",A,'//
233 . '" CONTAINS A CHILD MNEMONIC ",A," NOT FOUND IN ANY TABLE")')
234 . nemo,tags(n)
235 CALL bort2(bort_str1,bort_str2)
236913 clemon = adn30(idnr(irep,1)+numr,6)
237 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
238 WRITE(bort_str2,'(9X,"TBL D (PARENT) MNEM. ",A," - BAD RETURN '//
239 . 'FROM PKTDD TRYING TO STORE REPL. DESC. ",A,", SEE PREV. '//
240 . 'WARNING MSG")') nemo,clemon
241 CALL bort2(bort_str1,bort_str2)
242914 WRITE(bort_str1,'("BUFRLIB: SEQSDX - CARD READ IN IS: ",A)') card
243 WRITE(bort_str2,'(9X,"TBL D (PARENT) MNEM. ",A," - BAD RETURN '//
244 . 'FROM PKTDD TRYING TO STORE CHILD MNEM. ",A,", SEE PREV. '//
245 . 'WARNING MSG")') nemo,tags(n)
246 CALL bort2(bort_str1,bort_str2)
247 END
subroutine bort2(STR1, STR2)
This subroutine calls subroutine errwrt() to log two error messages, then calls subroutine bort_exit(...
Definition: bort2.f:23
function nemock(NEMO)
THIS FUNCTION CHECKS A MNEMONIC TO VERIFY THAT IT HAS A LENGTH OF BETWEEN ONE AND EIGHT CHARACTERS AN...
Definition: nemock.f:37
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
This subroutine returns information about a descriptor from the internal DX BUFR tables,...
Definition: nemtab.f:45
subroutine numtab(LUN, IDN, NEMO, TAB, IRET)
This subroutine returns information about a descriptor from the internal DX BUFR tables,...
Definition: numtab.f:59
subroutine parstr(STR, TAGS, MTAG, NTAG, SEP, LIMIT80)
THIS SUBROUTINE PARSES A STRING CONTAINING ONE OR MORE SUBSTRINGS INTO AN ARRAY OF SUBSTRINGS.
Definition: parstr.f:38
subroutine pktdd(ID, LUN, IDN, IRET)
THIS SUBROUTINE STORES INFORMATION ABOUT A "CHILD" MNEMONIC WITHIN THE INTERNAL BUFR TABLE D ENTRY (I...
Definition: pktdd.f:55
subroutine rsvfvm(NEM1, NEM2)
THIS SUBROUTINE STEPS THROUGH THE "FOLLOWING VALUE" MNEMONIC NEM1 AND, FOR EACH "....
Definition: rsvfvm.f:41
subroutine seqsdx(CARD, LUN)
THIS SUBROUTINE DECODES THE TABLE D SEQUENCE INFORMATION FROM A MNEMONIC DEFINITION CARD THAT WAS PRE...
Definition: seqsdx.f:40
subroutine strnum(STR, NUM)
This subroutine decodes an integer from a character string.
Definition: strnum.f:24