I think you can do this using the inquire function, but I'd have to admit that I can't get it to work..
Something along the lines of:
inquire (unit=21, recl=n)
then n should be the file length. Except that this doesn't work, but I'm pretty sure it's something like that.