NCEPLIBS-bufr  12.0.0
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 C>
5 C> @author J. Ator @date 2012-09-12
6 
7 C> This subroutine returns the Table D mnemonic corresponding to the
8 C> parent sequence of a specified Table B or Table D mnemonic within
9 C> a data subset definition.
10 C>
11 C> @param[in] LUNIT -- integer: Fortran logical unit number for
12 C> BUFR file
13 C> @param[in] TAGCH -- character*(*): Table B or Table D mnemonic
14 C> @param[in] NTAGCH -- integer: Ordinal occurrence of TAGCH for
15 C> which the parent Table D mnemonic is to be
16 C> returned, counting from the beginning of the
17 C> overall subset definition
18 C> @param[out] TAGPR -- character*(*): Table D mnemonic corresponding
19 C> to parent sequence of (NTAGCH)th occurrence
20 C> of TAGCH
21 C> @param[out] IRET -- integer: return code
22 C> - 0 = normal return
23 C> - -1 = TAGPR could not be found, or some
24 C> other error occurred
25 C>
26 C> A data subset must already be in scope within the BUFRLIB
27 C> internal arrays for LUNIT, either via a previous call to one
28 C> of the [subset-reading subroutines](@ref hierarchy)
29 C> (when reading BUFR data subsets) or via a previous call to one
30 C> of the [message-writing subroutines](@ref hierarchy)
31 C> (when writing BUFR data subsets).
32 C>
33 C> @author J. Ator @date 2012-09-12
34  RECURSIVE SUBROUTINE gettagpr
35  . ( lunit, tagch, ntagch, tagpr, iret )
36 
37  USE moda_usrint
38  USE moda_msgcwd
39  USE moda_tables
40  USE modv_im8b
41 
42  CHARACTER*(*) tagch, tagpr
43 
44 C----------------------------------------------------------------------
45 C----------------------------------------------------------------------
46 
47 C Check for I8 integers.
48 
49  IF(im8b) THEN
50  im8b=.false.
51 
52  CALL x84 ( lunit, my_lunit, 1 )
53  CALL x84 ( ntagch, my_ntagch, 1 )
54  CALL gettagpr ( my_lunit, tagch, my_ntagch, tagpr, iret )
55  CALL x48 ( iret, iret, 1 )
56 
57  im8b=.true.
58  RETURN
59  ENDIF
60 
61  iret = -1
62 
63 C Get LUN from LUNIT.
64 
65  CALL status( lunit, lun, il, im )
66  IF ( il .EQ. 0 ) RETURN
67  IF ( inode(lun) .NE. inv(1,lun) ) RETURN
68 
69 C Get TAGPR from the (NTAGCH)th occurrence of TAGCH.
70 
71  CALL fstag( lun, tagch, ntagch, 1, nch, iret )
72  IF ( iret .NE. 0 ) RETURN
73 
74  tagpr = tag(jmpb(inv(nch,lun)))
75 
76  RETURN
77  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 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:36
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.
integer, dimension(:), allocatable jmpb
Jump backward indices corresponding to tag and typ:
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...
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 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