NCEPLIBS-bufr  12.0.0
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 C>
5 C> @author J. Woollen @date 1994-01-06
6 
7 C> This function checks whether there are any more data subsets
8 C> available to be read from within the BUFR message that is
9 C> open for reading via the most recent call to any of the
10 C> [message-reading subroutines](@ref hierarchy) for a specified
11 C> Fortran logical unit.
12 C>
13 C> @param[in] LUNIT - integer: Fortran logical unit number for BUFR file
14 C> @returns ifbget - integer:
15 C> - 0 = there is at least one more data subset to be read from the message
16 C> - -1 = there are no more data subsets to be read from the message
17 C>
18 C> @author J. Woollen @date 1994-01-06
19  RECURSIVE FUNCTION ifbget(LUNIT) RESULT(IRET)
20 
21  USE modv_im8b
22 
23  USE moda_msgcwd
24 
25 C-----------------------------------------------------------------------
26 C-----------------------------------------------------------------------
27 
28 C CHECK FOR I8 INTEGERS
29 C ---------------------
30 
31  IF(im8b) THEN
32  im8b=.false.
33 
34  CALL x84(lunit,my_lunit,1)
35  iret=ifbget(my_lunit)
36 
37  im8b=.true.
38  RETURN
39  ENDIF
40 
41  iret = -1
42 
43 C MAKE SURE A FILE/MESSAGE IS OPEN FOR INPUT
44 C ------------------------------------------
45 
46  CALL status(lunit,lun,il,im)
47  IF(il.EQ.0) GOTO 900
48  IF(il.GT.0) GOTO 901
49  IF(im.EQ.0) GOTO 902
50 
51 C SEE IF THERE IS ANOTHER SUBSET IN THE MESSAGE
52 C ---------------------------------------------
53 
54  IF(nsub(lun).LT.msub(lun)) THEN
55  iret = 0
56  ENDIF
57 
58 C EXITS
59 C -----
60 
61  RETURN
62 900 CALL bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS CLOSED, IT '//
63  . 'MUST BE OPEN FOR INPUT')
64 901 CALL bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS OPEN FOR '//
65  . 'OUTPUT, IT MUST BE OPEN FOR INPUT')
66 902 CALL bort('BUFRLIB: IFBGET - A MESSAGE MUST BE OPEN IN INPUT '//
67  . 'BUFR FILE, NONE ARE')
68  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
recursive function ifbget(LUNIT)
This function checks whether there are any more data subsets available to be read from within the BUF...
Definition: ifbget.f:20
This module contains declarations for arrays used to store information about the current BUFR message...
integer, dimension(:), allocatable msub
Total number of data subsets in message.
integer, dimension(:), allocatable nsub
Current subset pointer within message.
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
recursive subroutine status(LUNIT, LUN, IL, IM)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
Definition: status.f:36
subroutine x84(IIN8, IOUT4, NVAL)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x84.F:19