NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
gettagpr.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Get the parent for a specified occurrence of a Table B or
3 C> Table D mnemonic.
4 
5 C> This subroutine returns the Table D mnemonic corresponding to the
6 C> parent sequence of a specified Table B or Table D mnemonic within
7 C> a data subset definition.
8 C>
9 C> @author J. Ator
10 C> @date 2012-09-12
11 C>
12 C> @param[in] LUNIT - integer: Fortran logical unit number for
13 C> BUFR file
14 C> @param[in] TAGCH - character*(*): Table B or Table D mnemonic
15 C> @param[in] NTAGCH - integer: Ordinal occurrence of TAGCH for
16 C> which the parent Table D mnemonic is to be
17 C> returned, counting from the beginning of the
18 C> overall subset definition
19 C> @param[out] TAGPR - character*(*): Table D mnemonic corresponding
20 C> to parent sequence of (NTAGCH)th occurrence
21 C> of TAGCH
22 C> @param[out] IRET - integer: return code
23 C> - 0 = normal return
24 C> - -1 = TAGPR could not be found, or some
25 C> other error occurred
26 C>
27 C> <p>A data subset must already be in scope within the BUFRLIB
28 C> internal arrays for LUNIT, either via a previous call to one
29 C> of the [subset-reading subroutines](@ref hierarchy)
30 C> (when reading BUFR data subsets) or via a previous call to one
31 C> of the [message-writing subroutines](@ref hierarchy)
32 C> (when writing BUFR data subsets).
33 C>
34 C> <b>Program history log:</b>
35 C> - 2012-09-12 J. Ator -- Original author
36 C> - 2014-10-02 J. Ator -- Modified to use fstag()
37 C> - 2014-12-10 J. Ator -- Use modules instead of COMMON blocks
38 C>
39  SUBROUTINE gettagpr ( LUNIT, TAGCH, NTAGCH, TAGPR, IRET )
40 
41  USE moda_usrint
42  USE moda_msgcwd
43  USE moda_tables
44 
45  CHARACTER*(*) tagch, tagpr
46 
47 C----------------------------------------------------------------------
48 C----------------------------------------------------------------------
49 
50  iret = -1
51 
52 C Get LUN from LUNIT.
53 
54  CALL status( lunit, lun, il, im )
55  IF ( il .EQ. 0 ) RETURN
56  IF ( inode(lun) .NE. inv(1,lun) ) RETURN
57 
58 C Get TAGPR from the (NTAGCH)th occurrence of TAGCH.
59 
60  CALL fstag( lun, tagch, ntagch, 1, nch, iret )
61  IF ( iret .NE. 0 ) RETURN
62 
63  tagpr = tag(jmpb(inv(nch,lun)))
64 
65  RETURN
66  END
subroutine gettagpr(LUNIT, TAGCH, NTAGCH, TAGPR, IRET)
This subroutine returns the Table D mnemonic corresponding to the parent sequence of a specified Tabl...
Definition: gettagpr.f:39
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:61
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