NCEPLIBS-bufr 11.7.1
lstjpb.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS FUNCTION SEARCHES BACKWARDS, BEGINNING FROM A GIVEN
5C> NODE WITHIN THE JUMP/LINK TABLE, UNTIL IT FINDS THE MOST RECENT
6C> NODE OF TYPE JBTYP. THE INTERNAL JMPB ARRAY IS USED TO JUMP
7C> BACKWARDS WITHIN THE JUMP/LINK TABLE, AND THE FUNCTION RETURNS
8C> THE TABLE INDEX OF THE FOUND NODE. IF THE INPUT NODE ITSELF IS
9C> OF TYPE JBTYP, THEN THE FUNCTION SIMPLY RETURNS THE INDEX OF THAT
10C> SAME NODE.
11C>
12C> PROGRAM HISTORY LOG:
13C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
14C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
15C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
16C> ROUTINE "BORT"
17C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
18C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
19C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
20C> BUFR FILES UNDER THE MPI)
21C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
22C> INTERDEPENDENCIES
23C> 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
24C> INCREASED FROM 15000 TO 16000 (WAS IN
25C> VERIFICATION VERSION); UNIFIED/PORTABLE FOR
26C> WRF; ADDED DOCUMENTATION (INCLUDING
27C> HISTORY); OUTPUTS MORE COMPLETE DIAGNOSTIC
28C> INFO WHEN ROUTINE TERMINATES ABNORMALLY
29C> 2009-03-31 J. WOOLLEN -- ADDED ADDITIONAL DOCUMENTATION
30C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
31C>
32C> USAGE: LSTJPB (NODE, LUN, JBTYP)
33C> INPUT ARGUMENT LIST:
34C> NODE - INTEGER: JUMP/LINK TABLE INDEX OF ENTRY TO BEGIN
35C> SEARCHING BACKWARDS FROM
36C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
37C> JBTYP - CHARACTER*(*): TYPE OF NODE FOR WHICH TO SEARCH
38C>
39C> OUTPUT ARGUMENT LIST:
40C> LSTJPB - INTEGER: INDEX OF FIRST NODE OF TYPE JBTYP FOUND BY
41C> JUMPING BACKWARDS FROM INPUT NODE
42C> 0 = NO SUCH NODE FOUND
43C>
44C> REMARKS:
45C>
46C> SEE THE DOCBLOCK IN BUFR ARCHIVE LIBRARY SUBROUTINE TABSUB FOR AN
47C> EXPLANATION OF THE VARIOUS NODE TYPES PRESENT WITHIN AN INTERNAL
48C> JUMP/LINK TABLE
49C>
50C> THIS ROUTINE CALLS: BORT
51C> THIS ROUTINE IS CALLED BY: GETWIN IGETRFEL NEVN NEWWIN
52C> NXTWIN PARUSR STRBTM TRYBUMP
53C> UFBRW
54C> Normally not called by any application
55C> programs.
56C>
57 FUNCTION lstjpb(NODE,LUN,JBTYP)
58
59 USE moda_msgcwd
60 USE moda_tables
61
62 CHARACTER*(*) jbtyp
63 CHARACTER*128 bort_str
64
65C----------------------------------------------------------------------
66C----------------------------------------------------------------------
67
68 IF(node.LT.inode(lun)) GOTO 900
69 IF(node.GT.isc(inode(lun))) GOTO 901
70
71 nod = node
72
73C FIND THIS OR THE PREVIOUS "JBTYP" NODE
74C --------------------------------------
75
7610 IF(typ(nod).NE.jbtyp) THEN
77 nod = jmpb(nod)
78 IF(nod.NE.0) GOTO 10
79 ENDIF
80
81 lstjpb = nod
82
83C EXITS
84C -----
85
86 RETURN
87900 WRITE(bort_str,'("BUFRLIB: LSTJPB - TABLE NODE (",I7,") IS OUT '//
88 . 'OF BOUNDS, < LOWER BOUNDS (",I7,"); TAG IS ",A10)')
89 . node,inode(lun),tag(node)
90 CALL bort(bort_str)
91901 WRITE(bort_str,'("BUFRLIB: LSTJPB - TABLE NODE (",I7,") IS OUT '//
92 . 'OF BOUNDS, > UPPER BOUNDS (",I7,"); TAG IS ",A10)')
93 . node,isc(inode(lun)),tag(node)
94 CALL bort(bort_str)
95 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
function lstjpb(NODE, LUN, JBTYP)
THIS FUNCTION SEARCHES BACKWARDS, BEGINNING FROM A GIVEN NODE WITHIN THE JUMP/LINK TABLE,...
Definition: lstjpb.f:58
This module contains array and variable declarations used to store the internal jump/link table.
Definition: moda_tables.F:13
integer, dimension(:), allocatable isc
Scale factors corresponding to tag and typ:
Definition: moda_tables.F:140
character *3, dimension(:), allocatable typ
Type indicators corresponding to tag:
Definition: moda_tables.F:133
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
Definition: moda_tables.F:132
integer, dimension(:), allocatable jmpb
Jump backward indices corresponding to tag and typ:
Definition: moda_tables.F:137