NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
ifbget.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Check whether there are any more data subsets available to be
3 C> read from a BUFR message.
4 
5 C> This function checks whether there are any more data subsets
6 C> available to be read from within the BUFR message that is
7 C> open for reading via the most recent call to any of the
8 C> [message-reading subroutines](@ref hierarchy) for a specified
9 C> Fortran logical unit.
10 C>
11 C> @author J. Woollen
12 C> @date 1994-01-06
13 C>
14 C> @param[in] LUNIT - integer: Fortran logical unit number for
15 C> BUFR file
16 C> @returns ifbget - integer:
17 C> - 0 = there is at least one more data subset
18 C> to be read from the BUFR message
19 C> - -1 = there are no more data subsets
20 C> to be read from the BUFR message
21 C>
22 C> <b>Program history log:</b>
23 C> - 1994-01-06 J. Woollen -- Original author
24 C> - 1998-07-08 J. Woollen -- Replaced call to Cray library routine ABORT
25 C> with call to new internal routine bort()
26 C> - 1999-11-18 J. Woollen -- The number of BUFR files which can be
27 C> opened at one time increased from 10 to 32
28 C> (necessary in order to process multiple
29 C> BUFR files under the MPI)
30 C> - 2014-12-10 J. Ator -- Use modules instead of COMMON blocks
31 C>
32  FUNCTION ifbget(LUNIT)
33 
34  USE moda_msgcwd
35 
36 C-----------------------------------------------------------------------
37 C-----------------------------------------------------------------------
38 
39 C MAKE SURE A FILE/MESSAGE IS OPEN FOR INPUT
40 C ------------------------------------------
41 
42  CALL status(lunit,lun,il,im)
43  IF(il.EQ.0) goto 900
44  IF(il.GT.0) goto 901
45  IF(im.EQ.0) goto 902
46 
47 C SEE IF THERE IS ANOTHER SUBSET IN THE MESSAGE
48 C ---------------------------------------------
49 
50  IF(nsub(lun).LT.msub(lun)) THEN
51  ifbget = 0
52  ELSE
53  ifbget = -1
54  ENDIF
55 
56 C EXITS
57 C -----
58 
59  RETURN
60 900 CALL bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS CLOSED, IT '//
61  . 'MUST BE OPEN FOR INPUT')
62 901 CALL bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS OPEN FOR '//
63  . 'OUTPUT, IT MUST BE OPEN FOR INPUT')
64 902 CALL bort('BUFRLIB: IFBGET - A MESSAGE MUST BE OPEN IN INPUT '//
65  . 'BUFR FILE, NONE ARE')
66  END
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
function ifbget(LUNIT)
This function checks whether there are any more data subsets available to be read from within the BUF...
Definition: ifbget.f:32
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23