Reading unknown number of values in unformatted file



I am stuck on an I/O probleme with unformatted read in fortran.

- I've opened an unformatted file,
OPEN(10,FILE='toto.dat',FORM='UNFORMATTED')
REWIND(10)
- I've read several datas.
- At this step I can have to read 2 or 3 real values !
It could be:
READ(10,err=101,end=102) u1, u2, u3
or
READ(10,err=101,end=102) u1, u2
with u1, u2, u3 declared as REAL.
- read other datas...

I cannot found a solution to read safely u1,u2,u3 OR u1,u2 depending on what is in the file. I was looking for a solution like reading in a buffer (and then analyse the buffer)... but all that I try fails... Most of my ideas only works for Formatted files :-(

Thanks for any suggestions

Patrick

.