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