From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,5a72d8b357ddea16,start X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,5a72d8b357ddea16,start X-Google-Attributes: gid1164f8,public X-Google-Thread: 10cc59,5a72d8b357ddea16,start X-Google-Attributes: gid10cc59,public X-Google-ArrivalTime: 1992-05-26 06:21:20 PST Xref: sparky comp.lang.pascal:3535 comp.sys.dec:3141 comp.os.vms:9847 Newsgroups: comp.lang.pascal,comp.sys.dec,comp.os.vms Path: sparky!uunet!mnemosyne.cs.du.edu!isis.cs.du.edu!dcrow From: dcrow@isis.cs.du.edu (Daniel Crow) Subject: Record Locking in VAX/VMS Pascal Message-ID: <1992May25.173417.6599@mnemosyne.cs.du.edu> Sender: usenet@mnemosyne.cs.du.edu (netnews admin account) Organization: Nyx, Public Access Unix at U. of Denver Math/CS dept. Date: Mon, 25 May 92 17:34:17 GMT 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