1 SUBROUTINE PARUSR
(STR
,LUN
,I1
,IO
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS SUBROUTINE INITATES THE PROCESS TO PARSE OUT MNEMONICS
9 C (NODES) FROM A USER-SPECIFIED CHARACTER STRING, AND SEPARATES THEM
10 C INTO STORE AND CONDITION NODES. INFORMATION ABOUT THE STRING
11 C "PIECES" (I.E., THE MNEMONICS) IS STORED IN ARRAYS IN COMMON BLOCK
12 C /USRSTR/. CONDITION NODES ARE SORTED IN THE ORDER EXPECTED IN THE
13 C INTERNAL JUMP/LINK TABLES AND SEVERAL CHECKS ARE PERFORMED ON THE
16 C PROGRAM HISTORY LOG:
17 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
18 C 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
19 C "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
20 C ROUTINE "BORT"; IMPROVED MACHINE
22 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
24 C 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
25 C DOCUMENTATION (INCLUDING HISTORY); OUTPUTS
26 C MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
27 C TERMINATES ABNORMALLY; CHANGED CALL FROM
28 C BORT TO BORT2; RESPONDED TO CHANGE IN
29 C PARUTG (WHICH THIS ROUTINE CALLS) TO NO
30 C LONGER EXPECT AN ALTERNATE RETURN TO A
31 C STATEMENT NUMBER IN THIS ROUTINE WHICH
32 C CALLED BORT (BORT IS NOW CALLED IN PARUTG)
33 C 2007-01-19 J. ATOR -- REPLACED CALL TO PARSEQ WITH CALL TO PARSTR
34 C 2009-05-07 J. ATOR -- USE LSTJPB INSTEAD OF LSTRPC
36 C USAGE: CALL PARUSR (STR, LUN, I1, IO)
37 C INPUT ARGUMENT LIST:
38 C STR - CHARACTER*(*): STRING OF BLANK-SEPARATED MNEMONICS
39 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
40 C I1 - INTEGER: A NUMBER GREATER THAN OR EQUAL TO THE NUMBER
41 C OF BLANK-SEPARATED MNEMONICS IN STR
42 C IO - INTEGER: STATUS INDICATOR FOR BUFR FILE ASSOCIATED
48 C THIS ROUTINE CALLS: BORT2 LSTJPB PARSTR PARUTG
49 C THIS ROUTINE IS CALLED BY: STRING
50 C Normally not called by any application
54 C LANGUAGE: FORTRAN 77
55 C MACHINE: PORTABLE TO ALL PLATFORMS
59 COMMON /USRSTR
/ NNOD
,NCON
,NODS
(20),NODC
(10),IVLS
(10),KONS
(10)
63 CHARACTER*128 BORT_STR1
,BORT_STR2
72 C----------------------------------------------------------------------
73 C----------------------------------------------------------------------
76 IF(LEN
(STR
).GT
.80) GOTO 900
81 C PARSE OUT STRING PIECES(S) (UTG's or MNEMONICS)
82 C -----------------------------------------------
84 CALL PARSTR
(UST
,UTG
,MAXUSR
,NTOT
,' ',.TRUE
.)
88 C DETERMINE IF THIS UTG IS A CONDITION NODE OR A STORE NODE
89 C ---------------------------------------------------------
91 CALL PARUTG
(LUN
,IO
,UTG
(N
),NOD
,KON
,VAL
)
93 c .... it is a condition node
95 IF(NCON
.GT
.MAXCON
) GOTO 901
98 IVLS
(NCON
) = NINT
(VAL
)
100 c .... it is a store node
102 IF(NNOD
.GT
.MAXNOD
) GOTO 902
107 C SORT CONDITION NODES IN JUMP/LINK TABLE ORDER
108 C ---------------------------------------------
112 IF(NODC
(I
).GT
.NODC
(J
)) THEN
128 C CHECK ON SPECIAL RULES FOR CONDITIONAL NODES THAT ARE BUMP NODES
129 C ----------------------------------------------------------------
134 IF(KONS
(N
).EQ
.5) THEN
136 IF(N
.NE
.NCON
) GOTO 904
141 C CHECK STORE NODE COUNT AND ALIGNMENT
142 C ------------------------------------
144 IF(.NOT
.BUMP
.AND
. NNOD
.EQ
.0) GOTO 905
145 IF(NNOD
.GT
.I1
) GOTO 906
149 IF(NODS
(I
).GT
.0) THEN
150 IF(IRPC
.LT
.0) IRPC
= LSTJPB
(NODS
(I
),LUN
,'RPC')
151 IF(IRPC
.NE
.LSTJPB
(NODS
(I
),LUN
,'RPC').AND
.IAC
.EQ
.0) GOTO 907
159 900 WRITE(BORT_STR1
,'("BUFRLIB: PARUSR - INPUT STRING (",A,") HAS ")')
161 WRITE(BORT_STR2
,'(18X,"LENGTH (",I4,"), > LIMIT OF 80 CHAR.")')
163 CALL BORT2
(BORT_STR1
,BORT_STR2
)
164 901 WRITE(BORT_STR1
,'("BUFRLIB: PARUSR - THE NUMBER OF CONDITION '//
165 . 'NODES IN INPUT STRING")')
166 WRITE(BORT_STR2
,'(18X,A,") EXCEEDS THE MAXIMUM (",I3,")")')
168 CALL BORT2
(BORT_STR1
,BORT_STR2
)
169 902 WRITE(BORT_STR1
,'("BUFRLIB: PARUSR - THE NUMBER OF STORE NODES '//
170 . 'IN INPUT STRING")')
171 WRITE(BORT_STR2
,'(18X,A,") EXCEEDS THE MAXIMUM (",I3,")")')
173 CALL BORT2
(BORT_STR1
,BORT_STR2
)
174 903 WRITE(BORT_STR1
,'("BUFRLIB: PARUSR - BUMP NODE (^ IN INPUT '//
176 WRITE(BORT_STR2
,'(18X,"IS SPECIFIED FOR A BUFR FILE OPEN FOR '//
177 . 'INPUT, THE BUFR FILE MUST BE OPEN FOR OUTPUT")')
178 CALL BORT2
(BORT_STR1
,BORT_STR2
)
179 904 WRITE(BORT_STR1
,'("BUFRLIB: PARUSR - INPUT STRING (",A,") '//
181 WRITE(BORT_STR2
,'(18X,"CONDITIONAL NODES IN ADDITION TO BUMP '//
182 . 'NODE - THE BUMP MUST BE ON THE INNER NODE")')
183 CALL BORT2
(BORT_STR1
,BORT_STR2
)
184 905 WRITE(BORT_STR1
,'("BUFRLIB: PARUSR - INPUT STRING (",A,") HAS")')
186 WRITE(BORT_STR2
,'(18X,"NO STORE NODES")')
187 CALL BORT2
(BORT_STR1
,BORT_STR2
)
188 906 WRITE(BORT_STR1
,'("BUFRLIB: PARUSR - INPUT STRING (",A,")")') STR
189 WRITE(BORT_STR2
,'(18X,"HAS",I5," STORE NODES (MNEMONICS) - THE '//
190 . 'LIMIT {THIRD (INPUT) ARGUMENT} IS",I5)') NNOD
,I1
191 CALL BORT2
(BORT_STR1
,BORT_STR2
)
192 907 WRITE(BORT_STR1
,'("BUFRLIB: PARUSR - INPUT STRING (",A,") '//
194 WRITE(BORT_STR2
,'(18X,"STORE NODES (MNEMONICS) THAT ARE IN MORE'//
195 . ' THAN ONE REPLICATION GROUP")')
196 CALL BORT2
(BORT_STR1
,BORT_STR2
)