1 SUBROUTINE GETTAGPR
( LUNIT
, TAGCH
, NTAGCH
, TAGPR
, IRET
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: J. ATOR ORG: NP12 DATE: 2012-09-12
8 C ABSTRACT: GIVEN A MNEMONIC CORRESPONDING TO A CHILD DESCRIPTOR
9 C WITHIN A PARENT SEQUENCE, THIS SUBROUTINE RETURNS THE MNEMONIC
10 C CORRESPONDING TO THE PARENT SEQUENCE. A SUBSET DEFINITION MUST
11 C ALREADY BE IN SCOPE, EITHER VIA A PREVIOUS CALL TO BUFR ARCHIVE
12 C LIBRARY SUBROUTINE READSB OR EQUIVALENT (FOR INPUT FILES) OR TO
13 C SUBROUTINE OPENMB OR EQUIVALENT (FOR OUTPUT FILES). IF THERE IS
14 C MORE THAN ONE OCCURRENCE OF THE CHILD DESCRIPTOR WITHIN THE
15 C OVERALL SUBSET DEFINITION, THIS SUBROUTINE WILL RETURN THE PARENT
16 C MNEMONIC CORRESPONDING TO THE (NTAGCH)th OCCURRENCE OF THE CHILD,
17 C COUNTING FROM THE BEGINNING OF THE OVERALL SUBSET DEFINITION.
19 C PROGRAM HISTORY LOG:
20 C 2012-09-12 J. ATOR -- ORIGINAL AUTHOR
22 C USAGE: CALL GETTAGPR (LUNIT, TAGCH, NTAGCH, TAGPR, IRET)
23 C INPUT ARGUMENT LIST:
24 C LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
25 C TAGCH - CHARACTER*(*): MNEMONIC CORRESPONDING TO CHILD
27 C NTAGCH - INTEGER: ORDINAL OCCURRENCE OF TAGCH FOR WHICH
28 C TAGPR IS TO BE RETURNED, COUNTING FROM THE
29 C BEGINNING OF THE OVERALL SUBSET DEFINITION
31 C OUTPUT ARGUMENT LIST:
32 C TAGPR - CHARACTER*(*): MNEMONIC CORRESPONDING TO PARENT
34 C IRET - INTEGER: RETURN CODE
36 C -1 = PARENT MNEMONIC COULD NOT BE FOUND, OR SOME
37 C OTHER ERROR OCCURRED
40 C THIS ROUTINE CALLS: PARSTR STATUS
41 C THIS ROUTINE IS CALLED BY: None
42 C Normally called only by application
46 C LANGUAGE: FORTRAN 77
47 C MACHINE: PORTABLE TO ALL PLATFORMS
53 COMMON /MSGCWD
/ NMSG
(NFILES
),NSUB
(NFILES
),MSUB
(NFILES
),
54 . INODE
(NFILES
),IDATE
(NFILES
)
55 COMMON /BTABLES
/ MAXTAB
,NTAB
,TAG
(MAXJL
),TYP
(MAXJL
),KNT
(MAXJL
),
56 . JUMP
(MAXJL
),LINK
(MAXJL
),JMPB
(MAXJL
),
57 . IBT
(MAXJL
),IRF
(MAXJL
),ISC
(MAXJL
),
58 . ITP
(MAXJL
),VALI
(MAXJL
),KNTI
(MAXJL
),
59 . ISEQ
(MAXJL
,2),JSEQ
(MAXJL
)
60 COMMON /USRINT
/ NVAL
(NFILES
),INV
(MAXSS
,NFILES
),VAL
(MAXSS
,NFILES
)
62 CHARACTER*10 TAG
,TGS
(15)
65 CHARACTER*
(*) TAGCH
, TAGPR
71 C----------------------------------------------------------------------
72 C----------------------------------------------------------------------
78 CALL STATUS
(LUNIT
,LUN
,IL
,IM
)
80 IF (INODE
(LUN
).NE
.INV
(1,LUN
)) RETURN
82 C Get TAGPR from the (NTAGCH)th occurrence of TAGCH.
84 CALL PARSTR
(TAGCH
,TGS
,MAXTG
,NTG
,' ',.TRUE
.)
90 IF(TGS
(1).EQ
.TAG
(NOD
)) THEN
92 IF(ITAGCT
.EQ
.NTAGCH
) THEN
93 TAGPR
= TAG
(JMPB
(NOD
))