1 SUBROUTINE PKTDD
(ID
,LUN
,IDN
,IRET
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS SUBROUTINE STORES INFORMATION ABOUT A "CHILD"
9 C MNEMONIC WITHIN THE INTERNAL BUFR TABLE D ENTRY (IN COMMON BLOCK
10 C /TABABD/) FOR A TABLE D SEQUENCE ("PARENT") MNEMONIC WHEN THE
11 C "CHILD" MNEMONIC IS CONTAINED WITHIN THE SEQUENCE REPRESENTED BY
12 C THE "PARENT" MNEMONIC (AS DETERMINED WITHIN BUFR ARCHIVE LIBRARY
15 C PROGRAM HISTORY LOG:
16 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
17 C 1995-06-28 J. WOOLLEN -- INCREASED THE SIZE OF INTERNAL BUFR TABLE
18 C ARRAYS IN ORDER TO HANDLE BIGGER FILES
19 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
20 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
21 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
22 C BUFR FILES UNDER THE MPI)
23 C 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
24 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
26 C 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
27 C DOCUMENTATION; ADDED MORE COMPLETE
28 C DIAGNOSTIC INFO WHEN UNUSUAL THINGS HAPPEN
29 C 2009-04-21 J. ATOR -- USE ERRWRT
31 C USAGE: CALL PKTDD (ID, LUN, IDN, IRET)
32 C INPUT ARGUMENT LIST:
33 C ID - INTEGER: POSITIONAL INDEX OF PARENT MNEMONIC WITHIN
34 C INTERNAL BUFR TABLE D ARRAY TABD(*,*)
35 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
36 C IDN - INTEGER: BIT-WISE REPRESENTATION OF FXY VALUE
37 C CORRESPONDING TO CHILD MNEMONIC
38 C 0 = delete all information about all child
39 C mnemonics from within TABD(ID,LUN)
41 C OUTPUT ARGUMENT LIST:
42 C IRET - INTEGER: TOTAL NUMBER OF CHILD MNEMONICS STORED THUS
43 C FAR (INCLUDING IDN) FOR THE PARENT MNEMONIC GIVEN BY
45 C 0 = information was cleared from TABD(ID,LUN)
46 C because input IDN value was 0
47 C -1 = bad counter value or maximum number of
48 C child mnemonics already stored for this
52 C THIS ROUTINE CALLS: ERRWRT IPKM IUPM
53 C THIS ROUTINE IS CALLED BY: DXINIT SEQSDX STBFDX STSEQ
54 C Normally not called by any application
58 C LANGUAGE: FORTRAN 77
59 C MACHINE: PORTABLE TO ALL PLATFORMS
65 COMMON /TABABD
/ NTBA
(0:NFILES
),NTBB
(0:NFILES
),NTBD
(0:NFILES
),
66 . MTAB
(MAXTBA
,NFILES
),IDNA
(MAXTBA
,NFILES
,2),
67 . IDNB
(MAXTBB
,NFILES
),IDND
(MAXTBD
,NFILES
),
68 . TABA
(MAXTBA
,NFILES
),TABB
(MAXTBB
,NFILES
),
70 COMMON /DXTAB
/ MAXDX
,IDXV
,NXSTR
(10),LDXA
(10),LDXB
(10),LDXD
(10),
80 C-----------------------------------------------------------------------
81 C-----------------------------------------------------------------------
85 C LDD points to the byte within TABD(ID,LUN) which contains (in
86 C packed integer format) a count of the number of child mnemonics
87 C stored thus far for this parent mnemonic.
89 C ZERO THE COUNTER IF IDN IS ZERO
90 C -------------------------------
93 CALL IPKM
(TABD
(ID
,LUN
)(LDD
:LDD
),1,0)
98 C UPDATE THE STORED DESCRIPTOR COUNT FOR THIS TABLE D ENTRY
99 C ---------------------------------------------------------
101 ND
= IUPM
(TABD
(ID
,LUN
)(LDD
:LDD
),8)
103 C ND is the (unpacked) count of the number of child mnemonics
104 C stored thus far for this parent mnemonic.
106 IF(ND
.LT
.0 .OR
. ND
.EQ
.MAXCD
) THEN
108 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
110 WRITE ( UNIT
=ERRSTR
, FMT
='(A,I4,A)' )
111 . 'BUFRLIB: PKTDD - BAD COUNTER VALUE (=', ND
,
112 . ') - RETURN WITH IRET = -1'
114 WRITE ( UNIT
=ERRSTR
, FMT
='(A,I4,A,A)' )
115 . 'BUFRLIB: PKTDD - MAXIMUM NUMBER OF CHILD MNEMONICS (=',
116 . MAXCD
, ') ALREADY STORED FOR THIS PARENT - RETURN WITH ',
120 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
127 CALL IPKM
(TABD
(ID
,LUN
)(LDD
:LDD
),1,ND
)
131 C PACK AND STORE THE DESCRIPTOR
132 C -----------------------------
134 IDM
= LDD
+1 + (ND
-1)*2
136 C IDM points to the starting byte within TABD(ID,LUN) at which
137 C the IDN value for this child mnemonic will be stored (as a
138 C packed integer of width = 2 bytes).
140 CALL IPKM
(TABD
(ID
,LUN
)(IDM
:IDM
),2,IDN
)