Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!decvax!ucbvax!AC.UK!SYSMGR%UK.AC.KCL.PH.IPG From: SYSMGR%UK.AC.KCL.PH.IPG@AC.UK.UUCP Newsgroups: mod.computers.vax Subject: FORTRAN segmented record type Message-ID: <8701151932.AA24237@ucbvax.Berkeley.EDU> Date: Thu, 15-Jan-87 14:32:40 EST Article-I.D.: ucbvax.8701151932.AA24237 Posted: Thu Jan 15 14:32:40 1987 Date-Received: Fri, 16-Jan-87 00:00:09 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 25 Approved: info-vax@sri-kl.arpa > 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