NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
ufbrms.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read one or more data values from a data subset in
3 C> internal arrays.
4 
5 C> This subroutine provides a handy way to combine the functionality
6 C> of subroutines rdmemm(), rdmems() and ufbint() within a single
7 C> subroutine call.
8 C>
9 C> @author J. Woollen
10 C> @date 1994-01-06
11 C>
12 C> @param[in] IMSG - integer: Number of BUFR message to be
13 C> read into scope for further processing,
14 C> counting from the beginning of the
15 C> internal arrays in memory
16 C> @param[in] ISUB - integer: Number of data subset to be
17 C> read from the (IMSG)th BUFR message,
18 C> counting from the beginning of the message
19 C> @param[out] USR - real*8(*,*): Data values
20 C> @param[in] I1 - integer: Actual first dimension of USR as
21 C> allocated within the calling program
22 C> @param[in] I2 - integer: Actual second dimension of USR as
23 C> allocated within the calling program
24 C> @param[out] IRET - integer: Number of replications of STR that were
25 C> actually read from the data subset
26 C> @param[in] STR - character*(*): String of blank-separated
27 C> Table B mnemonics in one-to-one
28 C> correspondence with the number of data
29 C> values that will be read from the data
30 C> subset within the first dimension of USR (see
31 C> [DX BUFR Tables](@ref dfbftab) for further
32 C> information about Table B mnemonics)
33 C>
34 C> <b>Program history log:</b>
35 C> - 1994-01-06 J. Woollen -- Original author
36 C> - 1998-07-08 J. Woollen -- Replaced call to Cray library routine
37 C> "ABORT" with call to new internal BUFRLIB
38 C> routine "BORT"
39 C> - 1999-11-18 J. Woollen -- Increased MAXMEM from 4 Mb to 8 Mb
40 C> - 2001-08-15 D. Keyser -- Increased MAXMEM from 8 Mb to 16 Mb
41 C> - 2004-11-15 D. Keyser -- Increased MAXMEM from 16 Mb to 50 Mb
42 C> - 2009-04-21 J. Ator -- Use errwrt()
43 C> - 2014-12-10 J. Ator -- Use modules instead of COMMON blocks
44 C>
45  SUBROUTINE ufbrms(IMSG,ISUB,USR,I1,I2,IRET,STR)
46 
47  USE moda_msgcwd
48  USE moda_msgmem
49 
50  COMMON /quiet / iprt
51 
52  CHARACTER*(*) str
53  CHARACTER*128 bort_str,errstr
54  CHARACTER*8 subset
55  REAL*8 usr(i1,i2)
56 
57 C-----------------------------------------------------------------------
58 C-----------------------------------------------------------------------
59 
60  iret = 0
61  IF(i1.LE.0) THEN
62  IF(iprt.GE.0) THEN
63  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
64  errstr = .LE.'BUFRLIB: UFBRMS - 4th ARG. (INPUT) IS 0, ' //
65  . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
66  CALL errwrt(errstr)
67  CALL errwrt(str)
68  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
69  CALL errwrt(' ')
70  ENDIF
71  goto 100
72  ELSEIF(i2.LE.0) THEN
73  IF(iprt.GE.0) THEN
74  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
75  errstr = .LE.'BUFRLIB: UFBRMS - 5th ARG. (INPUT) IS 0, ' //
76  . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
77  CALL errwrt(errstr)
78  CALL errwrt(str)
79  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
80  CALL errwrt(' ')
81  ENDIF
82  goto 100
83  ENDIF
84 
85 C UFBINT SUBSET #ISUB FROM MEMORY MESSAGE #IMSG
86 C ---------------------------------------------
87 
88  CALL rdmemm(imsg,subset,jdate,iret)
89  IF(iret.LT.0) goto 900
90  CALL rdmems(isub,iret)
91  IF(iret.NE.0) goto 901
92 
93  CALL ufbint(munit,usr,i1,i2,iret,str)
94 
95 C EXITS
96 C -----
97 
98 100 RETURN
99 900 IF(imsg.GT.0) THEN
100  WRITE(bort_str,'("BUFRLIB: UFBRMS - REQUESTED MEMORY MESSAGE '//
101  . 'NUMBER TO READ IN (",I5,") EXCEEDS THE NUMBER OF MESSAGES IN '//
102  . 'MEMORY (",I5,")")') imsg,msgp(0)
103  ELSE
104  WRITE(bort_str,'("BUFRLIB: UFBRMS - REQUESTED MEMORY MESSAGE '//
105  . 'NUMBER TO READ IN IS ZERO - THIS IS NOT VALID")')
106  ENDIF
107  CALL bort(bort_str)
108 901 CALL status(munit,lun,il,im)
109  WRITE(bort_str,'("BUFRLIB: UFBRMS - REQ. SUBSET NUMBER TO READ '//
110  . 'IN (",I3,") EXCEEDS THE NUMBER OF SUBSETS (",I3,") IN THE '//
111  . 'REQ. MEMORY MESSAGE (",I5,")")') isub,msub(lun),imsg
112  CALL bort(bort_str)
113  END
This module contains array and variable declarations used to store the contents of one or more BUFR f...
Definition: moda_msgmem.F:14
subroutine rdmemm(IMSG, SUBSET, JDATE, IRET)
This subroutine reads a specified BUFR message from internal arrays in memory, so that it is now in s...
Definition: rdmemm.f:62
subroutine rdmems(ISUB, IRET)
This subroutine reads a specified data subset from the BUFR message that was most recently read via a...
Definition: rdmems.f:48
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 errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:39
subroutine ufbint(LUNIN, USR, I1, I2, IRET, STR)
This subroutine reads or writes one or more data values from or to the BUFR data subset that is curre...
Definition: ufbint.f:160
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine ufbrms(IMSG, ISUB, USR, I1, I2, IRET, STR)
This subroutine provides a handy way to combine the functionality of subroutines rdmemm(), rdmems() and ufbint() within a single subroutine call.
Definition: ufbrms.f:45