integer*8 peph
integer res
double precision jd0
double precision dt1
double precision PV(6)

jd0 = 2442457
dt1 = 0.5D0
res = f90calceph_open(peph, "example1.dat")
if (res.eq.1) then

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

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

  call f90calceph_close(peph)
endif