updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / external / bufr / idn30.f
blob8f2579fa1c72fe0c9c60b4268863ea5ae2bd4365
1 FUNCTION IDN30(ADN30,L30)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: IDN30
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS FUNCTION CONVERTS A DESCRIPTOR FROM ITS FIVE OR SIX
9 C CHARACTER ASCII REPRESENTATION TO ITS BIT-WISE (INTEGER)
10 C REPRESENTATION.
12 C PROGRAM HISTORY LOG:
13 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
14 C 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
15 C "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
16 C ROUTINE "BORT"
17 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
18 C INTERDEPENDENCIES
19 C 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
20 C DOCUMENTATION (INCLUDING HISTORY); OUTPUTS
21 C MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
22 C TERMINATES ABNORMALLY
24 C USAGE: IDN30 (ADN30, L30)
25 C INPUT ARGUMENT LIST:
26 C ADN30 - CHARACTER*(*): CHARACTER FORM OF DESCRIPTOR (FXY
27 C VALUE)
28 C L30 - INTEGER: LENGTH OF ADN30 (NUMBER OF CHARACTERS, 5 OR
29 C 6)
31 C OUTPUT ARGUMENT LIST:
32 C IDN - INTEGER: BIT-WISE REPRESENTATION OF DESCRIPTOR (FXY)
33 C VALUE
35 C REMARKS:
36 C THIS ROUTINE CALLS: ADN30 BORT IFXY
37 C THIS ROUTINE IS CALLED BY: STBFDX
38 C Normally not called by any application
39 C programs.
41 C ATTRIBUTES:
42 C LANGUAGE: FORTRAN 77
43 C MACHINE: PORTABLE TO ALL PLATFORMS
45 C$$$
47 COMMON /HRDWRD/ NBYTW,NBITW,IORD(8)
49 CHARACTER*(*) ADN30
50 CHARACTER*128 BORT_STR
52 C----------------------------------------------------------------------
53 C----------------------------------------------------------------------
55 IF(LEN(ADN30).LT.L30) GOTO 900
56 IF(L30.EQ.5) THEN
57 READ(ADN30,'(I5)') IDN30
58 IF(IDN30.LT.0 .OR. IDN30.GT.65535) GOTO 901
59 ELSEIF(L30.EQ.6) THEN
60 IDN30 = IFXY(ADN30)
61 ELSE
62 GOTO 902
63 ENDIF
65 C EXITS
66 C -----
68 RETURN
69 900 WRITE(BORT_STR,'("BUFRLIB: IDN30 - FUNCTION INPUT STRING ",A,'//
70 . '" CHARACTER LENGTH (",I4,") IS TOO SHORT (< L30,",I5)')
71 . ADN30,LEN(ADN30),L30
72 CALL BORT(BORT_STR)
73 901 WRITE(BORT_STR,'("BUFRLIB: IDN30 - DESCRIPTOR INTEGER '//
74 . 'REPRESENTATION, IDN30 (",I8,"), IS OUTSIDE 16-BIT RANGE '//
75 . '(0-65535)")') IDN30
76 CALL BORT(BORT_STR)
77 902 WRITE(BORT_STR,'("BUFRLIB: IDN30 - FUNCTION INPUT STRING ",A,'//
78 . '" CHARACTER LENGTH (",I4,") MUST BE EITHER 5 OR 6")')
79 . ADN30,L30
80 CALL BORT(BORT_STR)
81 END