1 SUBROUTINE MESGBF
(LUNIT
,MESGTYP
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS SUBROUTINE READS AND EXAMINES SECTION 1 OF MESSAGES
9 C IN A BUFR FILE IN SEQUENCE UNTIL IT FINDS THE FIRST MESSAGE THAT
10 C IS NOT A BUFR TABLE (DICTIONARY) MESSAGE. IT THEN RETURNS THE
11 C MESSAGE TYPE FOR THIS FIRST NON-DICTIONARY MESSAGE. THE BUFR FILE
12 C SHOULD NOT BE OPEN VIA BUFR ARCHIVE LIBRARY SUBROUTINE OPENBF PRIOR
13 C TO CALLING THIS SUBROUTINE; HOWEVER, THE BUFR FILE MUST BE CONNECTED
14 C TO UNIT LUNIT. THIS SUBROUTINE IS IDENTICAL TO BUFR ARCHIVE LIBRARY
15 C SUBROUTINE MESGBC EXCEPT THAT MESGBC RETURNS THE MESSAGE TYPE FOR
16 C THE FIRST NON-DICTIONARY MESSAGE THAT ACTUALLY CONTAINS REPORT DATA
17 C (WHEREAS MESGBF WOULD RETURN THE REPORT TYPE OF A DUMMY MESSAGE
18 C CONTAINING THE CENTER TIME FOR DUMP FILES), AND MESGBC ALSO
19 C INDICATES WHETHER OR NOT THE FIRST REPORT DATA MESSAGE IS BUFR
20 C COMPRESSED. MESGBC ALSO HAS AN OPTION TO OPERATE ON THE CURRENT
21 C MESSAGE STORED IN MEMORY, WHICH IS SOMETHING THAT MESGBF CANNOT DO.
23 C PROGRAM HISTORY LOG:
24 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
25 C 2000-09-19 J. WOOLLEN -- MAXIMUM MESSAGE LENGTH INCREASED FROM
26 C 10,000 TO 20,000 BYTES
27 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
29 C 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
30 C DOCUMENTATION (INCLUDING HISTORY)
31 C 2004-08-09 J. ATOR -- MAXIMUM MESSAGE LENGTH INCREASED FROM
32 C 20,000 TO 50,000 BYTES
33 C 2005-11-29 J. ATOR -- USE IUPBS01 AND RDMSGW
34 C 2009-03-23 J. ATOR -- USE IDXMSG
35 C 2012-09-15 J. WOOLLEN -- MODIFIED FOR C/I/O/BUFR INTERFACE;
36 C USE NEW OPENBF TYPE 'INX' TO OPEN AND CLOSE
37 C THE C FILE WITHOUT CLOSING THE FORTRAN FILE
39 C USAGE: CALL MESGBF (LUNIT, MESGTYP)
40 C INPUT ARGUMENT LIST:
41 C LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
43 C OUTPUT ARGUMENT LIST:
44 C MESGTYP - INTEGER: BUFR MESSAGE TYPE FOR FIRST NON-DICTIONARY
46 C -1 = no messages read or error
47 C 11 = if only BUFR table messages in BUFR file
50 C UNIT "LUNIT" - BUFR FILE
53 C THIS ROUTINE CALLS: CLOSBF IDXMSG IUPBS01 OPENBF
55 C THIS ROUTINE IS CALLED BY: None
56 C Normally called only by application
60 C LANGUAGE: FORTRAN 77
61 C MACHINE: PORTABLE TO ALL PLATFORMS
67 DIMENSION MBAY
(MXMSGLD4
)
69 C-----------------------------------------------------------------------
70 C-----------------------------------------------------------------------
74 C SINCE OPENBF HAS NOT YET BEEN CALLED, CALL IT
75 C ---------------------------------------------
77 CALL OPENBF
(LUNIT
,'INX',LUNIT
)
79 C READ PAST ANY BUFR TABLES AND RETURN THE FIRST MESSAGE TYPE FOUND
80 C -----------------------------------------------------------------
82 1 CALL RDMSGW
(LUNIT
,MBAY
,IER
)
85 MESGTYP
= IUPBS01
(MBAY
,'MTYP')
86 IF(IDXMSG
(MBAY
).EQ
.1) GOTO 1