[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc

Title:DECC
Notice:General DEC C discussions
Moderator:TLE::D_SMITHNTE
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2212
Total number of notes:11045

2184.0. "Fseek IO on sequential undefined file read??" by KERNEL::PULLEY (Come! while living waters flow) Tue May 13 1997 14:47

    Hi,
    
    I've a customer who's application is not quick--VMS v5.5-2, DEC C v5.3.
    One of the things they are interested in is, they use a sequential
    file, format undefined maximum 512 bytes.
    They fopen this file as RB, and use fread and fseek on it.
    This application has come from a PC, and they're trying not to change
    the code too much--less they have to.
    
    They ask, if you use fseek, will it be able to work out which disk
    block to read, and just grab that, or will it have to read in all the
    blocks till it realises it's got the right one for your offset?
    
    I've suggested using buffers on the file, to try and get it all in
    memory, but they say that doesn't seem to have made much difference.
    I'm not sure how much testing they've done with it.
    
    Thanks & regards,
    Steve.
    
T.RTitleUserPersonal
Name
DateLines
2184.1DECCXL::OUELLETTEmudseason into blackfly seasonTue May 13 1997 17:261
I've asked the RTL team for an answer.
2184.2TLE::D_SMITHDuane Smith -- DEC C RTLWed May 14 1997 15:275
    The big performance difference will be in whether these records are
    fixed or variable length records.  Direct access to the proper block
    will come with fixed length records.
    
    Duane
2184.3KERNEL::PULLEYCome! while living waters flowThu May 15 1997 16:306
    His file is:-
    Record format:      Undefined, maximum 512 bytes
    Record attributes:  Carriage return carriage control
    does that mean it's going to be treated as variable, as there's no
    format it can make sense of?
    
2184.4EPS::VANDENHEUVELHeinSun May 18 1997 05:2034
 >   Record format:      Undefined, maximum 512 bytes
 >   Record attributes:  Carriage return carriage control
 >   does that mean it's going to be treated as variable, as there's no
 >   format it can make sense of?
    
    In one sense, Undefined is variable, in that you can ask for a variable
    amount of bytes. You'll get as many bytes as you ask (untill EOF hits).
    
    In an other sense tt behaves more like fixed length as you can jump (seek)
    directly to any place in the file. Unlike variable length records, were
    one have to find the word-alligned length word, undefiend does not have
    to find the begining of a record. Wherever you want to read, that's 
    where you will read. 
    
    Now I do not know what 'value' the DEC C RTL adds to the basic RMS access.
    It would appear to me that undefined files need no help whatsoever and 
    can be passed straight to the RMS record IO interface, but I suspect 
    the C RTL will do it's own block IO (in order to use less CPU by
    staying in usermode over reads) unless told otherwise. 
    
    Thus I suggest you have them try to open with 'ctx=rec'.
    After that, the file should listen to RMS Multiblock (mbc) and
    Multibuffer (mbf) params either from open, or from process context
    such as $SET RMS/SEQ/BLOC=64/BUF=4 to get 4 buffers, 32Kb each to play.
    
    To figute out what's going on behing the scenes on your own, I'd use
    $ANAL/SYST... SET PROC 'test'... SHOW PROC/RMS=(FAB,RAB,BDBSUM)
    Or $SET FILE/STAT and MONI RMS/FILE=xxx  [/ITEM=OPER and/or /ITEM=CACH
    
    Let us know...
    
    		Hein.
    
    
2184.5fseek?KERNEL::PULLEYCome! while living waters flowMon May 19 1997 10:563
    If his file was opened ctx=rec, wouldn't that mean fseek gets the start
    of a record, rather than the exact byte you asked for?
    
2184.6TLE::D_SMITHDuane Smith -- DEC C RTLMon May 19 1997 11:117
    No.  I don't have the reference manual handy, but it does state the
    types of files that can be positioned at any byte offset and those
    which can only be positioned at the start of records.  Records having
    characteristics such as fixed length (and maybe limitations on the
    record terminators) can be positioned on any byte.
    
    Duane