NCEPLIBS-bufr  12.0.0
strnum.F90
Go to the documentation of this file.
1 
5 
23 recursive subroutine strnum( str, num, iret )
24  use modv_im8b
25 
26  implicit none
27 
28  character*(*), intent(in) :: str
29 
30  integer, intent(out) :: num, iret
31 
32  character str2*40
33 
34  integer lens, ios
35 
36 !-----------------------------------------------------------------------
37 !-----------------------------------------------------------------------
38 
39 ! Check for I8 integers.
40 
41  if (im8b) then
42  im8b = .false.
43 
44  call strnum ( str, num, iret )
45  call x48 ( num, num, 1 )
46  call x48 ( iret, iret, 1 )
47 
48  im8b = .true.
49  return
50  end if
51 
52 ! Decode the integer from the string.
53 
54  iret = 0
55  num = 0
56 
57  call strsuc ( str, str2, lens )
58  if ( lens .eq. 0 ) return
59 
60  read ( str2(1:lens), '(I40)', iostat = ios ) num
61  if ( ios .ne. 0 ) iret = -1
62 
63  return
64 end subroutine strnum
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
recursive subroutine strnum(str, num, iret)
Decode an integer from a character string.
Definition: strnum.F90:24
subroutine strsuc(str1, str2, lens)
This subroutine removes leading and trailing blanks from a character string.
Definition: strsuc.F90:16
subroutine x48(IIN4, IOUT8, NVAL)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x48.F:19