1 SUBROUTINE RDMTBD
( LUNSTD
, LUNLTD
, MXMTBD
, MXELEM
,
2 . IMT
, IMTV
, IOGCE
, ILTV
,
3 . NMTBD
, IMFXYN
, CMMNEM
, CMDSC
, CMSEQ
,
4 . NMELEM
, IEFXYN
, CEELEM
)
6 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
9 C PRGMMR: ATOR ORG: NP12 DATE: 2007-01-19
11 C ABSTRACT: THIS SUBROUTINE READS MASTER TABLE D INFORMATION FROM TWO
12 C SEPARATE (I.E. ONE STANDARD AND ONE LOCAL) ASCII FILES AND THEN
13 C MERGES IT INTO A UNIFIED SET OF MASTER TABLE D ARRAYS FOR OUTPUT.
14 C EACH OF THE TWO INPUT FILES MUST ALREADY BE INDIVIDUALLY SORTED IN
15 C ASCENDING ORDER WITH RESPECT TO THE FXY NUMBERS.
17 C PROGRAM HISTORY LOG:
18 C 2007-01-19 J. ATOR -- ORIGINAL AUTHOR
20 C USAGE: CALL RDMTBD ( LUNSTD, LUNLTD, MXMTBD, MXELEM,
21 C IMT, IMTV, IOGCE, ILTV,
22 C NMTBD, IMFXYN, CMMNEM, CMDSC, CMSEQ,
23 C NMELEM, IEFXYN, CEELEM )
24 C INPUT ARGUMENT LIST:
25 C LUNSTD - INTEGER: FORTRAN LOGICAL UNIT NUMBER OF ASCII FILE
26 C CONTAINING STANDARD TABLE D INFORMATION
27 C LUNLTD - INTEGER: FORTRAN LOGICAL UNIT NUMBER OF ASCII FILE
28 C CONTAINING LOCAL TABLE D INFORMATION
29 C MXMTBD - INTEGER: MAXIMUM NUMBER OF ENTRIES TO BE STORED IN
30 C MERGED MASTER TABLE D ARRAYS; THIS SHOULD BE THE SAME
31 C NUMBER AS WAS USED TO DIMENSION THE OUTPUT ARRAYS IN
32 C THE CALLING PROGRAM, AND IT IS USED BY THIS SUBROUTINE
33 C TO ENSURE THAT IT DOESN'T OVERFLOW THESE ARRAYS
34 C MXELEM - INTEGER: MAXIMUM NUMBER OF ELEMENTS TO BE STORED PER
35 C ENTRY WITHIN THE MERGED MASTER TABLE D ARRAYS; THIS
36 C SHOULD BE THE SAME NUMBER AS WAS USED TO DIMENSION THE
37 C OUTPUT ARRAYS IN THE CALLING PROGRAM, AND IT IS USED
38 C BY THIS SUBROUTINE TO ENSURE THAT IT DOESN'T OVERFLOW
41 C OUTPUT ARGUMENT LIST:
42 C IMT - INTEGER: MASTER TABLE, READ FROM EACH ASCII FILE
43 C (NOTE: THESE VALUES MUST BE THE SAME IN EACH FILE!)
44 C IMTV - INTEGER: VERSION NUMBER OF MASTER TABLE, READ FROM
46 C IOGCE - INTEGER: ORIGINATING CENTER, READ FROM LOCAL ASCII FILE
47 C ILTV - INTEGER: VERSION NUMBER OF LOCAL TABLE, READ FROM
49 C NMTBD - INTEGER: NUMBER OF ENTRIES IN MERGED MASTER TABLE D
51 C IMFXYN(*)- INTEGER: MERGED ARRAY CONTAINING BIT-WISE
52 C REPRESENTATIONS OF FXY NUMBERS (I.E. SEQUENCE
54 C CMMNEM(*)- CHARACTER*8: MERGED ARRAY CONTAINING MNEMONICS
55 C CMDSC(*) - CHARACTER*4: MERGED ARRAY CONTAINING DESCRIPTOR CODES
56 C CMSEQ(*) - CHARACTER*120: MERGED ARRAY CONTAINING SEQUENCE NAMES
57 C NMELEM(*)- INTEGER: MERGED ARRAY CONTAINING NUMBER OF ELEMENTS
58 C STORED FOR EACH ENTRY
59 C IEFXYN(*,*)- INTEGER: MERGED ARRAY CONTAINING BIT-WISE
60 C REPRESENTATIONS OF ELEMENT FXY NUMBERS
61 C CEELEM(*,*)- CHARACTER*120: MERGED ARRAY CONTAINING ELEMENT NAMES
64 C THIS ROUTINE CALLS: ADN30 BORT GETNTBE GETTBH
66 C THIS ROUTINE IS CALLED BY: None
67 C Normally called only by application
71 C LANGUAGE: FORTRAN 77
72 C MACHINE: PORTABLE TO ALL PLATFORMS
76 CHARACTER*200 STLINE
, LTLINE
77 CHARACTER*128 BORT_STR
78 CHARACTER*120 CMSEQ
(*), CEELEM
(MXMTBD
,MXELEM
)
80 CHARACTER*6 CMATCH
, ADN30
83 INTEGER IMFXYN
(*), NMELEM
(*),
84 . IEFXYN
(MXMTBD
,MXELEM
)
86 C-----------------------------------------------------------------------
87 C-----------------------------------------------------------------------
89 C Call WRDLEN to initialize some important information about the
90 C local machine, just in case it hasn't already been called.
94 C Read and parse the header lines of both files.
96 CALL GETTBH
( LUNSTD
, LUNLTD
, 'D', IMT
, IMTV
, IOGCE
, ILTV
)
98 C Read through the remainder of both files, merging the
99 C contents into a unified set of master Table D arrays.
102 CALL GETNTBE
( LUNSTD
, ISFXYN
, STLINE
, IERS
)
103 CALL GETNTBE
( LUNLTD
, ILFXYN
, LTLINE
, IERL
)
104 DO WHILE ( ( IERS
.EQ
. 0 ) .OR
. ( IERL
.EQ
. 0 ) )
105 IF ( ( IERS
.EQ
. 0 ) .AND
. ( IERL
.EQ
. 0 ) ) THEN
106 IF ( ISFXYN
.EQ
. ILFXYN
) THEN
107 CMATCH
= ADN30
( ISFXYN
, 6 )
109 ELSE IF ( ISFXYN
.LT
. ILFXYN
) THEN
110 CALL SNTBDE
( LUNSTD
, ISFXYN
, STLINE
, MXMTBD
, MXELEM
,
111 . NMTBD
, IMFXYN
, CMMNEM
, CMDSC
, CMSEQ
,
112 . NMELEM
, IEFXYN
, CEELEM
)
113 CALL GETNTBE
( LUNSTD
, ISFXYN
, STLINE
, IERS
)
115 CALL SNTBDE
( LUNLTD
, ILFXYN
, LTLINE
, MXMTBD
, MXELEM
,
116 . NMTBD
, IMFXYN
, CMMNEM
, CMDSC
, CMSEQ
,
117 . NMELEM
, IEFXYN
, CEELEM
)
118 CALL GETNTBE
( LUNLTD
, ILFXYN
, LTLINE
, IERL
)
120 ELSE IF ( IERS
.EQ
. 0 ) THEN
121 CALL SNTBDE
( LUNSTD
, ISFXYN
, STLINE
, MXMTBD
, MXELEM
,
122 . NMTBD
, IMFXYN
, CMMNEM
, CMDSC
, CMSEQ
,
123 . NMELEM
, IEFXYN
, CEELEM
)
124 CALL GETNTBE
( LUNSTD
, ISFXYN
, STLINE
, IERS
)
125 ELSE IF ( IERL
.EQ
. 0 ) THEN
126 CALL SNTBDE
( LUNLTD
, ILFXYN
, LTLINE
, MXMTBD
, MXELEM
,
127 . NMTBD
, IMFXYN
, CMMNEM
, CMDSC
, CMSEQ
,
128 . NMELEM
, IEFXYN
, CEELEM
)
129 CALL GETNTBE
( LUNLTD
, ILFXYN
, LTLINE
, IERL
)
134 900 WRITE(BORT_STR
,'("BUFRLIB: RDMTBD - STANDARD AND LOCAL'//
135 . ' TABLE D FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)')
136 . CMATCH
(1:1), '-', CMATCH
(2:3), '-', CMATCH
(4:6)