program caldb_test

implicit none

character*30 :: telescop, instrume,detnam, filter, codenam
character*80 :: expression
character*20 :: mode, strtdate, strtime, stpdate, stptime
integer :: nret, nfound, chatter, status, i
integer, parameter :: maxret = 100
character*70, dimension(maxret) :: filename, online
integer, dimension(maxret) :: extno

chatter = 1
mode ="INST"
telescop = "eROSITA"
instrume = "SIM0"
detnam = "-"
filter = "-"
codenam = "2D_PSF"
strtdate="2010-02-10"
strtime="00:00:00.0"
stpdate="2010-03-10"
stptime="00:00:00.0"

expression = "ENERG.eq.4000.and.THETA.eq.15"
!expression = "ENERG.eq.4000"
!expression = "-"

print *, "###### caldb_info:"
call caldb_info(chatter, mode, telescop, instrume, status)

print *, "###### gtcalf:"
call gtcalf (chatter, telescop, instrume, detnam, filter, &
             codenam, strtdate, strtime, stpdate, stptime, &
             expression, maxret, filename, extno, online, &
             nret, nfound, status)


print *, "###### filename / extension of found caldb datasets:"

do i=1, nfound
  print *, filename(i), " /", extno(i)
end do

end

