NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
rdmsgw.f
Go to the documentation of this file.
1 C> @file
2 C> @author ATOR @date 2005-11-29
3 
4 C> THIS SUBROUTINE READS THE NEXT BUFR MESSAGE FROM LOGICAL
5 C> UNIT LUNIT AS AN ARRAY OF INTEGER WORDS.
6 C>
7 C> PROGRAM HISTORY LOG:
8 C> 2005-11-29 J. ATOR -- ORIGINAL AUTHOR
9 C> 2009-03-23 D. KEYSER -- CALL BORT IN CASE OF MESG OVERFLOW
10 C> 2012-09-15 J. WOOLLEN -- CONVERT TO C LANGUAGE I/O INTERFACE;
11 C> USE C ROUTINE CRDBUFR TO OBTAIN BUFR
12 C> MESSAGE; REMOVE CODE WHICH CHECKS SEC0
13 C> AND MESSAGE LENGTH AS CRDBUFR DOES THAT
14 C>
15 C> USAGE: CALL RDMSGW (LUNIT, MESG, IRET)
16 C> INPUT ARGUMENT LIST:
17 C> LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
18 C>
19 C> OUTPUT ARGUMENT LIST:
20 C> MESG - *-WORD ARRAY CONTAINING BUFR MESSAGE READ FROM LUNIT
21 C> IRET - INTEGER: RETURN CODE:
22 C> 0 = normal return
23 C> -1 = end-of-file encountered while reading
24 C> from LUNIT
25 C>
26 C> INPUT FILES:
27 C> UNIT "LUNIT" - BUFR FILE
28 C>
29 C> REMARKS:
30 C> THIS ROUTINE CALLS: CRDBUFR ERRWRT STATUS
31 C> THIS ROUTINE IS CALLED BY: COPYBF CPDXMM DATEBF DUMPBF
32 C> MESGBC MESGBF POSAPX RDBFDX
33 C> READMG UFBMEM UFBMEX
34 C> Normally not called by any application
35 C> programs.
36 C>
37  SUBROUTINE rdmsgw(LUNIT,MESG,IRET)
38 
39  USE modv_mxmsgl
40 
41  COMMON /hrdwrd/ nbytw,nbitw,iord(8)
42 
43  dimension mesg(*)
44 
45  CHARACTER*128 bort_str
46  INTEGER crdbufr
47 
48 C-----------------------------------------------------------------------
49 C-----------------------------------------------------------------------
50 
51  CALL status(lunit,lun,il,im)
52 1 iret=crdbufr(lun,mesg,mxmsgl)
53  IF(iret.eq.-3)
54  + CALL errwrt('BUFRLIB: RDMSGW - SKIPPING OVERLARGE MESSAGE')
55  IF(iret.eq.-2)
56  + CALL errwrt('BUFRLIB: RDMSGW - SKIPPING CORRUPTED MESSAGE')
57  IF(iret.LT.-1) goto 1
58  RETURN
59  END
60 
This module declares and initializes the MXMSGL variable.
Definition: modv_MXMSGL.f:13
f77int crdbufr(f77int *nfile, char *bufr, f77int *mxbyt)
This function reads the next message from a BUFR file that was previously opened for reading...
Definition: cread.c:140
subroutine rdmsgw(LUNIT, MESG, IRET)
THIS SUBROUTINE READS THE NEXT BUFR MESSAGE FROM LOGICAL UNIT LUNIT AS AN ARRAY OF INTEGER WORDS...
Definition: rdmsgw.f:37
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 errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:41