NCEPLIBS-bufr  11.7.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> | Date | Programmer | Comments |
41 C> | -----|------------|----------|
42 C> | 1994-01-06 | J. Woollen | Original author |
43 C> | 1998-07-08 | J. Woollen | Replaced call to Cray library routine "ABORT" with call to new internal routine bort(); modified to make Y2K compliant |
44 C> | 1999-11-18 | J. Woollen | The number of BUFR files which can be opened at one time increased from 10 to 32 |
45 C> | 2003-11-04 | D. Keyser | MAXJL (maximum number of jump/link entries) increased from 15000 to 16000 |
46 C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
47 C>
48  SUBROUTINE readns(LUNIT,SUBSET,JDATE,IRET)
49 
50  USE moda_msgcwd
51  USE moda_tables
52 
53  CHARACTER*8 subset
54 
55 C-----------------------------------------------------------------------
56 C-----------------------------------------------------------------------
57 
58 C REFRESH THE SUBSET AND JDATE PARAMETERS
59 C ---------------------------------------
60 
61  CALL status(lunit,lun,il,im)
62  IF(il.EQ.0) goto 900
63  IF(il.GT.0) goto 901
64  subset = tag(inode(lun))
65  jdate = idate(lun)
66 
67 C READ THE NEXT SUBSET IN THE BUFR FILE
68 C -------------------------------------
69 
70 1 CALL readsb(lunit,iret)
71  IF(iret.NE.0) THEN
72  CALL readmg(lunit,subset,jdate,iret)
73  IF(iret.EQ.0) goto 1
74  ENDIF
75 
76 C EXITS
77 C -----
78 
79  RETURN
80 900 CALL bort('BUFRLIB: READNS - INPUT BUFR FILE IS CLOSED, IT MUST'//
81  . ' BE OPEN FOR INPUT')
82 901 CALL bort('BUFRLIB: READNS - INPUT BUFR FILE IS OPEN FOR OUTPUT'//
83  . ', IT MUST BE OPEN FOR INPUT')
84  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:55
subroutine readns(LUNIT, SUBSET, JDATE, IRET)
This subroutine provides a handy way to combine the functionality of subroutines readmg() and readsb(...
Definition: readns.f:48
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22
subroutine readmg(LUNXX, SUBSET, JDATE, IRET)
This subroutine reads the next BUFR message from logical unit ABS(LUNXX) into internal arrays...
Definition: readmg.f:73
subroutine readsb(LUNIT, IRET)
This subroutine reads the next data subset from a BUFR message into internal arrays.
Definition: readsb.f:47