NCEPLIBS-bufr  12.0.1
igettdi.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Get the next usable Table D index for the
3 C> current master table, or reset the index.
4 C>
5 C> @author Ator @date 2009-03-23
6 
7 C> Get the next usable Table D index for the
8 C> current master table, or reset the index.
9 C>
10 C> Depending on the value of the input flag, this function
11 C> either returns the next usable scratch Table D index for the
12 C> current master table or else resets the index back to its
13 C> minimum value.
14 C>
15 C> @param[in] IFLAG - integer:
16 C> - if set to 0, then the function will reset the scratch Table D index
17 C> back to its minimum value
18 C> - otherwise, the function will return the next usable scratch Table D
19 C> index for the current master table
20 C>
21 C> @return - integer:
22 C> - -1 if function was called with IFLAG=0
23 C> - otherwise, the next usable scratch Table D index for the
24 C> current master table
25 C>
26 C> @author J. Ator @date 2009-03-23
27  FUNCTION igettdi ( IFLAG )
28 
29  parameter( idxmin = 62976 )
30 C* = IFXY('354000')
31 
32  parameter( idxmax = 63231 )
33 C* = IFXY('354255')
34 
35  SAVE idx
36 
37 C-----------------------------------------------------------------------
38 C-----------------------------------------------------------------------
39 
40  IF ( iflag .EQ. 0 ) THEN
41 
42 C* Initialize the index to one less than the actual minimum
43 C* value. That way, the next normal call will return the
44 C* minimum value.
45 
46  idx = idxmin - 1
47  igettdi = -1
48  ELSE
49  idx = idx + 1
50  IF ( idx .GT. idxmax ) GOTO 900
51  igettdi = idx
52  ENDIF
53 
54  RETURN
55  900 CALL bort('BUFRLIB: IGETTDI - IDXMAX OVERFLOW')
56  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
function igettdi(IFLAG)
Get the next usable Table D index for the current master table, or reset the index.
Definition: igettdi.f:28