NCEPLIBS-bufr 11.7.1
nmsub.f
Go to the documentation of this file.
1C> @file
2C> @brief Get the number of data subsets from a BUFR message.
3
4C> This function returns the total number of data subsets available
5C> within the BUFR message that was most recently opened for reading
6C> via a call to one of the other
7C> [message-reading subroutines](@ref hierarchy)
8C> for a specified Fortran logical unit.
9C>
10C> <p>The data subsets themselves do not need to have already been
11C> read via previous calls to any of the
12C> [subset-reading subroutines](@ref hierarchy).
13C>
14C> @author J. Woollen
15C> @date 1994-01-06
16C>
17C> @param[in] LUNIT -- integer: Fortran logical unit number for
18C> BUFR file
19C> @returns nmsub -- integer: Number of data subsets
20C>
21C> <b>Program history log:</b>
22C> | Date | Programmer | Comments |
23C> | -----|------------|----------|
24C> | 1994-01-06 | J. Woollen | Original author |
25C> | 1998-07-08 | J. Woollen | Replaced call to Cray library routine ABORT with call to new internal routine bort() |
26C> | 1999-11-18 | J. Woollen | The number of BUFR files which can be opened at one time increased from 10 to 32 |
27C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
28C>
29 FUNCTION nmsub(LUNIT)
30
31 USE moda_msgcwd
32
33C-----------------------------------------------------------------------
34C-----------------------------------------------------------------------
35
36 nmsub = 0
37
38C CHECK THE FILE STATUS
39C ---------------------
40
41 CALL status(lunit,lun,il,im)
42 IF(il.EQ.0) GOTO 900
43 IF(il.GT.0) GOTO 901
44 IF(im.EQ.0) GOTO 902
45
46 nmsub = msub(lun)
47
48C EXITS
49C -----
50
51 RETURN
52900 CALL bort('BUFRLIB: NMSUB - INPUT BUFR FILE IS CLOSED, IT MUST '//
53 . 'BE OPEN FOR INPUT')
54901 CALL bort('BUFRLIB: NMSUB - INPUT BUFR FILE IS OPEN FOR OUTPUT,'//
55 . ' IT MUST BE OPEN FOR INPUT')
56902 CALL bort('BUFRLIB: NMSUB - A MESSAGE MUST BE OPEN IN INPUT '//
57 . 'BUFR FILE, NONE ARE')
58 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
function nmsub(LUNIT)
This function returns the total number of data subsets available within the BUFR message that was mos...
Definition: nmsub.f:30
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