LockEdit

LockEdit


Version 3.1


2006-03-09 The information in this document is subject to change without notice and should not be construed as a commitment by anyone.

The software described in this document is provided as is. No guarantee is made to the suitability, reliability, security, usefulness, performance or good taste of this software.

Availability: LockEdit may be distributed provided no alteration is made to the copyright notice in this documentation or in program sources. All rights are reserved.

Copyright ©2006 Tom Wade

Contents


Chapter 1
Introduction

1.1 Purpose of LockEdit

LockEdit is designed to avoid problems encountered when two people try to edit a shared file at the same time. EDT and TPU do not lock a file when they open it, which can result in changes being lost. Consider the following scenario.

File FOO.TXT contains the following data


 
line 1 
line 2 
line 3 
 
User FRED edits the file. His editor opens the file and copies the contents into his edit buffer. While FRED is editing, user BOB also edits the file. He copies the same file into his edit buffer and starts editing.

FRED adds the word new to the 2nd line. He then closes the file, and FOO.TXT now contains


 
line 1 
new line 2 
line 3 
User BOB does not have this changed line in his buffer. He adds the word extra to the third line and exits. The file now contains


 
line 1 
line 2 
extra line 3 
 
Thus when two people edit a file simulataneously, the changes made by the user who exits first are lost. LockEdit provides you with a tool that prevents other people from editing a file when it is already open.

1.2 Checking the version

Check the web site to see if there is a newer version of this software available. The web site is


 
http://www.tomwade.eu/software 
 

1.3 Prerequisites

LockEdit will run on the following operating systems: It should run on later versions, and will probably run on some earlier versions (although for the latter, it may be necessary to rebuild the program from the supplied sources).


Chapter 2
How to Use LockEdit

2.1 Installing LockEdit

The kit is normally distributed as a ZIP archive. UNZIPping this archive will produce a kit that is installed using the VMSINSTAL facility. This will ask you to specify a target directory into which it will restore the sources and the three image files (.VAX-EXE, .ALPHA-EXE and .IA64-EXE). Each image should be used on the appropriate machine architecture.

2.1.1 Building the program

The kit ships with EXE files created on the above listed versions of OpenVMS. If you wish to rebuild from the sources, then issue the following command:


 
 $ @BUILD 
This will compile and link the code for your platform. Note that you need a Fortran compiler to perform the compilation step.

2.1.2 Installing the image

If LockEdit is to be used to coordinate file access among users in different UIC groups, then it will need to take out system wide locks. This requires SYSLCK privilege, which by default ordinary users do not have. Therefore, you should install the image with this privilege (the INSTALL command should be placed in the SYSTARTUP_VMS.COM file so that it is executed each time the system boots).

LockEdit only uses SYSLCK privilege to set the LCK$M_SYSTEM bit on the lock flags. You can also install the program with the /OPEN /HEADER attributes for performance reasons.


 
$ Install Add ddcu:[dirname]LOCK-EDIT.VAX-EXE /open /head /share /priv=SYSLCK 
 


Chapter 3
Using LockEdit

3.1 Defining the Command

To use LockEdit you need to define a foreign command to access the program. For example


 
 $ machine := 'F$Getsyi ("arch_name")' 
 $ lockedit = "$SYS$SYSDEVICE:[LOCKEDIT]LOCK-EDIT.''machine'-EXE" 
 
This defines the LOCKEDIT command which can then be used to edit a file. Alternatively, you can define an EDIT symbol if you want all editing to be done via LockEdit.

Note

If you define the DCL symbol EDIT to invoke the LOCK-EDIT image instead of TPU/EDT, then users will use LockEdit when changing files without seeing any difference. However, EDIT commands like EDIT/FDL or EDIT/ACL will fail. This will also occur if you have defined EDIT as EDIT/EDT.

3.2 Using TPU or EDT

LockEdit will by default invoke callable TPU passing any valid TPU qualifiers in the command line to it. If the /EDT qualifier is present, LockEdit will invoke callable EDT instead.

3.3 File already in use

If the file is already in use, LockEdit will terminate with a message identifying the username and process ID of the process that has the file open. Note that LockEdit will lock a file even if you have specified /READ (the /READ qualifier will be passed to the underlying editor which will prevent you from changing the file content, but LockEdit will still not allow concurrent editors).

Note

LockEdit will not prevent other users from accessing the commands using TPU or EDT (or for that matter any other DCL command) directly. For the coordination to work, all editing attempts on the file should be made through LockEdit.

Contents