
      CHARACTER*1 A(1000)
      INTEGER*4 COOR(2),JD
      INTEGER*2 MAG(3),ERCO
      INTEGER*1 ERMG(3)
c      INTEGER*4 COOR(2),JD,MAG(3),ERCO,ERMG(3)
      REAL*8 RA,DE,DJ
      DIMENSION IA(1000)
      OPEN(1,FILE="/u0/oat1/psc_aaa")
      OPEN(2,FILE="psc_aaa_tsxu",
     ?       access="direct",form="unformatted",recl=23)
c      OPEN(2,FILE="psc_aaa_tsxu",form="unformatted")
      ijk=1
   1  READ(1,1000,end=2)(A(I),I=1,1000)
      write(*,*)(A(I),I=1,336)
      READ(2,REC=ijk)(COOR(J),J=1,2),ERCO,
c      READ(2)(COOR(J),J=1,2),ERCO,
     ? MAG(1),ERMG(1),MAG(2),ERMG(2),MAG(3),ERMG(3),JD
      WRITE(*,*)(COOR(J),J=1,2),ERCO,
     ? MAG(1),ERMG(1),MAG(2),ERMG(2),MAG(3),ERMG(3),JD
      RA=DREAL(COOR(1))/1.0D6
      DE=DREAL(COOR(2))/1.0D6
      ERDE=REAL(MOD(ERCO,100))/100.0
      ERRA=(REAL(ERCO)-ERDE)/10000.0
      ZMGJ=REAL(MAG(1))/1000.0
      EMGJ=REAL(ERMG(1))/100.0
      ZMGH=REAL(MAG(2))/1000.0
      EMGH=REAL(ERMG(2))/100.0
      ZMGK=REAL(MAG(3))/1000.0
      EMGK=REAL(ERMG(3))/100.0
c
c     o original abaixo estava com erro
c     DJ=DREAL(JD)/1.0D4+2451.0D4
c
      DJ=DREAL(JD)/1.0D4+2451.0D3


      WRITE(*,*)RA,DE,ERRA,ERDE,ZMGJ,EMGJ,ZMGH,EMGH,ZMGK,EMGK,DJ
      ijk=ijk+1
      mjk=mod(ijk,500000)
      if(mjk.eq.0)write(*,*)ijk
c      if(mjk.eq.0)stop
      pause
      GO TO 1
   2  STOP
 1000 FORMAT(1000A1)
      END
