WPC! c!1S:4~ I:Xb΂o-%IioUOB4& + 48MAC<q#ˁ?]q~*z/ )I%M HPONS\HĀwBbeg8}4H6/MZ)lxg"苮Z w$>2l8HIu^pIȤY`ES2Vcc enͅ| (V)4 S4/[;fa^*>gl;qzB]% ϿH oRO(|Zڣ8O GCA}K9zvEh8ԌZJFٌ!@c2=%S3s@ƞ"" ؐZ$}9 >48DMm3=ڪEwx.L[ E*"g %U: 0#! z W 7 0  q7N^ w@4%4 m6M 0.e $ 1. 72 1u 72\ 0'c 1 72xB 0w 0cUT 0A 0 0 0\ 07 0D& 1j 72 f'!a)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)! B=!=!=!=!=!=!=! B-Z!Z!Z!Z!Z! B!""Arial Regular(F$XXXXUSUS.,$X,X$      = .dd=HP OfficeJet Pro 1170C Series0(,,,,0(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/01208  X NCITS/J3ANSIFortranStandardsCommittee>(#CraigT.Dedo 0 DesignConsiderationsforStreamI/O?(#May20,2001 P (#Page  1  ڀof  4  (3$ F!XXUSUS.,$X,X$      =dd=  ݁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 5* ,-D./D01D234D5Ds&3|x5U )USUS.,$X,X$   _.B2E:\ANSI_J3\157\01-208.wpdBE:\ANSI_J3\157\01-208.wpd/  (3$ F!XXUSUS.,$X,X$      =dd=   (5hCEKQW]cioAutoList11.1.1.1.1.1.1.1.1.##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=  _@\ \  DesignConsiderationsforStreamI/O   To:0  0(#(#04(#(#J34(#4(# From:0  04(#(#CraigDedoh 4(#4(# Date:0  04(#(#May20,20010 4(#4(# Subject:0 4 DesignConsiderationsforStreamI/O P4(#4(#   Thispaperisareprintof01-119,whichIsubmittedforconsiderationatJ3Meeting156.Atthatmeeting,severalmembersexpressedreservationsaboutsomeofthetheoryinthispaper.Unfortunately,IdidnothavethetimetodevelopthetheoryfurthersincetheendofMeeting156.Iamactivelyaskingforspecificconstructivecriticismoftheideasinthispaper_sothatwemayhaveasolidfoundationforresolvingtheremainingproblemswithstreamI/O.b (5h8#b Analysis  8    ThetwounresolvedissuesaboutstreamI/O,127and128,suggestthattheremaybesomeseriousdesigndefects,notjustsomeeditorialfixestobedone.Thispaperdiscussesthesedesignconsiderationsandattemptstoconstructasolidfoundationforresolvingthesetwoissues.Itwillattempttoprovidearigorousmodelusingageneralapproachstartingwithfirstprinciples.  AlthoughmanyoftheseideasarewellknownandsomeofthemarealreadypartofthenormativetextofFortran2000,Ibelievethatitisusefultopresenttheminaswellorganizedandcoherentamanneraspossible.  ItismypositionthatstreamI/O(andallotherI/Oaccessmethodsforthatmatter)areintimatelyconnectedwiththehostoperatingsystemandfilesystemandmusttakefilesystempropertiesintofullconsiderationinordertoworkwell.  TheoriginalpurposeofstreamI/OwastoallowusersofFortrantoaccessCstyle bytestreamfilesor,alternatively,filesthathavenointernalrecordstructure.ThisisexplicitlystatedinthetwoWG5workitems,63and63a,proposingstreamI/O.  Followingaresomedesignprinciplesandassumptionsthatformthefoundationofthisanalysis. 3   3 25h  1  .3  0    Implementationdetailsshouldbelefttotheprocessor.3 = ݌ l (#(# Ќ   3   3 25h  2  .3  0    Weshoulddesignforallcommerciallysignificantoperatingsystemsandfilesystems.3 = ݌ 4!(#(# Ќ   3   3. 25h  3  .3  0    0(#(#  Fortrancompilersshouldworkwellonawidevarietyofoperatingsystemsandfilesystems.No !" oneoperatingsystemorfilesystemshoulddominatethedesignofFortran.3. Y ݌ (#(# Ќ   3   3 25h  4  .3  0    0(#(#  Fortrancompilersshouldhonorthestandardsandconventionsofthehostoperatingsystemand 4#$ filesystem(s).Iftheoperatingsystemandfilesystemaresilentonanissue,thentheFortrancompilerisfreetodoasitpleases.3 ݌ (#(# Ќ   3   325h  5  .3  0    0(#(#  Operatingsystemscansupportmorethanonefilesystem,oftensimultaneouslyonthesame %' system.AgoodexampleisMicrosoftWindowsNT,whichcanhavesomediskvolumeswiththeFATfilesystemandothervolumeswiththeNTFSfilesystemonthesamesystematthesametime.3݌ (#(# Ќ   3   325h  6  .3  0    Noconceptofafileisuniversal,eventhoughsomeconceptsareverywidespread.3݌("+(#(# Ќ   3   325h  7  .3  0    0(#(#  Wedonotknowwhatfilesystemswilldominatecomputing10to20yearsfromnow.Thereis t)", noguaranteeorevenahighlikelihoodthatthefilesystemswhicharepredominanttodaywillcontinuetodominatecomputing.3݌ (#(# Ќ   3   325h  8  .3  0    0(#(#  Inthenext10to20years,wemayhavecommerciallysignificantinstallablefilesystemsthat +$%/ aredesignedbypartiesotherthanthevendoroftheoperatingsystem,suchascommercialthirdpartiesorevenbytheuserthroughdevelopmentkits.3݌ (#(# Ќ   3   3x25h  9  .3  0    0(#(#  StreamI/OinFortranisanaccessmethod,notsomeotherkindoffileattribute.Thisisa $.|'2 correctdesigndecision.3x݌.D(3(#(# Ќ  _&    Weshouldrigorouslydistinguishtheconceptsof_access_Ԁmethod,recordstructure(a.k.a.recordtype),anddataformat.Althoughthesethreeconceptsarecloselyrelated,theyreallyareindependentconceptsthatcanbeclearlydistinguished. b ) !#$%&'((y8b 3   323  0    0(#(#  An_access_Ԁmethodisthewaythattheprogramfindsthedatainafile.Previousversionsof   Fortranallowedonlytwo_access_Ԁmethods,sequentialanddirect.J3isnowaddingstreamaccesstoFortran2000.'p3݌ (#(# Ќ   3   323  0    0(#(#  Arecordstructure,orrecordtype,isthewaythatrecordsareorganizedandmarkedofffrom  x oneanother.Afilesystemmaysupportmorethanonerecordstructure.Forexample,afilesystemmaysupportvariablelengthrecords,fixedlengthrecordsandstreamrecords.3݌ (#(# Ќ   3   323  0    0(#(#  Dataformatspecifieswhetherthedataisreadandwrittenusingformattedinput/output x  statementsorisunformatted.3݌ (#(# Ќ    Itmaybepossibletoaccessafileofagivenrecordstructureinmorethanoneway.ThispossibilityisexplicitlyanticipatedinthenormativetextoftheFortran2000draft[16-1-.5.:18-21,_17/2/050:1812442-3176:34114525]._  Filesystemscanvarywidelyincomplexityandinternalstructure.AtoneextremeistheUnixstyleconceptofafile, Afileisnothingmorethanastreamofbytes..AttheotherextremeistheOpenVMSRMS(forRecordManagementServices)filesystem,whichhasaverycomplexinternalfilestructureandrecordstructure.Itmaybeusefultodrawananalogy.  Onecouldconsiderfilesystemstobestronglyorweaklytyped,justlikedatatypesinprogramminglanguages.Inweaklytypedlanguages,dataobjectsaregivenadatatype,butitisrelativelyeasytolookatthedatainanobjectasifitwereofanotherdatatypewithoutgeneratinganerrorcondition.Incontrast,instronglytypedlanguages,consideringadataobjecttobesomethingotherthanthedatatypeitwasdeclaredtobe_is_Ԁanerrorandgeneratesanerrorcondition.  Similarly,filesystemscanbeclassifiedasweaklytypedifthedataintherecordscanbeaccessedasifithadtwoormorerecordstructures,e.g.,byvariablelengthrecordsorbystream.Thereislittleornodifferenceintherecordstructure.Incontrast,inastronglytypedfilesystem,agivenrecordstructureiscarefullydefinedanddifferentiatedfromotherrecordstructures.Ifafileiscreatedwithonekindofrecordstructureandthenthereisanattempttoaccessitasifithadadifferentkindofrecordstructure,anerroroccurs.  IfstreamI/OistoworkproperlyinFortran,itmustworkequallywellonbothweaklytypedandstronglytypedfilesystems.Thismeansthatanycharacteristicorattributeofafilesystemthatvariesfromonefilesystemtoanotherneedstobelefttotheoperatingsystemandfilesystem.Hence,anyissuewhichisconcernedaboutsuchfilesystemattributesisnecessarilyprocessordependent.  Ifafilesystemrecognizesmorethanoneinternalstructure,itmaybeallowabletoreadthedatainanexistingfilewithagivenrecordstructureonlybyusingoneparticular_access_Ԁmethodorbyusingmorethanoneaccessmethod.Ifmorethanone_access_Ԁmethodisallowed,theprocessormaybeabletodetectthefilesrecordstructureortheusermayneedtospecifywhichrecordstructureisinusethroughmeansnotspecifiedintheFortranstandard.AnexampleofthelattermethodofdetectionwouldbetouseoneormorenonstandardI/Okeywordswhichspecifytheinternalfileandrecordstructure.  Thesameproblemsalsoexistwhencreatingafileorwritingtoanexistingfile.Different_access_methodsmay,bydefault,createfileswithdifferentinternalfileorrecordstructures.Ifthehost .'3 operatingsystemorfilesystemallowstheFortrancompilertousean_access_Ԁmethodtowritetomorethanonekindoffileorrecordstructure,thentheFortrancompilermusthavesomewayofdeterminingwhichstructuretouse.  Hereisanexample.Considerahypotheticalfilesystemthathasatleasttwodifferentrecordstructures,variablelengthsequentialrecordsandstreamrecords.Itispossibleforthefilesystemtosupportallfourofthefollowingcombinations:AccessMethod0 ` 0 ` (#` (#RecordStructure x (# (# Sequential0 4 0` 4(#4(#0 ` (#` (#VariableLengthSequential @ (# (# Sequential0 4 0` 4(#4(#0 ` (#` (#Stream   (# (# Stream0 4 0` 4(#4(#0 ` (#` (#VariableLengthSequentialx  (# (# Stream0 4 0` 4(#4(#0 ` (#` (#Stream@  (# (# ThereisnorequirementintheFortran2000draftthataFortranprocessorusingsuchafilesystemneedstosupportallfourcombinations.  Arelatedissueishowfilesystemsmarktheendofarecord(EOR).Therearemanydifferentwaysofdoingthiswithoperatingsystemsandfilesystemsthatarecommerciallyimportanttoday.Thefollowingtableliststhemethodsusedbyseveralfilesystemstoday.*+a,d( dd Xdd Xdd X(#(#,<<< ,<<< +  *f  0*&  FileSystem =f,!@f =EORMethod 7-'@ 00 f 07_MacOS_  l  l 00 0MicrosoftWindowsFAT  <  < 00 0MicrosoftWindowsNTFS  d  d 00 0Unix     00 0VMSRMS    Dependsonrecordstructure(recordtype)  00  '1 Issues  <    HereisthefulltextofthetwoissuesrelatedtostreamI/O.Issue127:0 4 Imnotconvincedthatendoffileconditionsarefullycoveredforformattedstreams. # Notethatthereisno_endfile_Ԁrecordinaformattedstream(andIdoubtwewanttheretobeone).Astrictreadingofthe2ndsentenceof9.2.3.2wouldtellmethatitdidntapply (!% becausethe_endfile_Ԁwasntaresultofreadingan_endfile_Ԁrecord,butthatssubtle.Idsuggestexplicitlyaddingsomethingaboutsequential;_didnt_Ԁdothatmyselfincasesomeonethinksthatthisshouldapply. 4(#4(# 0  0(#(#04(#(#Whathappenswhenreadingapartialrecordattheendofafile?Wesaythattheremaybepartialrecords,butIdontseewhereweeversaywhattheeffectsofsuchathing_are_.Ifthereisapartialrecordattheendofafile,isitpossibletopositionafteritsothatitisthepreviousrecord?Should,perhaps,reading_pastthe_ԀendofapartialrecordbeanerrorinsteadofanEOForEORcondition?Doespaddingapplytopartialrecords?Someofthesequestionsareprobablybestansweredelsewherethanin9.2.3.2,butIlllumpthemallintooneJ3note. 4(#4(# Issue128:0 4 Thewordsin10.5.3aboutlinefeedsin_A_Ԁoutputimplytomethatanonadvancing P+$2 formattedstreamoutputstatementthatwritesalinefeedasthelastcharacterinastreamfilewillcausetheretobeanemptyandincompleterecordattheendofthefile.Isthisemptyincompleterecordsupposedtobedistinguishablefromhavingnorecord?Ifso,IwonderhowUnixlikesystemsaresupposedtodistinguishit.Ifnot,Iwonder p.'6 whetherwehaveitdescribedcorrectly._Same_Ԁwith/editing,wherethiswasjustcopiedfrom.Theseholesleavemeunconvincedthatthedescriptionofrecordhandling justworkswithformattedstreamI/O.Thisrelatedtounresolvedissue127abouthandlingofincompleterecords. 4(#4(#  References    01-007$r1$,Fortran2000Draft98-209r2,SpecsandSyntaxforM.25,StreamI/O98-211r2,EditsforM.25,StreamI/O99-110r1,StreamI/OSuggestedChanges(UnresolvedIssue68)01-191,ChangestoListofUnresolvedIssues!01-19!"!1!"!!#2#!,!&Open&%!Changes!%!!%!to!%!!%!List!%!!%!of!%!!%!!%!UnresolvedIssues!01-'139'(209(,Issue127End-of-FileinFormattedStreamFiles01-)140)*210*,Issue128EmptyIncompleteRecord0   CompaqComputerCorporation,GuidetoOpenVMSFileApplications,Chapter2, ChoosingaFile   _Organization_(Website:www.openvms.compaq.com:8000/72final/4506/4506_pro) (#(# [EndofJ3/_01-+119+,208,]_