.TH unlock "" "" "/rdb Command" .PC "Unlock a record or field of a file" \fBunlock \fItableorlist processid from to indexfrom indexto\fR .PP .II table^unlock .II "record locking" The command .B unlock unlocks a record or file by removing a row from a common unlock file. File \fB/tmp/L\fItableorlist\fR contains one line for each locked record or field plus .I processid of the process that locked it. .I from and .I to give, respectively, the offsets of the beginning and end of the locked record or field; and .I indexfrom and .I indexto give, respectively, the offsets of the beginning and end of the row or field's entry in the secondary index file. .SH Example Let us use .B unlock on table .BR inventory , which is as follows: .DM Item Amount Cost Value Description ---- ------ ---- ----- -------------- 1 3 50 150 rubber gloves 2 100 5 500 test tubes 3 5 80 400 clamps 4 23 19 437 plates 5 99 24 2376 cleaning cloth 6 89 147 13083 bunsen burners 7 5 175 875 scales .DE .PP First, we use the .B /rdb command .B seek to locate the record and return the offset and size: .DM LOCATION=`echo 5 | seek -mb inventory Item` .DE .PP The above command returns the offset and size of column .B Item in row 5 of table .BR inventory , and writes the informatio into environmental variable .BR LOCATION . When we look at the contents of .BR LOCATION , we see the following: .DM 207 245 0 8 .DE .PP This means that the record begins 207 bytes into the file, ends 245 bytes into the file, and therefore is 38 bytes long. .PP Now we can call .B unlock to unlock the record: .DM unlock inventory $$ $LOCATION .DE .PP Note that we use the environmental variable .B $LOCATION to supply the location. We also use the shell's built-in variable \fB$$\fR to write the process identifier onto the command line. .PP Let's see what the lock file looks like. Since we're locking table .BR inventory , the lock file is named .BR Linventory . If we type the command: .DM cat /tmp/Linventory .DE .PP we see the message: .DM cat: cannot open /tmp/Linventory .DE .PP .B unlock removes the lock file if it removes the last lock line. .SH "See Also" .B lock, seek .R .SO unlock