Justin,
What John means is that you should read each line into a character variable and take them to bits 'by hand'. I've being doing it that way since the early 1980s, and I really needed to update some of my routines, so I've just spent the lunch hour writing the following:
! test of string extraction routines
character*120 string(4)
integer*4 istr_len,istat,int_value4
integer*8 int_value8
real*4 real_value4
real*8 real_value8
!test string extraction routine
!note, a double embedded quote is interpreted as a single quotation
call put_string(''Order ID','Date','Numeric'' Time',',1,istat)
call set_pos(1)
print *,'Reading strings'
do i=1,4
call string_extract(string(i),istr_len,',',istat)
print *,istr_len,istat,' ',trim(string(i))
enddo
print *,'Quotation removal strings'
do i=1,4
call remove_csv_quotes(string(i),''',istat)
print *,istat,' ',trim(string(i))
enddo
!test integer , date, integer extraction
call put_string('9000,6/17/2003 19:52:47,1055879567',1,istat)
call set_pos(1)
!extract integer*4
call integer_extract4(int_value4,',',istat)
print *,'integer*4 value',int_value4,istat
!extract date/time field
call string_extract(string(4),istr_len,',',istat)
print *,'Date time string',istr_len,istat,' ',trim(string(4))
!extract integer*8
call integer_extract8(int_value8,',',istat)
print *,'integer*8 value',int_value8,istat
!
! test of real number
call put_string('25.7,18,455d3',1,istat)
call set_pos(1)
call real_extract4(real_value4,',',istat)
print *,'real*4 value',real_value4,istat
call real_extract4(real_value4,',',istat)
print *,'real*4 value',real_value4,istat
call real_extract8(real_value8,',',istat)
print *,'real*8 value',real_value8,istat
!now get the date and time ising delimiters of '/', space and ':'
call put_string(string(4),1,istat)
call set_pos(1)
do i=1,6
call integer_extract4(int_value4,' /:',istat)
print *,'integer*4 value i',i,int_value4,istat
enddo
end
!General read of text data
!=============================================================
! read_line_in
subroutine read_line_in(ichan,istat)
! read line of text from input file
character*2048 line_in
integer*4 ipos,ilen
common/read_data_text/line_in
common/read_data_numb/ipos,ilen
! set extraction pointer to first character
ipos = 1
read(ichan,1000,end=9999)line_in
1000 format(a)
! determine length of input line
ilen = leng(line_in)
! status is successful line read
istat = 0
return
!end of file handling
9999 continue
!nothing read in so set ilen to zero
ilen = 0
!end of file detected
istat = 1
end
To be continued - see next post