NCEPLIBS-bufr  12.0.1
getntbe.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read the first line of the next entry from a master
3 C> table B, table D or Code/Flag table file
4 C>
5 C> @author J. Ator @date 2007-01-19
6 
7 C> This subroutine reads the first line of the next entry from
8 C> the specified ASCII master table B, table D or table F (Code/Flag)
9 C> file. This line contains, among other things, the FXY number
10 C> corresponding to this entry.
11 C>
12 C> @param[in] LUNT -- integer: Fortran logical unit number of
13 C> master table B, table D or Code/Flag table file
14 C> @param[out] IFXYN -- integer: Bit-wise representation of FXY number
15 C> for next table entry
16 C> @param[out] LINE -- character*(*): First line of next table entry
17 C> @param[out] IRET -- integer: return code
18 C> - 0 = normal return
19 C> - -1 = end-of-file encountered while reading
20 C> from LUNT
21 C> - -2 = I/O error encountered while reading
22 C> from LUNT
23 C>
24 C> @author J. Ator @date 2007-01-19
25  SUBROUTINE getntbe ( LUNT, IFXYN, LINE, IRET )
26 
27  CHARACTER*(*) LINE
28  CHARACTER*128 BORT_STR1, BORT_STR2
29  CHARACTER*20 TAGS(4)
30  CHARACTER*6 ADSC
31 
32 C-----------------------------------------------------------------------
33 C-----------------------------------------------------------------------
34 
35 C Get the first line of the next entry in the file.
36 
37  iret = igetntbl( lunt, line )
38  IF ( iret .EQ. 0 ) THEN
39 
40 C The first field within this line should contain the
41 C FXY number.
42 
43  CALL parstr ( line(1:20), tags, 4, ntag, '|', .false. )
44  IF ( ntag .LT. 1 ) GOTO 900
45  IF ( igetfxy( tags(1), adsc ) .NE. 0 ) GOTO 900
46 
47 C Store the bit-wise representation of the FXY number.
48 
49  ifxyn = ifxy( adsc )
50  ENDIF
51 
52  RETURN
53 
54  900 bort_str1 = 'BUFRLIB: GETNTBE - CARD BEGINNING WITH: ' //
55  . line(1:20)
56  bort_str2 = ' HAS BAD OR MISSING FXY NUMBER'
57  CALL bort2(bort_str1,bort_str2)
58 
59  END
subroutine bort2(STR1, STR2)
Log two error messages and abort application program.
Definition: bort2.f:18
subroutine getntbe(LUNT, IFXYN, LINE, IRET)
This subroutine reads the first line of the next entry from the specified ASCII master table B,...
Definition: getntbe.f:26
function ifxy(ADSC)
Convert an FXY value from its 6 character representation to its WMO bit-wise representation.
Definition: ifxy.f:34
function igetfxy(STR, CFXY)
This function looks for and returns a valid FXY number from within the given input string.
Definition: igetfxy.f:20
function igetntbl(LUNT, LINE)
This subroutine reads the next line from an ASCII master table B, table D or Code/Flag table file,...
Definition: igetntbl.f:24
subroutine parstr(STR, TAGS, MTAG, NTAG, SEP, LIMIT80)
Parse a string containing one or more substrings into an array of substrings.
Definition: parstr.f:24