NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
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 
5 C> This subroutine determines whether a specified Table B mnemonic
6 C> references another Table B mnemonic within the same data subset
7 C> via an internal bitmap, and if so returns the referenced
8 C> mnemonic and its location within the subset.
9 C>
10 C> @author J. Ator
11 C> @date 2016-06-07
12 C>
13 C> @param[in] LUNIT -- integer: Fortran logical unit number for
14 C> BUFR file
15 C> @param[in] TAGI -- character*(*): Table B mnemonic
16 C> @param[in] NTAGI -- integer: Ordinal occurrence of TAGI for
17 C> which TAGRE is to be returned, counting from
18 C> the beginning of the overall subset definition
19 C> @param[out] TAGRE -- character*(*): Table B mnemonic referenced by
20 C> TAGI via an internal bitmap
21 C> @param[out] NTAGRE -- integer: Ordinal occurrence of TAGRE
22 C> referenced by (NTAGI)th occurrence of TAGI,
23 C> counting from the beginning of the overall
24 C> subset definition
25 C> @param[out] IRET -- integer: return code
26 C> - 0 = normal return
27 C> - -1 = TAGRE could not be found, or some
28 C> other error occurred
29 C>
30 C> <p>A data subset must already be in scope within the BUFRLIB
31 C> internal arrays for LUNIT, either via a previous call to one
32 C> of the [subset-reading subroutines](@ref hierarchy)
33 C> (when reading BUFR data subsets) or via a previous call to one
34 C> of the [message-writing subroutines](@ref hierarchy)
35 C> (when writing BUFR data subsets).
36 C>
37 C> <b>Program history log:</b>
38 C> | Date | Programmer | Comments |
39 C> | -----|------------|----------|
40 C> | 2016-06-07 | J. Ator | Original author |
41 C>
42  SUBROUTINE gettagre ( LUNIT, TAGI, NTAGI, TAGRE, NTAGRE, IRET )
43 
44  USE moda_usrint
45  USE moda_msgcwd
46  USE moda_tables
47 
48  CHARACTER*(*) tagi, tagre
49 
50  CHARACTER*10 tagtmp
51 
52 C----------------------------------------------------------------------
53 C----------------------------------------------------------------------
54 
55  iret = -1
56 
57 C Get LUN from LUNIT.
58 
59  CALL status( lunit, lun, il, im )
60  IF ( il .EQ. 0 ) RETURN
61  IF ( inode(lun) .NE. inv(1,lun) ) RETURN
62 
63 C Get TAGRE and NTAGRE from the (NTAGI)th occurrence of TAGI.
64 
65  CALL fstag( lun, tagi, ntagi, 1, ni, iret )
66  IF ( iret .NE. 0 ) RETURN
67  nre = nrfelm(ni,lun)
68  IF ( nre .GT. 0 ) THEN
69  iret = 0
70  tagre = tag(inv(nre,lun))
71  CALL strsuc( tagre, tagtmp, ltre )
72  ntagre = 0
73  DO ii = 1, nre
74  IF ( tag(inv(ii,lun))(1:ltre) .EQ. tagre(1:ltre) ) THEN
75  ntagre = ntagre + 1
76  END IF
77  END DO
78  END IF
79 
80  RETURN
81  END
subroutine strsuc(STR1, STR2, LENS)
This subroutine removes leading and trailing blanks from a character string.
Definition: strsuc.f:23
This module contains array and variable declarations used to store the internal jump/link table...
Definition: moda_tables.F:13
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 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:42
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:40