updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / external / bufr / rdmsgw.f
blob01a168cdcb418213e04f7a50217adcf2b8599364
1 SUBROUTINE RDMSGW(LUNIT,MESG,IRET)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: RDMSGW
6 C PRGMMR: ATOR ORG: NP12 DATE: 2005-11-29
8 C ABSTRACT: THIS SUBROUTINE READS THE NEXT BUFR MESSAGE FROM LOGICAL
9 C UNIT LUNIT AS AN ARRAY OF INTEGER WORDS.
11 C PROGRAM HISTORY LOG:
12 C 2005-11-29 J. ATOR -- ORIGINAL AUTHOR
13 C 2009-03-23 D. KEYSER -- CALL BORT IN CASE OF MESG OVERFLOW
14 C 2012-09-15 J. WOOLLEN -- CONVERT TO C LANGUAGE I/O INTERFACE;
15 C USE C ROUTINE CRDBUFR TO OBTAIN BUFR
16 C MESSAGE; REMOVE CODE WHICH CHECKS SEC0
17 C AND MESSAGE LENGTH AS CRDBUFR DOES THAT
19 C USAGE: CALL RDMSGW (LUNIT, MESG, IRET)
20 C INPUT ARGUMENT LIST:
21 C LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
23 C OUTPUT ARGUMENT LIST:
24 C MESG - *-WORD ARRAY CONTAINING BUFR MESSAGE READ FROM LUNIT
25 C IRET - INTEGER: RETURN CODE:
26 C 0 = normal return
27 C -1 = end-of-file encountered while reading
28 C from LUNIT
30 C INPUT FILES:
31 C UNIT "LUNIT" - BUFR FILE
33 C REMARKS:
34 C THIS ROUTINE CALLS: CRDBUFR ERRWRT STATUS
35 C THIS ROUTINE IS CALLED BY: COPYBF CPDXMM DATEBF DUMPBF
36 C MESGBC MESGBF POSAPX RDBFDX
37 C READMG UFBMEM UFBMEX
38 C Normally not called by any application
39 C programs.
41 C ATTRIBUTES:
42 C LANGUAGE: FORTRAN 77
43 C MACHINE: PORTABLE TO ALL PLATFORMS
45 C$$$
47 INCLUDE 'bufrlib.prm'
49 COMMON /HRDWRD/ NBYTW,NBITW,IORD(8)
51 DIMENSION MESG(*)
53 CHARACTER*128 BORT_STR
54 integer crdbufr
56 C-----------------------------------------------------------------------
57 C-----------------------------------------------------------------------
59 CALL STATUS(LUNIT,LUN,IL,IM)
60 1 IRET=CRDBUFR(LUN,MESG,MXMSGL)
61 IF(IRET.eq.-3)
62 + CALL ERRWRT('BUFRLIB: RDMSGW - SKIPPING OVERLARGE MESSAGE')
63 IF(IRET.eq.-2)
64 + CALL ERRWRT('BUFRLIB: RDMSGW - SKIPPING CORRUPTED MESSAGE')
65 if(iret.lt.-1) goto 1
66 RETURN
67 END