NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
rdmtbf.f
Go to the documentation of this file.
1 C> @file
2 C> @author ATOR @date 2017-10-17
3 
4 C> THIS SUBROUTINE READS MASTER CODE/FLAG TABLE INFORMATION
5 C> FROM TWO SEPARATE (I.E. ONE STANDARD AND ONE LOCAL) ASCII FILES
6 C> AND THEN MERGES IT INTO AN INTERNAL MEMORY STRUCTURE. EACH OF THE
7 C> TWO INPUT FILES MUST ALREADY BE INDIVIDUALLY SORTED IN ASCENDING
8 C> ORDER WITH RESPECT TO THE FXY NUMBERS.
9 C>
10 C> PROGRAM HISTORY LOG:
11 C> 2017-10-17 J. ATOR -- ORIGINAL AUTHOR
12 C>
13 C> USAGE: CALL RDMTBF ( LUNSTF, LUNLTF )
14 C>
15 C> INPUT ARGUMENT LIST:
16 C> LUNSTF - INTEGER: FORTRAN LOGICAL UNIT NUMBER OF ASCII FILE
17 C> CONTAINING STANDARD CODE/FLAG TABLE INFORMATION
18 C> LUNLTF - INTEGER: FORTRAN LOGICAL UNIT NUMBER OF ASCII FILE
19 C> CONTAINING LOCAL CODE/FLAG TABLE INFORMATION
20 C>
21 C> REMARKS:
22 C> THIS ROUTINE CALLS: ADN30 BORT GETNTBE GETTBH
23 C> INITTBF SNTBFE SORTTBF WRDLEN
24 C> THIS ROUTINE IS CALLED BY: IREADMT
25 C> Not normally called by any application
26 C> programs.
27 C>
28  SUBROUTINE rdmtbf ( LUNSTF, LUNLTF )
29 
30 
31 
32  character*160 stline, ltline
33  character*128 bort_str
34  character*6 cmatch, adn30
35 
36 C-----------------------------------------------------------------------
37 C-----------------------------------------------------------------------
38 
39 C Call WRDLEN to initialize some important information about the
40 C local machine, just in case it hasn't already been called.
41 
42  CALL wrdlen
43 
44 C Initialize the internal memory structure, including allocating
45 C space for it in case this hasn't already been done.
46 
47  CALL inittbf
48 
49 C Read and parse the header lines of both files.
50 
51  CALL gettbh( lunstf, lunltf, 'F', imt, imtv, iogce, iltv )
52 
53 C Read through the remainder of both files, merging the
54 C contents into a unified internal memory structure.
55 
56  CALL getntbe( lunstf, isfxyn, stline, iers )
57  CALL getntbe( lunltf, ilfxyn, ltline, ierl )
58  DO WHILE ( ( iers .EQ. 0 ) .OR. ( ierl .EQ. 0 ) )
59  IF ( ( iers .EQ. 0 ) .AND. ( ierl .EQ. 0 ) ) THEN
60  IF ( isfxyn .EQ. ilfxyn ) THEN
61  cmatch = adn30( isfxyn, 6 )
62  goto 900
63  ELSE IF ( isfxyn .LT. ilfxyn ) THEN
64  CALL sntbfe( lunstf, isfxyn, stline )
65  CALL getntbe( lunstf, isfxyn, stline, iers )
66  ELSE
67  CALL sntbfe( lunltf, ilfxyn, ltline )
68  CALL getntbe( lunltf, ilfxyn, ltline, ierl )
69  ENDIF
70  ELSE IF ( iers .EQ. 0 ) THEN
71  CALL sntbfe( lunstf, isfxyn, stline )
72  CALL getntbe( lunstf, isfxyn, stline, iers )
73  ELSE IF ( ierl .EQ. 0 ) THEN
74  CALL sntbfe( lunltf, ilfxyn, ltline )
75  CALL getntbe( lunltf, ilfxyn, ltline, ierl )
76  ENDIF
77  ENDDO
78 
79 C Sort the contents of the internal memory structure.
80 
81  CALL sorttbf
82 
83  RETURN
84  900 WRITE(bort_str,'("BUFRLIB: RDMTBF - STANDARD AND LOCAL'//
85  . ' CODE/FLAG TABLE FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)')
86  . cmatch(1:1), '-', cmatch(2:3), '-', cmatch(4:6)
87  CALL bort(bort_str)
88  END
void sorttbf(void)
This subroutine sorts the entries within the internal memory structure for storage of master Code/Fla...
Definition: sorttbf.c:18
void inittbf(void)
This subroutine initializes the internal memory structure for storage of master Code/Flag table entri...
Definition: inittbf.c:20
subroutine rdmtbf(LUNSTF, LUNLTF)
THIS SUBROUTINE READS MASTER CODE/FLAG TABLE INFORMATION FROM TWO SEPARATE (I.E.
Definition: rdmtbf.f:28
subroutine gettbh(LUNS, LUNL, TAB, IMT, IMTV, IOGCE, ILTV)
THIS SUBROUTINE READS AND PARSES THE HEADER LINES FROM TWO SEPARATE (I.E.
Definition: gettbh.f:34
character *(*) function adn30(IDN, L30)
This function converts a descriptor from its bit-wise (integer) representation to its 5 or 6 characte...
Definition: adn30.f:27
subroutine wrdlen
This subroutine figures out some important information about the local machine on which the BUFRLIB s...
Definition: wrdlen.F:43
subroutine sntbfe(LUNT, IFXYN, LINE)
THIS SUBROUTINE READS A COMPLETE ENTRY (CORRESPONDING TO THE INPUT FXY NUMBER) FROM AN ASCII MASTER C...
Definition: sntbfe.f:26
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine getntbe(LUNT, IFXYN, LINE, IRET)
This subroutine gets the first line of the next entry in the specified ASCII master table B...
Definition: getntbe.f:26