NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
igetfxy.f
Go to the documentation of this file.
1 C> @file
2 C> @author ATOR @date 2007-01-19
3 
4 C> THIS FUNCTION LOOKS FOR AND RETURNS A VALID FXY NUMBER
5 C> FROM WITHIN THE GIVEN INPUT STRING. THE FXY NUMBER MAY BE IN
6 C> FORMAT OF EITHER FXXYYY OR F-XX-YYY WITHIN THE INPUT STRING, BUT
7 C> IT IS ALWAYS RETURNED IN FORMAT FXXYYY UPON OUTPUT.
8 C>
9 C> PROGRAM HISTORY LOG:
10 C> 2007-01-19 J. ATOR -- ORIGINAL AUTHOR
11 C>
12 C> USAGE: IGETFXY ( STR, CFXY )
13 C> INPUT ARGUMENT LIST:
14 C> STR - CHARACTER*(*): INPUT STRING
15 C>
16 C> OUTPUT ARGUMENT LIST:
17 C> CFXY - CHARACTER*6: FXY NUMBER IN FORMAT FXXYYY
18 C> IGETFXY - INTEGER: RETURN CODE:
19 C> 0 = normal return
20 C> -1 = could not find a valid FXY number in STR
21 C>
22 C> REMARKS:
23 C> THIS ROUTINE CALLS: JSTCHR NUMBCK
24 C> THIS ROUTINE IS CALLED BY: GETNTBE SNTBDE SNTBFE
25 C> Normally not called by any application
26 C> programs.
27 C>
28  FUNCTION igetfxy ( STR, CFXY )
29 
30 
31 
32  character*(*) str
33  character*6 cfxy
34 
35  parameter( lstr2 = 120 )
36  CHARACTER*(LSTR2) str2
37 
38 C-----------------------------------------------------------------------
39 C-----------------------------------------------------------------------
40 
41  igetfxy = -1
42 
43  lstr = len( str )
44  IF ( lstr .LT. 6 ) RETURN
45 
46 C Left-justify a copy of the input string.
47 
48  IF ( lstr .GT. lstr2 ) THEN
49  str2(1:lstr2) = str(1:lstr2)
50  ELSE
51  str2 = str
52  ENDIF
53  CALL jstchr( str2, iret )
54  IF ( iret .NE. 0 ) RETURN
55 
56 C Look for an FXY number.
57 
58  IF ( index( str2, '-' ) .NE. 0 ) THEN
59 C Format of field is F-XX-YYY.
60  cfxy(1:1) = str2(1:1)
61  cfxy(2:3) = str2(3:4)
62  cfxy(4:6) = str2(6:8)
63  ELSE
64 C Format of field is FXXYYY.
65  cfxy = str2(1:6)
66  ENDIF
67 
68 C Check that the FXY number is valid.
69 
70  IF ( numbck( cfxy ) .EQ. 0 ) igetfxy = 0
71 
72  RETURN
73  END
function numbck(NUMB)
THIS FUNCTION CHECKS THE INPUT CHARACTER STRING TO DETERMINE WHETHER IT CONTAINS A VALID FXY (DESCRIP...
Definition: numbck.f:46
function igetfxy(STR, CFXY)
THIS FUNCTION LOOKS FOR AND RETURNS A VALID FXY NUMBER FROM WITHIN THE GIVEN INPUT STRING...
Definition: igetfxy.f:28
subroutine jstchr(STR, IRET)
THIS SUBROUTINE LEFT-JUSTIFIES (I.E.
Definition: jstchr.f:43