program html2all
! Read four or five HTML files containing monthly stats
! and write out data to appropriate files
use file_date
use file_read, only : read_file
use text_write, only : write_text
use csv_write, only : write_csv
use sql_write, only : write_sql
integer :: month_num, year, file_count
character (len=name_len) :: file_name
character (len=month_len) :: month
call get_file_name(file_name)
! Check if file name is in correct format and files exist
call check_file_name(file_name)
call count_files(trim(file_name), file_count)
if (file_count > 0) then
! Read data and store in arrays
call get_month_year(file_name, month, month_num, year)
call read_file(trim(file_name), month_num, file_count)
! Write out data to text file
call write_text(trim(file_name))
! Write out data to CSV file
call write_csv(trim(file_name), trim(month), year)
! Write out SQL INSERT queries to PHP file
call write_sql(trim(file_name), trim(month), year)
else
print "(/,a,/)", "No suitable files found"
end if
end program html2all