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