SYSMGR%UK.AC.KCL.PH.IPG@AC.UK.UUCP (01/15/87)
> How does one determine from inside a program whether an existing disk file > (FORM="UNFORMATTED") is RECORDTYPE="VARIABLE" or RECORDTYPE="SEGMENTED" > (say from within a FORTRAN program). > My primitive solution to the problem has been to OPEN the file > with RECORDTYPE=SEGMENTED and then do a test read with IOSTAT=IOS. > If IOS=35 (segmented record format error) I CLOSE the file and re'OPEN it, > this time with RECORDTYPE=VARIABLE. Otherwise I just REWIND the file and > go on about my business. It isn't possible to tell the difference between a file written by FORTRAN with segmented records, and one with ordinary VARIABLE records, with 100% reliability. Reason is that SEGMENTED records are not generated by RMS directly; they are specific to FORTRAN and are just ordinary RMS VARIABLE records with extra data bytes thrown in to allow FORTRAN I/O to reassemble the segments. To be 99.9% sure, set up a loop to do dummy reads as above all the way to the EOF, but you still MIGHT have user data in a VARIABLE file which happens to look exactly like SEGMENTED record control data. If DIGITAL are listening --- this is rather silly. Even IBM support segmented records! Why not include these as another sort of RMS record structure? Nigel Arnot (Dept. Physics, Kings college, Univ. of London; U.K) Bitnet/NetNorth/Earn: sysmgr@ipg.ph.kcl.ac.uk (or) sysmgr%kcl.ph.vaxa@ac.uk Arpa : sysmgr%ipg.ph.kcl.ac.uk@ucl-cs.arpa