* Record Locking in VAX/VMS Pascal
@ 1992-05-25 17:34 Daniel Crow
1992-05-26 15:03 ` Steve Lionel
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Crow @ 1992-05-25 17:34 UTC (permalink / raw)
I am working on a program written in VAX/VMS Pascal V4.2 that needs to use
record locking on Keyed, Indexed files. I am getting duplicate key field
errors when I run my system and I am not sure why. There also seems to be
some inconsistency between the Pascal Language Reference Manual and the
Pascal Reference Supplement for VMS Systems manual: one implies that record
locking is supported if SHARING:=READONLY in the OPEN procedure, the other that
record locking is only supported if SHARING:=READWRITE. Which is correct?
My code to perform record locked writing to the common file looks like:
...
REPEAT
FINDK(DBH_Blackboard,0,Item.Number,ERROR:=CONTINUE);
ErrorStatus := STATUS(DBH_Blackboard);
CASE ErrorStatus OF
pas$k_success: IF (UFB(DBH_Blackboard)) THEN
BEGIN
WRITE(DBH_Blackboard,Item); (* Fails here *)
UNLOCK(DBH_Blackboard);
END
ELSE
BEGIN
UPDATE(DBH_Blackboard);
UNLOCK(DBH_Blackboard);
END;
pas$k_faigetloc: (* Sleep for a few seconds, then *)
(* Retry FINDK *)
pas$k_errdurfin: (* HALT program *)
END;
UNTIL (* Succesfull FINDK *)
Any help most gratefully received (e-mail responses welcome)
Dan Crow
daniel@scs.leeds.ac.uk
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Record Locking in VAX/VMS Pascal
1992-05-25 17:34 Record Locking in VAX/VMS Pascal Daniel Crow
@ 1992-05-26 15:03 ` Steve Lionel
0 siblings, 0 replies; 2+ messages in thread
From: Steve Lionel @ 1992-05-26 15:03 UTC (permalink / raw)
In article <1992May25.173417.6599@mnemosyne.cs.du.edu>, dcrow@isis.cs.du.edu
(Daniel Crow) writes:
|>
|>I am working on a program written in VAX/VMS Pascal V4.2 that needs to use
|>record locking on Keyed, Indexed files. I am getting duplicate key field
|>errors when I run my system and I am not sure why. There also seems to be
|>some inconsistency between the Pascal Language Reference Manual and the
|>Pascal Reference Supplement for VMS Systems manual: one implies that record
|>locking is supported if SHARING:=READONLY in the OPEN procedure, the other that
|>record locking is only supported if SHARING:=READWRITE. Which is correct?
|>
[code omitted]
I am not familiar with the second document you refer to, but the correct
answer is that record locking does not occur if SHARING:=READONLY is
specified.
As for the error you're getting, "duplicate key field", this means that
the record you are specifying in the WRITE contains a key which duplicates
that of an existing record and that duplicate keys for that index are
disallowed. I don't see any clues in the program fragment you posted, but
I'd suggest checking carefully the contents of "Item" and also look to
see if duplicate keys are disallowed on any of the indexes of the file.
By the way, the UNLOCK calls in your example are unnecessary - the current
record will automatically be unlocked after a WRITE or UPDATE.
--
Steve Lionel lionel@quark.enet.dec.com
Languages Group
Digital Equipment Corporation
110 Spit Brook Road
Nashua, NH 03062
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1992-05-26 15:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1992-05-25 17:34 Record Locking in VAX/VMS Pascal Daniel Crow
1992-05-26 15:03 ` Steve Lionel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox