1 SUBROUTINE SNTBBE (IFXYN, LINE, MXMTBB, NMTBB, IMFXYN, CMSCL, &
2 CMSREF, CMBW, CMUNIT, CMMNEM, CMDSC, CMELEM)
4 !$$$ SUBPROGRAM DOCUMENTATION BLOCK
7 ! PRGMMR: ATOR ORG: NP12 DATE: 2007-01-19
9 ! ABSTRACT: THIS SUBROUTINE PARSES AN ENTRY THAT WAS PREVIOUSLY READ
10 ! FROM AN ASCII MASTER TABLE B FILE AND THEN STORES THE OUTPUT INTO
13 ! PROGRAM HISTORY LOG:
14 ! 2007-01-19 J. ATOR -- ORIGINAL AUTHOR
16 ! USAGE: CALL SNTBBE ( IFXYN, LINE, MXMTBB,
17 ! NMTBB, IMFXYN, CMSCL, CMSREF, CMBW,
18 ! CMUNIT, CMMNEM, CMDSC, CMELEM )
19 ! INPUT ARGUMENT LIST:
20 ! IFXYN - INTEGER: BIT-WISE REPRESENTATION OF FXY NUMBER FOR
21 ! TABLE ENTRY; THIS FXY NUMBER IS THE ELEMENT DESCRIPTOR
22 ! LINE - CHARACTER*(*): TABLE ENTRY
23 ! MXMTBB - INTEGER: MAXIMUM NUMBER OF ENTRIES TO BE STORED IN
24 ! MERGED MASTER TABLE B ARRAYS; THIS SHOULD BE THE SAME
25 ! NUMBER AS WAS USED TO DIMENSION THE OUTPUT ARRAYS IN
26 ! THE CALLING PROGRAM, AND IT IS USED BY THIS SUBROUTINE
27 ! TO ENSURE THAT IT DOESN'T OVERFLOW THESE ARRAYS
29 ! OUTPUT ARGUMENT LIST:
30 ! NMTBB - INTEGER: NUMBER OF ENTRIES IN MERGED MASTER TABLE B
32 ! IMFXYN(*)- INTEGER: MERGED ARRAY CONTAINING BIT-WISE
33 ! REPRESENTATIONS OF FXY NUMBERS (I.E. ELEMENT
35 ! CMSCL(*) - CHARACTER*4: MERGED ARRAY CONTAINING SCALE FACTORS
36 ! CMSREF(*)- CHARACTER*12: MERGED ARRAY CONTAINING REFERENCE VALUES
37 ! CMBW(*) - CHARACTER*4: MERGED ARRAY CONTAINING BIT WIDTHS
38 ! CMUNIT(*)- CHARACTER*14: MERGED ARRAY CONTAINING UNITS
39 ! CMMNEM(*)- CHARACTER*8: MERGED ARRAY CONTAINING MNEMONICS
40 ! CMDSC(*) - CHARACTER*4: MERGED ARRAY CONTAINING DESCRIPTOR CODES
41 ! CMELEM(*)- CHARACTER*120: MERGED ARRAY CONTAINING ELEMENT NAMES
44 ! THIS ROUTINE CALLS: BORT BORT2 JSTCHR NEMOCK
46 ! THIS ROUTINE IS CALLED BY: RDMTBB
47 ! Normally not called by any application
51 ! LANGUAGE: FORTRAN 77
52 ! MACHINE: PORTABLE TO ALL PLATFORMS
57 CHARACTER(200) TAGS (10), WKTAG
58 CHARACTER(128) BORT_STR1, BORT_STR2
59 CHARACTER(120) CMELEM ( * )
60 CHARACTER(14) CMUNIT ( * )
61 CHARACTER(12) CMSREF ( * )
62 CHARACTER(8) CMMNEM ( * )
63 CHARACTER(4) CMSCL ( * ), CMBW ( * ), CMDSC ( * )
67 !-----------------------------------------------------------------------
68 !-----------------------------------------------------------------------
70 IF (NMTBB.GE.MXMTBB) GOTO 900
73 ! Store the FXY number. This is the element descriptor.
75 IMFXYN (NMTBB) = IFXYN
77 ! Parse the table entry.
79 CALL PARSTR (LINE, TAGS, 10, NTAG, '|', .FALSE.)
81 BORT_STR2 = ' HAS TOO FEW FIELDS'
87 CALL JSTCHR (TAGS (2), IRET)
89 BORT_STR2 = ' HAS MISSING SCALE FACTOR'
92 CMSCL (NMTBB) = TAGS (2) (1:4)
93 RJ = RJUST (CMSCL (NMTBB) )
97 CALL JSTCHR (TAGS (3), IRET)
99 BORT_STR2 = ' HAS MISSING REFERENCE VALUE'
102 CMSREF (NMTBB) = TAGS (3) (1:12)
103 RJ = RJUST (CMSREF (NMTBB) )
107 CALL JSTCHR (TAGS (4), IRET)
109 BORT_STR2 = ' HAS MISSING BIT WIDTH'
112 CMBW (NMTBB) = TAGS (4) (1:4)
113 RJ = RJUST (CMBW (NMTBB) )
115 ! Units. Note that this field is allowed to be blank.
118 CALL JSTCHR (TAGS (5), IRET)
119 CMUNIT (NMTBB) = TAGS (5) (1:14)
124 ! Comment (additional) fields. Any of these fields may be blank.
131 CALL PARSTR (WKTAG, TAGS, 10, NTAG, ';', .FALSE.)
133 ! The first additional field contains the mnemonic.
134 CALL JSTCHR (TAGS (1), IRET)
135 ! If there is a mnemonic, then make sure it's legal.
136 IF ( (IRET.EQ.0) .AND. (NEMOCK (TAGS (1) ) .NE.0) ) THEN
137 BORT_STR2 = ' HAS ILLEGAL MNEMONIC'
140 CMMNEM (NMTBB) = TAGS (1) (1:8)
143 ! The second additional field contains descriptor codes.
144 CALL JSTCHR (TAGS (2), IRET)
145 CMDSC (NMTBB) = TAGS (2) (1:4)
148 ! The third additional field contains the element name.
149 CALL JSTCHR (TAGS (3), IRET)
150 CMELEM (NMTBB) = TAGS (3) (1:120)
155 900 CALL BORT ('BUFRLIB: SNTBBE - OVERFLOW OF MERGED ARRAYS')
156 901 BORT_STR1 = 'BUFRLIB: SNTBBE - CARD BEGINNING WITH: '//LINE (1:20)
157 CALL BORT2 (BORT_STR1, BORT_STR2)
158 END SUBROUTINE SNTBBE