USE, INTRINSIC :: ISO_C_BINDING
   use calceph
   implicit none
   integer res
   integer j, itarget, iframe, iseg
   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 orientation records
     do j=1, calceph_getorientrecordcount(peph)
       res = calceph_getorientrecordindex2(peph,j,itarget, firsttime, lasttime, iframe, iseg)
       write (*,*) itarget, firsttime, lasttime, iframe, iseg
     enddo

     call calceph_close(peph)
   endif