NCEPLIBS-bufr  11.6.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> | Date | Programmer | Comments |
24 C> | -----|------------|----------|
25 C> | 1994-01-06 | J. Woollen | Original author |
26 C> | 1998-07-08 | J. Woollen | Replaced call to Cray library routine ABORT with call to new internal routine bort() |
27 C> | 1999-11-18 | J. Woollen | The number of BUFR files which can be opened at one time increased from 10 to 32 (necessary in order to process multiple BUFR files under the MPI) |
28 C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
29 C>
30  FUNCTION ifbget(LUNIT)
31 
32  USE moda_msgcwd
33 
34 C-----------------------------------------------------------------------
35 C-----------------------------------------------------------------------
36 
37 C MAKE SURE A FILE/MESSAGE IS OPEN FOR INPUT
38 C ------------------------------------------
39 
40  CALL status(lunit,lun,il,im)
41  IF(il.EQ.0) goto 900
42  IF(il.GT.0) goto 901
43  IF(im.EQ.0) goto 902
44 
45 C SEE IF THERE IS ANOTHER SUBSET IN THE MESSAGE
46 C ---------------------------------------------
47 
48  IF(nsub(lun).LT.msub(lun)) THEN
49  ifbget = 0
50  ELSE
51  ifbget = -1
52  ENDIF
53 
54 C EXITS
55 C -----
56 
57  RETURN
58 900 CALL bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS CLOSED, IT '//
59  . 'MUST BE OPEN FOR INPUT')
60 901 CALL bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS OPEN FOR '//
61  . 'OUTPUT, IT MUST BE OPEN FOR INPUT')
62 902 CALL bort('BUFRLIB: IFBGET - A MESSAGE MUST BE OPEN IN INPUT '//
63  . 'BUFR FILE, NONE ARE')
64  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:55
function ifbget(LUNIT)
This function checks whether there are any more data subsets available to be read from within the BUF...
Definition: ifbget.f:30
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22