3 !$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 ! PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 ! ABSTRACT: THIS SUBROUTINE CONSTRUCTS AN INTERNAL JUMP/LINK TABLE
9 ! WITHIN COMMON BLOCK /TABLES/, USING THE INFORMATION WITHIN THE
10 ! INTERNAL BUFR TABLE ARRAYS (WITHIN COMMON BLOCK /TABABD/) FOR ALL OF
11 ! THE LUN (I.E., I/O STREAM INDEX) VALUES THAT ARE CURRENTLY DEFINED TO
12 ! THE BUFR ARCHIVE LIBRARY SOFTWARE. NOTE THAT THE ENTIRE JUMP/LINK
13 ! TABLE WILL ALWAYS BE COMPLETELY RECONSTRUCTED FROM SCRATCH, EVEN IF
14 ! SOME OF THE INFORMATION WITHIN THE INTERNAL BUFR TABLE ARRAYS
15 ! ALREADY EXISTED THERE AT THE TIME OF THE PREVIOUS CALL TO THIS
16 ! SUBROUTINE, BECAUSE THERE MAY HAVE BEEN OTHER EVENTS THAT HAVE TAKEN
17 ! PLACE SINCE THE PREVIOUS CALL TO THIS SUBROUTINE THAT HAVE NOT YET
18 ! BEEN REFLECTED WITHIN THE INTERNAL JUMP/LINK TABLE, SUCH AS, E.G.
19 ! THE UNLINKING OF AN LUN VALUE FROM THE BUFR ARCHIVE LIBRARY SOFTWARE
20 ! VIA A CALL TO BUFR ARCHIVE LIBRARY SUBROUTINE CLOSBF.
22 ! PROGRAM HISTORY LOG:
23 ! 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
24 ! 1995-06-28 J. WOOLLEN -- INCREASED THE SIZE OF INTERNAL BUFR TABLE
25 ! ARRAYS IN ORDER TO HANDLE BIGGER FILES
26 ! 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
27 ! "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
29 ! 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
30 ! OPENED AT ONE TIME INCREASED FROM 10 TO 32
31 ! (NECESSARY IN ORDER TO PROCESS MULTIPLE
32 ! BUFR FILES UNDER THE MPI)
33 ! 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
34 ! 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
36 ! 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
37 ! INCREASED FROM 15000 TO 16000 (WAS IN
38 ! VERIFICATION VERSION); UNIFIED/PORTABLE FOR
39 ! WRF; ADDED HISTORY DOCUMENTATION; OUTPUTS
40 ! MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
41 ! TERMINATES ABNORMALLY; NOW ALLOWS FOR THE
42 ! POSSIBILITY THAT A CONNECTED FILE MAY NOT
43 ! CONTAIN ANY DICTIONARY TABLE INFO (E.G.,
44 ! AN EMPTY FILE), SUBSEQUENT CONNECTED FILES
45 ! WHICH ARE NOT EMPTY WILL NO LONGER GET
46 ! TRIPPED UP BY THIS (THIS AVOIDS THE NEED
47 ! FOR AN APPLICATION PROGRAM TO DISCONNECT
48 ! ANY EMPTY FILES VIA A CALL TO CLOSBF)
50 ! USAGE: CALL MAKESTAB
53 ! UNIT 06 - STANDARD OUTPUT PRINT
56 ! THIS ROUTINE CALLS: BORT CHEKSTAB STRCLN TABSUB
57 ! THIS ROUTINE IS CALLED BY: RDBFDX RDUSDX
58 ! Normally not called by any application
62 ! LANGUAGE: FORTRAN 77
63 ! MACHINE: PORTABLE TO ALL PLATFORMS
70 COMMON / STBFR / IOLUN (NFILES), IOMSG (NFILES)
71 ! COMMON / USRINT / NVAL (NFILES), INV (MAXJL, NFILES), VAL (MAXJL, &
73 COMMON / TABABD / NTBA (0:NFILES), NTBB (0:NFILES), NTBD (0: &
74 NFILES), MTAB (MAXTBA, NFILES), IDNA (MAXTBA, NFILES, 2), IDNB ( &
75 MAXTBB, NFILES), IDND (MAXTBD, NFILES), TABA (MAXTBA, NFILES), &
76 TABB (MAXTBB, NFILES), TABD (MAXTBD, NFILES)
77 ! COMMON / TABLES / MAXTAB, NTAB, TAG (MAXJL), TYP (MAXJL), KNT ( &
78 ! MAXJL), JUMP (MAXJL), LINK (MAXJL), JMPB (MAXJL), IBT (MAXJL), &
79 ! IRF (MAXJL), ISC (MAXJL), ITP (MAXJL), VALI (MAXJL), KNTI (MAXJL),&
80 ! ISEQ (MAXJL, 2), JSEQ (MAXJL)
85 CHARACTER(128) BORT_STR
89 DIMENSION LUS (NFILES)
93 !-----------------------------------------------------------------------
94 !-----------------------------------------------------------------------
96 ! RESET POINTER TABLE AND STRING CACHE
97 ! ------------------------------------
102 ! FIGURE OUT WHICH UNITS SHARE TABLES
103 ! -----------------------------------
105 ! First, determine how many LUN values are currently being used and,
106 ! for each such one, whether it uses the same dictionary table
107 ! information as any other LUN values that we have examined so far.
108 ! If so, then set LUS(LUN) to a nonzero value.
110 ! Note that, for each LUN value, the MTAB(*,LUN) array contains
111 ! pointer indices into the internal jump/link table for each of the
112 ! Table A mnemonics that is currently defined for that LUN value.
113 ! Thus, the code within the following DO loop is simply checking
114 ! whether the first Table A mnemonic is the same for two different
115 ! LUN values as the determination of whether those LUN values indeed
116 ! share the same dictionary tables.
120 IF (IOLUN (LUN) .NE.0) THEN
123 !ccccccc IF(MTAB(1,LUN).EQ.MTAB(1,LUM)) LUS(LUN) = LUM
124 IF (MTAB (1, LUN) .EQ.MTAB (1, LUM) .AND.MTAB (1, LUM) .NE.0) LUS &
131 ! INITIALIZE JUMP/LINK TABLES WITH SUBSETS/SEQUENCES/ELEMENTS
132 ! -----------------------------------------------------------
136 !cccc IF(IOLUN(LUN).NE.0) THEN
137 IF (IOLUN (LUN) .NE.0.AND.NTBA (LUN) .GT.0) THEN
139 ! RESET ANY EXISTING INVENTORY POINTERS
140 ! -------------------------------------
142 IF (IOMSG (LUN) .NE.0) THEN
143 IF (LUS (LUN) .EQ.0) INC = (NTAB + 1) - MTAB (1, LUN)
144 IF (LUS (LUN) .NE.0) INC = MTAB (1, LUS (LUN) ) - MTAB (1, LUN)
146 INV (N, LUN) = INV (N, LUN) + INC
150 ! CREATE NEW TABLE ENTRIES IF THIS UNIT DOESN'T SHARE EXISTING ONES
151 ! -----------------------------------------------------------------
153 IF (LUS (LUN) .EQ.0) THEN
155 ! The dictionary table information corresponding to this LUN
156 ! has not yet been written into the internal jump/link table,
160 DO ITBA = 1, NTBA (LUN)
162 NEMO = TABA (ITBA, LUN) (4:11)
163 CALL TABSUB (LUN, NEMO)
164 MTAB (ITBA, LUN) = INOD
167 !**** note that the following lines are commented out****
168 !ccc DO N1=INOD,ISC(INOD)-1
169 !ccc DO N2=N1+1,ISC(INOD)
170 !ccc IF(TAG(N1).EQ.TAG(N2)) GOTO 900
173 !********************************************************
181 ! STORE TYPES AND INITIAL VALUES AND COUNTS
182 ! -----------------------------------------
185 IF (TYP (NODE) .EQ.'SUB') THEN
189 ELSEIF (TYP (NODE) .EQ.'SEQ') THEN
193 ELSEIF (TYP (NODE) .EQ.'RPC') THEN
197 ELSEIF (TYP (NODE) .EQ.'RPS') THEN
201 ELSEIF (TYP (NODE) .EQ.'REP') THEN
202 ! VALI (NODE) = BMISS
203 VALI (NODE) = 2147483647
204 KNTI (NODE) = IRF (NODE)
206 ELSEIF (TYP (NODE) .EQ.'DRS') THEN
210 ELSEIF (TYP (NODE) .EQ.'DRP') THEN
214 ELSEIF (TYP (NODE) .EQ.'DRB') THEN
218 ELSEIF (TYP (NODE) .EQ.'NUM') THEN
219 ! VALI (NODE) = BMISS
220 VALI (NODE) = 2147483647
223 ELSEIF (TYP (NODE) .EQ.'CHR') THEN
224 ! VALI (NODE) = BMISS
225 VALI (NODE) = 2147483647
233 ! SET UP EXPANSION SEGMENTS FOR TYPE 'SUB', 'DRP', AND 'DRS' NODES
234 ! ----------------------------------------------------------------
241 EXPAND = TYP (N) .EQ.'SUB'.OR.TYP (N) .EQ.'DRP'.OR.TYP (N) &
242 .EQ.'DRS'.OR.TYP (N) .EQ.'REP'.OR.TYP (N) .EQ.'DRB'
244 ISEQ (N, 1) = NEWN + 1
250 IF (TYP (NODA) .EQ.'REP') KNT (NODE) = KNTI (NODA)
251 IF (TYP (NODA) .NE.'REP') KNT (NODE) = 1
254 IF (NEWN.GT.MAXJL) GOTO 902
256 KNT (NODE) = MAX (KNTI (NODE), KNT (NODE) )
257 2 IF (JUMP (NODE) * KNT (NODE) .GT.0) THEN
260 ELSEIF (LINK (NODE) .GT.0) THEN
265 IF (NODE.EQ.NODA) GOTO 3
266 IF (NODE.EQ.0) GOTO 903
267 KNT (NODE) = MAX (KNT (NODE) - 1, 0)
274 ! PRINT THE SEQUENCE TABLES
275 ! ------------------------
279 PRINT * , '+++++++++++++++++BUFR ARCHIVE LIBRARY++++++++++++++++++&
283 PRINT 99, I, TAG (I), TYP (I), JMPB (I), JUMP (I), LINK (I), &
284 IBT (I), IRF (I), ISC (I)
287 99 FORMAT ('BUFRLIB: MAKESTAB ',I5,2X,A10,A5,6I8)
288 PRINT * , '+++++++++++++++++BUFR ARCHIVE LIBRARY++++++++++++++++++&
297 900 WRITE (BORT_STR, '("BUFRLIB: MAKESTAB - MNEMONIC ",A," IS '// &
298 'DUPLICATED IN SUBSET: ",A)') NEMO, TAG (N1)
300 901 WRITE (BORT_STR, '("BUFRLIB: MAKESTAB - UNKNOWN TYPE ",A)') TYP ( &
303 902 WRITE (BORT_STR, '("BUFRLIB: MAKESTAB - NUMBER OF JSEQ ENTRIES IN'&
304 &//' JUMP/LINK TABLE EXCEEDS THE LIMIT (",I6,")")') MAXJL
306 903 WRITE (BORT_STR, '("BUFRLIB: MAKESTAB - NODE IS ZERO, FAILED TO '/&
307 &/'CIRCULATE (TAG IS ",A,")")') TAG (N)
309 END SUBROUTINE MAKESTAB