USE, INTRINSIC :: ISO_C_BINDING
   use calceph
   implicit none
   integer res
   integer j, itarget, icenter, iframe
   real(C_DOUBLE) firsttime, lasttime
   TYPE(C_PTR) :: peph

! open the ephemeris file
   peph = calceph_open("example1.dat"//C_NULL_CHAR)
   if (C_ASSOCIATED(peph)) then

! print the list of positionrecords
     do j=1, calceph_getpositionrecordcount(peph)
       res = calceph_getpositionrecordindex(peph,j,itarget, icenter, firsttime, lasttime, iframe)
       write (*,*) itarget, icenter, firsttime, lasttime, iframe
     enddo

     call calceph_close(peph)
   endif