NCEPLIBS-bufr 11.7.1
ufbcnt.f
Go to the documentation of this file.
1C> @file
2C> @brief Get the current message number and data subset number within
3C> a BUFR file
4
5C> This subroutine returns the current location of the file pointer
6C> within a BUFR file, in terms of a message number counting from the
7C> beginning of the file, and a data subset number counting from the
8C> beginning of that message.
9C>
10C> @author J. Woollen
11C> @date 1994-01-06
12C>
13C> @param[in] LUNIT -- integer: Fortran logical unit number for BUFR file
14C> @param[out] KMSG -- integer: Ordinal number of current message,
15C> counting from the beginning of the BUFR file, but
16C> not counting any messages which contain DX BUFR
17C> tables information
18C> @param[out] KSUB -- integer: Ordinal number of current data subset
19C> within (KMSG)th message, counting from the
20C> beginning of the message
21C>
22C> @remarks
23C> - Logical unit LUNIT should have already been opened via a previous
24C> call to subroutine openbf(). If LUNIT was opened for input
25C> operations, then KMSG is incremented with each call to any of the
26C> [message-reading subroutines](@ref hierarchy), and KSUB is
27C> incremented with each call to any of the
28C> [subset-reading subroutines](@ref hierarchy) for that message.
29C> Otherwise, if LUNIT was opened for output operations, then KMSG is
30C> incremented with each call to any of the
31C> [message-writing subroutines](@ref hierarchy), and KSUB is
32C> incremented with each call to any of the
33C> [subset-writing subroutines](@ref hierarchy) for that message.
34C> - The value returned for KMSG does <b>not</b> include any messages
35C> which contain DX BUFR tables information.
36C>
37C> <b>Program history log:</b>
38C> | Date | Programmer | Comments |
39C> | -----|------------|----------|
40C> | 1994-01-06 | J. Woollen | Original author |
41C> | 1998-07-08 | J. Woollen | Replaced call to Cray library routine ABORT with call to new internal routine bort() |
42C> | 1999-11-18 | J. Woollen | The number of BUFR files which can be opened at one time increased from 10 to 32 |
43C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
44C>
45 SUBROUTINE ufbcnt(LUNIT,KMSG,KSUB)
46
47 USE moda_msgcwd
48
49C-----------------------------------------------------------------------
50C-----------------------------------------------------------------------
51
52C CHECK THE FILE STATUS - RETURN THE MESSAGE AND SUBSET COUNTERS
53C --------------------------------------------------------------
54
55 CALL status(lunit,lun,il,im)
56 IF(il.EQ.0) GOTO 900
57 kmsg = nmsg(lun)
58 ksub = nsub(lun)
59
60C EXITS
61C -----
62
63 RETURN
64900 CALL bort('BUFRLIB: STATUS - BUFR FILE IS CLOSED, IT MUST BE '//
65 . 'OPEN FOR EITHER INPUT OR OUTPUT')
66 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
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
subroutine ufbcnt(LUNIT, KMSG, KSUB)
This subroutine returns the current location of the file pointer within a BUFR file,...
Definition: ufbcnt.f:46