NCEPLIBS-bufr  11.6.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> | Date | Programmer | Comments |
36 C> | -----|------------|----------|
37 C> | 2012-09-12 | J. Ator | Original author |
38 C> | 2014-10-02 | J. Ator | Modified to use fstag() |
39 C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
40 C>
41  SUBROUTINE gettagpr ( LUNIT, TAGCH, NTAGCH, TAGPR, IRET )
42 
43  USE moda_usrint
44  USE moda_msgcwd
45  USE moda_tables
46 
47  CHARACTER*(*) tagch, tagpr
48 
49 C----------------------------------------------------------------------
50 C----------------------------------------------------------------------
51 
52  iret = -1
53 
54 C Get LUN from LUNIT.
55 
56  CALL status( lunit, lun, il, im )
57  IF ( il .EQ. 0 ) RETURN
58  IF ( inode(lun) .NE. inv(1,lun) ) RETURN
59 
60 C Get TAGPR from the (NTAGCH)th occurrence of TAGCH.
61 
62  CALL fstag( lun, tagch, ntagch, 1, nch, iret )
63  IF ( iret .NE. 0 ) RETURN
64 
65  tagpr = tag(jmpb(inv(nch,lun)))
66 
67  RETURN
68  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:41
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 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