NCEPLIBS-bufr 11.7.1
igettdi.f
Go to the documentation of this file.
1C> @file
2C> @author ATOR @date 2009-03-23
3
4C> DEPENDING ON THE VALUE OF THE INPUT FLAG, THIS FUNCTION
5C> EITHER RETURNS THE NEXT USABLE SCRATCH TABLE D INDEX FOR THE
6C> CURRENT MASTER TABLE OR ELSE RESETS THE INDEX BACK TO ITS
7C> MINIMUM VALUE.
8C>
9C> PROGRAM HISTORY LOG:
10C> 2009-03-23 J. ATOR -- ORIGINAL AUTHOR
11C>
12C> USAGE: IGETTDI ( IFLAG )
13C> INPUT ARGUMENT LIST:
14C> IFLAG - INTEGER: FLAG: IF SET TO 0, THEN THE FUNCTION WILL
15C> RESET THE SCRATCH TABLE D INDEX BACK TO ITS MINIMUM
16C> VALUE; OTHERWISE, IT WILL RETURN THE NEXT USABLE
17C> SCRATCH TABLE D INDEX FOR THE CURRENT MASTER TABLE
18C>
19C> OUTPUT ARGUMENT LIST:
20C> IGETTDI - INTEGER: NEXT USABLE SCRATCH TABLE D INDEX FOR THE
21C> CURRENT MASTER TABLE
22C> -1 = FUNCTION WAS CALLED WITH IFLAG=0
23C>
24C> REMARKS:
25C> THIS ROUTINE CALLS: BORT
26C> THIS ROUTINE IS CALLED BY: READS3 STSEQ
27C> Not normally called by application
28C> programs.
29C>
30 FUNCTION igettdi ( IFLAG )
31
32
33
34 parameter( idxmin = 62976 )
35C* = IFXY('354000')
36
37 parameter( idxmax = 63231 )
38C* = IFXY('354255')
39
40 character*128 bort_str
41
42 SAVE idx
43
44C-----------------------------------------------------------------------
45C-----------------------------------------------------------------------
46
47 IF ( iflag .EQ. 0 ) THEN
48
49C* Initialize the index to one less than the actual minimum
50C* value. That way, the next normal call will return the
51C* minimum value.
52
53 idx = idxmin - 1
54 igettdi = -1
55 ELSE
56 idx = idx + 1
57 IF ( idx .GT. idxmax ) GOTO 900
58 igettdi = idx
59 ENDIF
60
61 RETURN
62 900 CALL bort('BUFRLIB: IGETTDI - IDXMAX OVERFLOW')
63 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
function igettdi(IFLAG)
DEPENDING ON THE VALUE OF THE INPUT FLAG, THIS FUNCTION EITHER RETURNS THE NEXT USABLE SCRATCH TABLE ...
Definition: igettdi.f:31