Thomas Pfau wrote:
> Chris Sharman wrote:
>> Is VMS::IndexedFile the best/only way to read by key ? (it seems very 
>> old - version 0.02 from April 1999)
>>  
> I use VMS::IndexedFile to access the indexed files on my system.  The 
> only issue I have with it is the fact that there's no way to change 
> which key you access a file through after you open the file except to 
> tie another hash.  Other than that, I agree with Craig - it works and 
> there's no reason to update it.

Yes - seems to do the job. I noticed the example opened sysuaf once for 
each key. I also found an RMS module, but that seemed to be even older!
Thanks to all of you for all the help - I feel I'm getting there now - 
the learning curve isn't quite as steep as I'd feared.

I struggled a bit with locking - had to replace my open with a 
vmssysopen to get the options I required (readonly, share=write).
Then found it tripped out (quietly with no apparent error) when it 
reached a locked record - had to add "nql" & "rop=nlk,rrl" for that.

Two more questions:
1. In the code below, is there some way to open the prices file for 
keyed access with the same options (readonly, share=write, read 
regardless) ?
(I can't see any option, myself, so I guess I'll have a hack at the C 
code that does the open - something like "if (O_RDONLY) { }".
Is that something I should pass back to CPAN? If so, how ?)

2. Is there some way to check for EOF when I fall out of WHILE 
(<$INFILE>) ? (rather than record locked or some other rms error?)

Thanks again
Chris

use VMS::IndexedFile;
use VMS::Stdio qw( &vmssysopen );

my $INFILE = vmssysopen("COE_FILES:PRODUCT.DAT", O_RDONLY, 0, "ctx=rec", 
"shr=get,put,upd,del,nql", "rop=nlk,rrl") or die("Can't open input");
tie(my %hprc,VMS::IndexedFile,"COE_FILES:PRICES.DAT",0,O_RDONLY) or 
die("Can't open prices");

Any views expressed in this message are those of the sender and not necessarily 
those of CCA Group.  The unauthorized use, disclosure, copying or alteration of 
this message is forbidden.  The contents of this message may be confidential 
and/or privileged, copyright CCA Group and are intended solely for the use of 
the individual or entity to whom they are addressed.  Whilst this message has 
been scanned, CCA Group cannot guarantee that it is virus free or compatible 
with your systems and accepts no responsibility for any loss or damage arising 
from its use. The recipient is advised to run their own anti-virus software. If 
you receive this message in error please contact [EMAIL PROTECTED] immediately, 
destroy any copies and delete it from your computer systems.

Reply via email to