integer res
real(8) jd0
real(8) dt1
real(8) PV(6)
TYPE(C_PTR) :: peph

jd0 = 2442457
dt1 = 0.5D0
peph = calceph_open("example1.dat"//C_NULL_CHAR)
if (C_ASSOCIATED(peph)) then

   ! the heliocentric coordinates of Mars  in km and km/s
   res = calceph_compute_unit(peph,jd0, dt1, 4, 11,
&                            CALCEPH_UNIT_KM+CALCEPH_UNIT_SEC,
&                            PV)
   write(*,*) PV

   ! compute same quantity as the previous call using NAIF ID
   res = calceph_compute_unit(peph,jd0, dt1,
&                            NAIFID_MARS_BARYCENTER, NAIFID_SUN,
&                            CALCEPH_USE_NAIFID+CALCEPH_UNIT_KM+CALCEPH_UNIT_SEC,
&                            PV)
   write(*,*) PV

    call calceph_close(peph)
 endif