	program fiche

c============================================================================

c  Y. Langevin and B. Gondet, 1989
c		Updated StŽphane Erard, mars 1990/juillet 1995

c	Read the original telemetry files and list a given housekeeping
c	 parameter along time. 

c	Must be linked with ddISM.obj, that works only under VMS. 
c	 This program gives access to parameters that are not
c	 included in the decompressed files (*.edt).

c	Numbers of important parameters are given in "DocIDM.asc".
c	Parameters are recorded when they change.
c	Temperature is decoded, and given in degree Celsius.

c ===========================================================================


	integer*2 	orinum(64),datnum(400),olnum(10),imois(12),
     &			idat,imod,gain,olgain,infnum(64),kp(128)

	logical*1 	inftab(128),oritab(128)
	integer*4 	itemps,itemp2,itemp1

	real*4		tdet

	character*13 	nom
	character*128 	infstr
	character*72	nomfic
	character*2 	iih,iim,iis,jjm,jjh,jjs
	character*55	ch
	character*38	nom0
	character*8	pb,dat1
	character*3 	ipi,ad

	equivalence (infnum,inftab)
	equivalence (inftab,infstr)
	equivalence (orinum,oritab)
	data imois/31,28,31,30,31,30,31,31,30,31,30,31/
	idtlng=400
	inflng=400


25	format(A25)
	ch='$1$DUA1:[PCCOMMON.BASEISM.RAW_DATA.FLIGHT]'

610	type *,' Input file name (/ = done ):'
	accept 99,nom
	nomfic=nom(1:12)
	write(2,98),nom
	if(nom(1:1).eq.'/')goto 5000
	type*,' # of parameter to follow ?'
	accept*,idat
	datnum(idat)=0
	ic=0
	imod=1
	close(unit=3)
	open(unit=3,file=ch//nomfic,status='old',shared,
     &carriagecontrol='list',form='unformatted'
     &,recordtype='fixed',recordsize=32)
198   read(3,end=300,err=5000)(orinum(i),i=1,64)
      read(3,end=300,err=5000)(infnum(i),i=1,64)
	if(imod.le.1)then
	 call ddism(orinum,datnum,idtlng,inftab,inflng)
	 test=datnum(8)*3600.
	 test=test+datnum(9)*60.+datnum(10)
	 if(test.eq.0..or.test.gt.235959.)goto198
	 write(2,24)idat
	   if(idat.eq.12)then
	 write(2,75),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat),datnum(idat)
	 type75,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat),datnum(idat)
	   else	if(idat.eq.45)then
	 Tdet=49.96721-4.066708E-2*datnum(idat)
	 write(2,76),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat),Tdet
	 type76,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat),Tdet
	else
	 write(2,77),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat)
	 type77,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat)
	endif
	 olnum(2)=datnum(idat)
	 imod=imod+1
	 ic=ic+1
	 goto198
	endif

c	if(ic.gt.0.and.datnum(1).gt.1) go to 998
	olnum(1)=datnum(1)
c	olnum(4)=datnum(4)
	olnum(8)=datnum(8)
	olnum(9)=datnum(9)
	olnum(10)=datnum(10)
c	olnum(5)=datnum(5)
c	olnum(6)=datnum(6)
	olnum(2)=datnum(idat)
998     call ddism(orinum,datnum,idtlng,inftab,inflng)
c	if(datnum(1).gt.1) go to 198
c	if(datnum(8).eq.0.and.datnum(9).eq.0) go to 198
	ic=ic+1			!# bloc
	test=datnum(8)*3600.
	test=test+datnum(9)*60.+datnum(10)
c	 if(test.eq.0..or.test.gt.235959.)goto198
	test=test-te
	test=abs(test)
	te=datnum(10)+datnum(9)*60.+datnum(8)*3600.

	if(olnum(2).ne.datnum(idat))then
	if(idat.eq.12)then
	 write(2,75),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat),datnum(idat)
	 type75,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat),datnum(idat)
	else	if(idat.eq.45)then
	 Tdet=49.96721-4.066708E-2*datnum(idat)
	 write(2,76),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat),Tdet
	 type76,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat),Tdet
	else
	 write(2,77),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat)
	 type77,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat)
	endif
	endif
	go to 198

300	type *,' End of file'
	if(idat.eq.12)then
	 write(2,75),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat),datnum(idat)
	 type75,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat),datnum(idat)
	else	if(idat.eq.45)then
	 Tdet=49.96721-4.066708E-2*datnum(idat)
	 write(2,76),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat),Tdet
	 type76,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat),Tdet
	else
	 write(2,77),ic,datnum(1),datnum(8),datnum(9),datnum(10),
     &datnum(5),datnum(idat)
	 type77,ic,datnum(1),datnum(8),datnum(9),datnum(10),datnum(5),
     &datnum(idat)
	endif
	go to 610

24	format(' # block , Type block, h, min, s, obs., param(',I3,')')
85	format(/,t20,a8,/)
75	format(2x,i4,2x,i1,2x,'time:',3(i3,1x),3x,i1,3x,I7,2x,Z4)
76	format(2x,i4,2x,i1,2x,'time:',3(i3,1x),3x,i1,3x,I7,2x,F6.2)
77	format(2x,i4,2x,i1,2x,'time:',3(i3,1x),3x,i1,3x,I7)
99	format(a13)
98	format(/,t20,a13,/)
141	format(a1)
153	format(f6.4)
5000	stop
	end
