NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
readns.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read the next data subset from a BUFR file that was
3 C> previously opened for reading.
4 
5 C> This subroutine provides a handy way to combine the functionality
6 C> of subroutines readmg() and readsb() within a single subroutine
7 C> call.
8 C>
9 C> @author J. Woollen
10 C> @date 1994-01-06
11 C>
12 C> @param[in] LUNIT - integer: Fortran logical unit number for
13 C> BUFR file
14 C> @param[out] SUBSET - character*8: Table A mnemonic for type of
15 C> data subset that was read
16 C> (see [DX BUFR Tables](@ref dfbftab)
17 C> for further information about Table A mnemonics)
18 C> @param[out] JDATE - integer: Date-time stored within Section 1 of
19 C> BUFR message containing data subset that
20 C> was read, in format of either
21 C> YYMMDDHH or YYYYMMDDHH, depending on the most
22 C> recent call to subroutine datelen()
23 C> @param[out] IRET - integer: return code
24 C> - 0 = new BUFR data subset was successfully
25 C> read into internal arrays
26 C> - -1 = there are no more BUFR data subsets
27 C> in the file connected to logical unit
28 C> LUNIT
29 C>
30 C> <p>Logical unit LUNIT should have already been opened for
31 C> input operations via a previous call to subroutine openbf().
32 C> But once that is done, the application program can immediately call
33 C> this subroutine to read each new data subset from the
34 C> associated BUFR file, and the subroutine will automatically open
35 C> and close each new BUFR message internally as needed, so that
36 C> subsequent calls can immediately be made to any of the various
37 C> [values-reading subroutines](@ref hierarchy).
38 C>
39 C> <b>Program history log:</b>
40 C> - 1994-01-06 J. Woollen -- Original author
41 C> - 1998-07-08 J. Woollen -- Replaced call to Cray library routine
42 C> "ABORT" with call to new internal BUFRLIB
43 C> routine "BORT"; modified to make Y2K
44 C> compliant
45 C> - 1999-11-18 J. Woollen -- The number of BUFR files which can be
46 C> opened at one time increased from 10 to 32
47 C> (necessary in order to process multiple
48 C> BUFR files under the MPI)
49 C> - 2003-11-04 D. Keyser -- MAXJL (maximum number of jump/link entries)
50 C> increased from 15000 to 16000 (was in
51 C> verification version)
52 C> - 2014-12-10 J. Ator -- Use modules instead of COMMON blocks
53 C>
54  SUBROUTINE readns(LUNIT,SUBSET,JDATE,IRET)
55 
56  USE moda_msgcwd
57  USE moda_tables
58 
59  CHARACTER*8 subset
60 
61 C-----------------------------------------------------------------------
62 C-----------------------------------------------------------------------
63 
64 C REFRESH THE SUBSET AND JDATE PARAMETERS
65 C ---------------------------------------
66 
67  CALL status(lunit,lun,il,im)
68  IF(il.EQ.0) goto 900
69  IF(il.GT.0) goto 901
70  subset = tag(inode(lun))
71  jdate = idate(lun)
72 
73 C READ THE NEXT SUBSET IN THE BUFR FILE
74 C -------------------------------------
75 
76 1 CALL readsb(lunit,iret)
77  IF(iret.NE.0) THEN
78  CALL readmg(lunit,subset,jdate,iret)
79  IF(iret.EQ.0) goto 1
80  ENDIF
81 
82 C EXITS
83 C -----
84 
85  RETURN
86 900 CALL bort('BUFRLIB: READNS - INPUT BUFR FILE IS CLOSED, IT MUST'//
87  . ' BE OPEN FOR INPUT')
88 901 CALL bort('BUFRLIB: READNS - INPUT BUFR FILE IS OPEN FOR OUTPUT'//
89  . ', IT MUST BE OPEN FOR INPUT')
90  END
This module contains array and variable declarations used to store the internal jump/link table...
Definition: moda_tables.F:13
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
Definition: status.f:61
subroutine readns(LUNIT, SUBSET, JDATE, IRET)
This subroutine provides a handy way to combine the functionality of subroutines readmg() and readsb(...
Definition: readns.f:54
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine readmg(LUNXX, SUBSET, JDATE, IRET)
This subroutine reads the next BUFR message from logical unit ABS(LUNXX) into internal arrays...
Definition: readmg.f:99
subroutine readsb(LUNIT, IRET)
This subroutine reads the next data subset from a BUFR message into internal arrays.
Definition: readsb.f:59