WPC " ersNCeʮm6#qt/hɐvG:4wQy&:mٰfl =;3H6b-ylҦYn% ξ/gBj,+SJΆrWUHWlF3pxV_7SlƥMh;lyl'j7L;YҌO60ʀMs6UY*_U˱2/:$Of6rmƒ]99`@U|NyHtjOTtA l6hhڸY:Ϊd2M٦' vaby=B0Ãq"DjلЌ!6J<>8M㩐CঊJ>`uR,)/-գoq"E)(U݉s)_Χ՞F8ݚpk Ɍ*;G.99g %U: 0# z}   0 ONg^ iwu4y m 0e  1 72 1uO 72 0'c 1Y 72B 0wT 0UTU 0 0I 0 0 0 0D 1 72]!f!a!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! B!!!!!!! B-!!!!! B!""Arial Regular(F$XXXXUSUS.,$X,X$      = .dd=HP LaserJet 5M PCL,,,,0C:\COREL\WORDPE~1\TEMPLATE\CUSTOM~1\CUSTOM~1\ANSIJ3~2.WPTC:\Corel\WordPerfect Office 2000\Template\Custom WP Templates\Custom WP Templates\ANSI J3 Unresolved Issues.wpt  'USUS.,$X,X$   _@(# J3/01119  X NCITS/J3ANSIFortranStandardsCommittee>(#CraigT.Dedo , DesignConsiderationsforStreamI/O;(#February9,2001 L (#Page  1  ڀof  4  (3$ F!XXUSUS.,$X,X$      =Ndd=  ݁Level 1Level 2Level 3Level 4Level 5Level 1Level 2Level 3Level 4Level 5Level 1Level 2Level 3Level 4Level 5Level 1Level 2Level 3Level 4Level 5Level 1Level 2Level 3Level 4Level 5fQ* ŀJ*3|xU )USUS.,$X,X$   _.B2C:\ANSI_J3\156\01-119.wpdBC:\ANSI_J3\156\01-119.wpd/  (3$ F!XXUSUS.,$X,X$      =Ndd=   (5hCEKQW]cioAutoList11.1.1.1.1.1.1.1.1.3#37=CIQYag1.a.i.(1)(a)(i)1)a)i)(;3$2#  0  .3  0  (EhCEKQW]cioAutoList21.1.1.1.1.1.1.1.1.Design Considerations for Stream I/O  ( ' $Craig T. Dedo$0Craig T. Dedop17130 W. Burleigh Place Brookfield, WI 53005-2759 01-119 .    3 2(O;$0  2#  a  .3  0` (#(#(b$0  0` (#(#2#   .3  0 ` (#` (#/ Z<Century Schoolbook Regular(xir$0  0` (#(#0 ` (#` (#2#(  0  )3  0 (# (#($0  0` (#(#0 ` (#` (#0 (# (#2#(  a  )3  0h(#(#(F$0  0` (#(#0 ` (#` (#0 (# (#0h(#(#2#(   )3  0h(#h(#($0  0` (#(#0 ` (#` (#0 (# (#0h(#(#0h(#h(#2#  0  )3  0(#(#({$0  0` (#(#0 ` (#` (#0 (# (#0h(#(#0h(#h(#0(#(#2#  a  )3  0p(#(#(F$0  0` (#(#0 ` (#` (#0 (# (#0h(#(#0h(#h(#0(#(#0p(#(#2#     )3  0p(#p(#  !#$%&'xIcgkosw{Large BulletLarge Bullet)(`BTABLE A d)Hairline d  d F!XXUSUS.,$X,X$      =dd=  _@C C  DesignConsiderationsforStreamI/O   To:0  0(#(#04(#(#J34(#4(# From:0  04(#(#CraigDedo` 4(#4(# Date:0  04(#(#February9,2001( 4(#4(# Subject:0 4 DesignConsiderationsforStreamI/O L4(#4(#  (5h83 Analysis      ThetwounresolvedissuesaboutstreamI/O,127and128,suggestthattheremaybesome H  seriousdesigndefects,notjustsomeeditorialfixestobedone.Thispaperdiscussesthesedesign l  considerationsandattemptstoconstructasolidfoundationforresolvingthesetwoissues.Itwill 4  attempttoprovidearigorousmodelusingageneralapproachstartingwithfirstprinciples.     Althoughmanyoftheseideasarewellknownandsomeofthemarealreadypartofthe 0  normativetextofFortran2000,Ibelievethatitisusefultopresenttheminaswellorganizedand T  coherentamanneraspossible.     ItismypositionthatstreamI/O(andallotherI/Oaccessmethodsforthatmatter)areintimately P  connectedwiththehostoperatingsystemandfilesystemandmusttakefilesystempropertiesinto t fullconsiderationinordertoworkwell. <   TheoriginalpurposeofstreamI/OwastoallowusersofFortrantoaccessCstyle bytestream p filesor,alternatively,filesthathavenointernalrecordstructure.Thisisexplicitlystatedinthetwo 8 WG5workitems,63and63a,proposingstreamI/O. \   Followingaresomedesignprinciplesandassumptionsthatformthefoundationofthisanalysis.  "3"  3_ 25h  1  .3  0    Implementationdetailsshouldbelefttotheprocessor.3_ ݌X(#(# Ќ  "3"  3a 25h  2  .3  0    Weshoulddesignforallcommerciallysignificantoperatingsystemsandfilesystems.3a ݌ |(#(# Ќ  "3"  3 25h  3  .3  0    0(#(#  Fortrancompilersshouldworkwellonawidevarietyofoperatingsystemsandfilesystems.No D oneoperatingsystemorfilesystemshoulddominatethedesignofFortran.3 ݌ (#(# Ќ  "3"  3& 25h  4  .3  0    0(#(#  Fortrancompilersshouldhonorthestandardsandconventionsofthehostoperatingsystemand x filesystem(s).Iftheoperatingsystemandfilesystemaresilentonanissue,thenthe @ Fortrancompilerisfreetodoasitpleases.3& S ݌ d (#(# Ќ  "3"  325h  5  .3  0    0(#(#  Operatingsystemscansupportmorethanonefilesystem,oftensimultaneouslyonthesame  ,! system.AgoodexampleisMicrosoftWindowsNT,whichcanhavesomediskvolumeswith !" theFATfilesystemandothervolumeswiththeNTFSfilesystemonthesamesystematthe `"# sametime.3I݌(#$(#(# Ќ  "3"  3V25h  6  .3  0    Noconceptofafileisuniversal,eventhoughsomeconceptsareverywidespread.3V݌#L%(#(# Ќ  "3"  3r25h  7  .3  0    0(#(#  Wedonotknowwhatfilesystemswilldominatecomputing10to20yearsfromnow.Thereisno $& guaranteeorevenahighlikelihoodthatthefilesystemswhicharepredominanttodaywill %' continuetodominatecomputing.3r݌H&((#(# Ќ  "3"  3\25h  8  .3  0    0(#(#  Inthenext10to20years,wemayhavecommerciallysignificantinstallablefilesystemsthatare 'l ) designedbypartiesotherthanthevendoroftheoperatingsystem,suchascommercialthird '4!* partiesorevenbytheuserthroughdevelopmentkits.3\݌(!+(#(# Ќ  "3"  3a25h  9  .3  0    0(#(#  StreamI/OinFortranisanaccessmethod,notsomeotherkindoffileattribute.Thisisacorrect h)", designdecision.3a݌0*#-(#(#    *T$. &     Weshouldrigorouslydistinguishtheconceptsofaccessmethod,recordstructure(a.k.a.record  type),anddataformat.Althoughthesethreeconceptsarecloselyrelated,theyreallyare l independentconceptsthatcanbeclearlydistinguished. 4 ! ! ) !#$%&'((y8 "3"  323  0    0(#(#  Anaccessmethodisthewaythattheprogramfindsthedatainafile.Previousversionsof X Fortranallowedonlytwoaccessmethods,sequentialanddirect.J3isnowaddingstream   accesstoFortran2000.'3݌ (#(# Ќ  "3"  323  0    0(#(#  Arecordstructure,orrecordtype,isthewaythatrecordsareorganizedandmarkedofffromone T  another.Afilesystemmaysupportmorethanonerecordstructure.Forexample,afile  x systemmaysupportvariablelengthrecords,fixedlengthrecordsandstreamrecords.3݌ @(#(# Ќ  "3"  323  0    0(#(#  Dataformatspecifieswhetherthedataisreadandwrittenusingformattedinput/output    statementsorisunformatted.3݌t (#(# Ќ    Itmaybepossibletoaccessafileofagivenrecordstructureinmorethanoneway.This `  possibilityisexplicitlyanticipatedinthenormativetextoftheFortran2000draft[161:18-21, (  172:8-11].     Filesystemscanvarywidelyincomplexityandinternalstructure.AtoneextremeistheUnix $  styleconceptofafile, Afileisnothingmorethanastreamofbytes..Attheotherextremeisthe H  OpenVMSRMS(forRecordManagementServices)filesystem,whichhasaverycomplexinternal  filestructureandrecordstructure.Itmaybeusefultodrawananalogy. |   Onecouldconsiderfilesystemstobestronglyorweaklytyped,justlikedatatypesin  h programminglanguages.Inweaklytypedlanguages,dataobjectsaregivenadatatype,butitis 0 relativelyeasytolookatthedatainanobjectasifitwereofanotherdatatypewithoutgenerating  anerrorcondition.Incontrast,instronglytypedlanguages,consideringadataobjecttobe d somethingotherthanthedatatypeitwasdeclaredtobeisanerrorandgeneratesanerror , condition. P   Similarly,filesystemscanbeclassifiedasweaklytypedifthedataintherecordscanbeaccessed  asifithadtwoormorerecordstructures,e.g.,byvariablelengthrecordsorbystream.Thereis L littleornodifferenceintherecordstructure.Incontrast,inastronglytypedfilesystem,agiven p recordstructureiscarefullydefinedanddifferentiatedfromotherrecordstructures.Ifafileis 8 createdwithonekindofrecordstructureandthenthereisanattempttoaccessitasifithada   differentkindofrecordstructure,anerroroccurs. l !   IfstreamI/OistoworkproperlyinFortran,itmustworkequallywellonbothweaklytypedand !X# stronglytypedfilesystems.Thismeansthatanycharacteristicorattributeofafilesystemthat " $ variesfromonefilesystemtoanotherneedstobelefttotheoperatingsystemandfilesystem. #% Hence,anyissuewhichisconcernedaboutsuchfilesystemattributesisnecessarilyprocessor T$& dependent. %x'   Ifafilesystemrecognizesmorethanoneinternalstructure,itmaybeallowabletoreadthedata & ) inanexistingfilewithagivenrecordstructureonlybyusingoneparticularaccessmethodorby t' * usingmorethanoneaccessmethod.Ifmorethanoneaccessmethodisallowed,theprocessormay <(!+ beabletodetectthefilesrecordstructureortheusermayneedtospecifywhichrecordstructureis )`", inusethroughmeansnotspecifiedintheFortranstandard.Anexampleofthelattermethodof )(#- detectionwouldbetouseoneormorenonstandardI/Okeywordswhichspecifytheinternalfileand *#. recordstructure. \+$/   Thesameproblemsalsoexistwhencreatingafileorwritingtoanexistingfile.Differentaccess ,H&1 methodsmay,bydefault,createfileswithdifferentinternalfileorrecordstructures.Ifthehost -'2 operatingsystemorfilesystemallowstheFortrancompilertouseanaccessmethodtowritetomore |.'3 thanonekindoffileorrecordstructure,thentheFortrancompilermusthavesomewayof  determiningwhichstructuretouse. l   Hereisanexample.Considerahypotheticalfilesystemthathasatleasttwodifferentrecord X structures,variablelengthsequentialrecordsandstreamrecords.Itispossibleforthefilesystemto   supportallfourofthefollowingcombinations:   AccessMethod0 ` 0 ` (#` (#RecordStructureT  (# (# Sequential0 4 0` 4(#4(#0 ` (#` (#VariableLengthSequential x (# (# Sequential0 4 0` 4(#4(#0 ` (#` (#Stream @ (# (# Stream0 4 0` 4(#4(#0 ` (#` (#VariableLengthSequential   (# (# Stream0 4 0` 4(#4(#0 ` (#` (#Streamt  (# (# ThereisnorequirementintheFortran2000draftthataFortranprocessorusingsuchafilesystem <  needstosupportallfourcombinations. `    Arelatedissueishowfilesystemsmarktheendofarecord(EOR).Therearemanydifferent   waysofdoingthiswithoperatingsystemsandfilesystemsthatarecommerciallyimportanttoday. \  Thefollowingtableliststhemethodsusedbyseveralfilesystemstoday. $  *+a,d( dd Xdd Xdd X(#(#,<<< ,<<< +  /fH H  0/&  FileSystem =f,!x f =EORMethod 7-'x  00 f 07MacOS  D  D 00 0MicrosoftWindowsFAT  l  l 00 0MicrosoftWindowsNTFS     00 0Unix     00 0VMSRMS  @ Dependsonrecordstructure(recordtype)@ 00  '4 Issues  l   HereisthefulltextofthetwoissuesrelatedtostreamI/O. 4  Issue127:0 4 Imnotconvincedthatendoffileconditionsarefullycoveredforformattedstreams.  " Notethatthereisnoendfilerecordinaformattedstream(andIdoubtwewantthereto # beone).Astrictreadingofthe2ndsentenceof9.2.3.2wouldtellmethatitdidntapply T $ becausetheendfilewasntaresultofreadinganendfilerecord,butthatssubtle.Id !x% suggestexplicitlyaddingsomethingaboutsequential;didntdothatmyselfincase !@& someonethinksthatthisshouldapply."'4(#4(# 0  0(#(#04(#(#Whathappenswhenreadingapartialrecordattheendofafile?Wesaythattheremay <$) bepartialrecords,butIdontseewhereweeversaywhattheeffectsofsuchathingare. %`* Ifthereisapartialrecordattheendofafile,isitpossibletopositionafteritsothatitis %(+ thepreviousrecord?Should,perhaps,readingpasttheendofapartialrecordbean &, errorinsteadofanEOForEORcondition?Doespaddingapplytopartialrecords?Some \' - ofthesequestionsareprobablybestansweredelsewherethanin9.2.3.2,butIlllump $(!. themallintooneJ3note.(H"/4(#4(# Issue128:0 4 Thewordsin10.5.3aboutlinefeedsinAoutputimplytomethatanonadvancing |*#1 formattedstreamoutputstatementthatwritesalinefeedasthelastcharacterina D+$2 streamfilewillcausetheretobeanemptyandincompleterecordattheendofthefile.  ,h%3 Isthisemptyincompleterecordsupposedtobedistinguishablefromhavingnorecord?If ,0&4 so,IwonderhowUnixlikesystemsaresupposedtodistinguishit.Ifnot,Iwonder -&5 whetherwehaveitdescribedcorrectly.Samewith/editing,wherethiswasjustcopied d.'6 from.Theseholesleavemeunconvincedthatthedescriptionofrecordhandling just  workswithformattedstreamI/O.Thisrelatedtounresolvedissue127abouthandling l ofincompleterecords.44(#4(#  References    01-007,Fortran2000Draft   98-209r2,SpecsandSyntaxforM.25,StreamI/O T  98-211r2,EditsforM.25,StreamI/O  x 99-110r1,StreamI/OSuggestedChanges(UnresolvedIssue68)  @ 01-102,ChangestoListofUnresolvedIssues    01-139,Issue127End-of-FileinFormattedStreamFiles t  01-140,Issue128EmptyIncompleteRecord <  0   CompaqComputerCorporation,GuidetoOpenVMSFileApplications,Chapter2, ChoosingaFile `  Organization(Website:www.openvms.compaq.com:8000/72final/4506/4506_pro)( (#(# [EndofJ3/01-119]