NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
ufbcnt.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 1994-01-06
3 
4 C> THIS SUBROUTINE RETURNS A COUNT OF THE CURRENT MESSAGE
5 C> NUMBER AND SUBSET NUMBER, WHERE THE MESSAGE NUMBER IS RELATIVE TO
6 C> ALL MESSAGES IN THE BUFR FILE AND THE SUBSET NUMBER IS RELATIVE TO
7 C> ALL SUBSETS IN THE MESSAGE. IF THE MESSAGE/SUBSET ARE BEING READ,
8 C> THE MESSAGE COUNT ADVANCES EACH TIME BUFR ARCHIVE LIBRARY
9 C> SUBROUTINE READMG (OR EQUIVALENT) IS CALLED AND THE SUBSET COUNT
10 C> ADVANCES EACH TIME BUFR ARCHIVE LIBRARY SUBROUTINE READSB (OR
11 C> EQUIVALENT) IS CALLED FOR A PARTICULAR MESSAGE. IF THE MESSAGE/
12 C> SUBSET ARE BEING WRITTEN, THE MESSAGE COUNT ADVANCES EACH TIME
13 C> BUFR ARCHIVE LIBRARY SUBROUTINE OPENMG (OR EQUIVALENT) IS CALLED
14 C> AND THE SUBSET COUNT ADVANCES EACH TIME BUFR ARCHIVE LIBRARY
15 C> SUBROUTINE WRITSB (OR EQUIVALENT) IS CALLED.
16 C>
17 C> PROGRAM HISTORY LOG:
18 C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
19 C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
20 C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
21 C> ROUTINE "BORT"
22 C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
23 C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
24 C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
25 C> BUFR FILES UNDER THE MPI)
26 C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
27 C> INTERDEPENDENCIES
28 C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
29 C> DOCUMENTATION (INCLUDING HISTORY); OUTPUTS
30 C> MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
31 C> TERMINATES ABNORMALLY
32 C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
33 C>
34 C> USAGE: CALL UFBCNT (LUNIT, KMSG, KSUB)
35 C> INPUT ARGUMENT LIST:
36 C> LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
37 C>
38 C> OUTPUT ARGUMENT LIST:
39 C> KMSG - INTEGER: POINTER TO MESSAGE COUNT IN BUFR FILE
40 C> (INCLUDING MESSAGE CURRENTLY OPEN FOR READING/WRITING)
41 C> KSUB - INTEGER: POINTER TO SUBSET COUNT IN BUFR MESSAGE
42 C> (INCLUDING SUBSET CURRENTLY OPEN FOR READING/WRITING)
43 C>
44 C> REMARKS:
45 C> IF AN APPLICATION PROGRAM DESIRES TO KNOW THE NUMBER OF SUBSETS IN
46 C> A BUFR MESSAGES JUST OPENED, IT MUST USE THE FUNCTION NMSUB RATHER
47 C> THAN THIS SUBROUTINE BECAUSE KSUB ONLY INCREMENTS BY ONE FOR EACH
48 C> CALL TO READSB (I.E., KSUB = 0 IMMEDIATELY AFTER READMG IS
49 C> CALLED).
50 C>
51 C> THIS ROUTINE CALLS: BORT STATUS
52 C> THIS ROUTINE IS CALLED BY: UFBPOS
53 C> Also called by application programs.
54 C>
55  SUBROUTINE ufbcnt(LUNIT,KMSG,KSUB)
56 
57  USE moda_msgcwd
58 
59 C-----------------------------------------------------------------------
60 C-----------------------------------------------------------------------
61 
62 C CHECK THE FILE STATUS - RETURN THE MESSAGE AND SUBSET COUNTERS
63 C --------------------------------------------------------------
64 
65  CALL status(lunit,lun,il,im)
66  IF(il.EQ.0) goto 900
67  kmsg = nmsg(lun)
68  ksub = nsub(lun)
69 
70 C EXITS
71 C -----
72 
73  RETURN
74 900 CALL bort('BUFRLIB: STATUS - BUFR FILE IS CLOSED, IT MUST BE '//
75  . 'OPEN FOR EITHER INPUT OR OUTPUT')
76  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
subroutine ufbcnt(LUNIT, KMSG, KSUB)
THIS SUBROUTINE RETURNS A COUNT OF THE CURRENT MESSAGE NUMBER AND SUBSET NUMBER, WHERE THE MESSAGE NU...
Definition: ufbcnt.f:55
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23