1 SUBROUTINE GETTBH
( LUNS
, LUNL
, TAB
, IMT
, IMTV
, IOGCE
, ILTV
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: ATOR ORG: NP12 DATE: 2007-01-19
8 C ABSTRACT: THIS SUBROUTINE READS AND PARSES THE HEADER LINES FROM TWO
9 C SEPARATE (I.E. ONE STANDARD AND ONE LOCAL) ASCII FILES CONTAINING
10 C EITHER MASTER TABLE B OR MASTER TABLE D INFORMATION.
12 C PROGRAM HISTORY LOG:
13 C 2007-01-19 J. ATOR -- ORIGINAL AUTHOR
15 C USAGE: CALL GETTBH ( LUNS, LUNL, TAB, IMT, IMTV, IOGCE, ILTV )
17 C INPUT ARGUMENT LIST:
18 C LUNS - INTEGER: FORTRAN LOGICAL UNIT NUMBER OF ASCII FILE
19 C CONTAINING STANDARD TABLE INFORMATION
20 C LUNL - INTEGER: FORTRAN LOGICAL UNIT NUMBER OF ASCII FILE
21 C CONTAINING LOCAL TABLE INFORMATION
22 C TAB - CHARACTER*1: TABLE TYPE ('B' OR 'D')
24 C OUTPUT ARGUMENT LIST:
25 C IMT - INTEGER: MASTER TABLE, READ FROM EACH ASCII FILE
26 C (NOTE: THESE VALUES MUST BE THE SAME IN EACH FILE!)
27 C IMTV - INTEGER: VERSION NUMBER OF MASTER TABLE, READ FROM
29 C IOGCE - INTEGER: ORIGINATING CENTER, READ FROM LOCAL ASCII FILE
30 C ILTV - INTEGER: VERSION NUMBER OF LOCAL TABLE, READ FROM
34 C THIS ROUTINE CALLS: BORT IGETNTBL PARSTR VALX
35 C THIS ROUTINE IS CALLED BY: RDMTBB RDMTBD
36 C Also called by application programs.
39 C LANGUAGE: FORTRAN 77
40 C MACHINE: PORTABLE TO ALL PLATFORMS
44 CHARACTER*128 BORT_STR
46 CHARACTER*30 TAGS
(5), LABEL
53 C-----------------------------------------------------------------------
54 C Statement function to check for bad header line label:
56 BADLABEL
( LABEL
) = ( ( INDEX
( LABEL
, CTTYP
) .EQ
. 0 ) .OR
.
57 . ( INDEX
( LABEL
, CFTYP
) .EQ
. 0 ) )
58 C-----------------------------------------------------------------------
62 C Read and parse the header line of the standard file.
65 IF ( IGETNTBL
( LUNS
, HEADER
) .NE
. 0 ) GOTO 900
66 CALL PARSTR
( HEADER
, TAGS
, 5, NTAG
, '|', .FALSE
. )
67 IF ( NTAG
.LT
. 3 ) GOTO 900
68 IF ( BADLABEL
( TAGS
(1) ) ) GOTO 900
69 IMT
= VALX
( TAGS
(2) )
70 IMTV
= VALX
( TAGS
(3) )
72 C Read and parse the header line of the local file.
75 IF ( IGETNTBL
( LUNL
, HEADER
) .NE
. 0 ) GOTO 900
76 CALL PARSTR
( HEADER
, TAGS
, 5, NTAG
, '|', .FALSE
. )
77 IF ( NTAG
.LT
. 4 ) GOTO 900
78 IF ( BADLABEL
( TAGS
(1) ) ) GOTO 900
79 IMT2
= VALX
( TAGS
(2) )
80 IOGCE
= VALX
( TAGS
(3) )
81 ILTV
= VALX
( TAGS
(4) )
83 C Verify that both files are for the same master table.
85 IF ( IMT
.NE
. IMT2
) GOTO 901
89 900 WRITE(BORT_STR
,'("BUFRLIB: GETTBH - BAD OR MISSING HEADER '//
90 . 'WITHIN ",A," TABLE ",A)') CFTYP
, TAB
92 901 WRITE(BORT_STR
,'("BUFRLIB: GETTBH - MASTER TABLE NUMBER '//
93 . 'MISMATCH BETWEEN STD AND LOC TABLE ",A)') TAB