NCEPLIBS-bufr  12.0.1
gettagre.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Check whether a Table B mnemonic references another
3 C> Table B mnemonic via an internal bitmap.
4 C>
5 C> @author J. Ator @date 2016-06-07
6 
7 C> This subroutine determines whether a specified Table B mnemonic
8 C> references another Table B mnemonic within the same data subset
9 C> via an internal bitmap, and if so returns the referenced
10 C> mnemonic and its location within the subset.
11 C>
12 C> @param[in] LUNIT -- integer: Fortran logical unit number for
13 C> BUFR file
14 C> @param[in] TAGI -- character*(*): Table B mnemonic
15 C> @param[in] NTAGI -- integer: Ordinal occurrence of TAGI for
16 C> which TAGRE is to be returned, counting from
17 C> the beginning of the overall subset definition
18 C> @param[out] TAGRE -- character*(*): Table B mnemonic referenced by
19 C> TAGI via an internal bitmap
20 C> @param[out] NTAGRE -- integer: Ordinal occurrence of TAGRE
21 C> referenced by (NTAGI)th occurrence of TAGI,
22 C> counting from the beginning of the overall
23 C> subset definition
24 C> @param[out] IRET -- integer: return code
25 C> - 0 = normal return
26 C> - -1 = TAGRE could not be found, or some
27 C> other error occurred
28 C>
29 C> A data subset must already be in scope within the BUFRLIB
30 C> internal arrays for LUNIT, either via a previous call to one
31 C> of the [subset-reading subroutines](@ref hierarchy)
32 C> (when reading BUFR data subsets) or via a previous call to one
33 C> of the [message-writing subroutines](@ref hierarchy)
34 C> (when writing BUFR data subsets).
35 C>
36 C> @author J. Ator @date 2016-06-07
37  RECURSIVE SUBROUTINE gettagre
38  . ( lunit, tagi, ntagi, tagre, ntagre, iret )
39 
40  USE moda_usrint
41  USE moda_msgcwd
42  USE moda_tables
43  USE modv_im8b
44 
45  CHARACTER*(*) tagi, tagre
46 
47  CHARACTER*10 tagtmp
48 
49 C----------------------------------------------------------------------
50 C----------------------------------------------------------------------
51 
52 C Check for I8 integers.
53 
54  IF(im8b) THEN
55  im8b=.false.
56 
57  CALL x84(lunit,my_lunit,1)
58  CALL x84(ntagi,my_ntagi,1)
59  CALL gettagre(my_lunit,tagi,my_ntagi,tagre,ntagre,iret)
60  CALL x48(ntagre,ntagre,1)
61  CALL x48(iret,iret,1)
62 
63  im8b=.true.
64  RETURN
65  ENDIF
66 
67  iret = -1
68 
69 C Get LUN from LUNIT.
70 
71  CALL status( lunit, lun, il, im )
72  IF ( il .EQ. 0 ) RETURN
73  IF ( inode(lun) .NE. inv(1,lun) ) RETURN
74 
75 C Get TAGRE and NTAGRE from the (NTAGI)th occurrence of TAGI.
76 
77  CALL fstag( lun, tagi, ntagi, 1, ni, iret )
78  IF ( iret .NE. 0 ) RETURN
79  nre = nrfelm(ni,lun)
80  IF ( nre .GT. 0 ) THEN
81  iret = 0
82  tagre = tag(inv(nre,lun))
83  CALL strsuc( tagre, tagtmp, ltre )
84  ntagre = 0
85  DO ii = 1, nre
86  IF ( tag(inv(ii,lun))(1:ltre) .EQ. tagre(1:ltre) ) THEN
87  ntagre = ntagre + 1
88  END IF
89  END DO
90  END IF
91 
92  RETURN
93  END
subroutine fstag(LUN, UTAG, NUTAG, NIN, NOUT, IRET)
This subroutine finds the (NUTAG)th occurrence of mnemonic UTAG within the current overall subset def...
Definition: fstag.f:26
recursive subroutine gettagre(LUNIT, TAGI, NTAGI, TAGRE, NTAGRE, IRET)
This subroutine determines whether a specified Table B mnemonic references another Table B mnemonic w...
Definition: gettagre.f:39
This module contains declarations for arrays used to store information about the current BUFR message...
integer, dimension(:), allocatable inode
Table A mnemonic for type of BUFR message.
This module contains array and variable declarations used to store the internal jump/link table.
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
This module contains declarations for arrays used to store data values and associated metadata for th...
integer, dimension(:,:), allocatable, target inv
Inventory pointer which links each data value to its corresponding node in the internal jump/link tab...
integer, dimension(:,:), allocatable nrfelm
Referenced data value, for data values which refer to a previous data value in the BUFR data subset v...
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
recursive subroutine status(LUNIT, LUN, IL, IM)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
Definition: status.f:36
subroutine strsuc(str1, str2, lens)
This subroutine removes leading and trailing blanks from a character string.
Definition: strsuc.F90:16
subroutine x48(IIN4, IOUT8, NVAL)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x48.F:19
subroutine x84(IIN8, IOUT4, NVAL)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x84.F:19