I would create a table with one column that autonumbers. This will store your 
incrementing number. You can do it in the parameters table as well.

Then I would use the command to grab the next number, in turn will increment it 
for the next one.

Set var vnumber text
Set var vnumber = (NEXT(tablename,autonumbercol))

--then use the vnumber to do your stuff

Insert into tablename (mru,column1,column2,etc) select .vnumber, value1, 
value2, etc

Since it is an update type of command it will lock the record for a few 
milliseconds to increment the number.

Dan Goldberg

From: [email protected] <[email protected]> On Behalf Of Doug 
Hamilton
Sent: Wednesday, March 4, 2020 9:58 AM
To: R:Base List <[email protected]>
Subject: Re: [RBASE-L] - Table locks

I'm generating a sequential 5 digit alpha-numeric "number";  the MRU is stored 
in a small "parameters" the table.  I need to lock the table so a user can read 
the current number, generate the next and update the table before another user 
reads the number.  Though not probable, it is possible and has in fact happened.

The parameters table is 3 columns by 12 rows; 4 of the rows are used in a 
similar manner - pick ticket numbers, shipping numbers, container numbers, etc.

My understanding is that a row lock would lock during the read then unlock and 
then lock for the updating of the new number.  In between a user could read the 
number while the new number is being generated.  That's why I think I need a 
table lock.

I'm open to any way to accomplish my goal or corrections if my understanding is 
wrong.

Doug
On 3/4/2020 8:06 AM, Dan Goldberg wrote:
Why would you want to lock a table?
Dan Goldberg
Dan Goldberg
MIS Manager
Lance Campers

________________________________
From: [email protected]<mailto:[email protected]> 
<[email protected]><mailto:[email protected]> on behalf of Doug 
Hamilton <[email protected]><mailto:[email protected]>
Sent: Tuesday, March 3, 2020 4:17:11 PM
To: R:Base List <[email protected]><mailto:[email protected]>
Subject: [RBASE-L] - Table locks


I can't get table locks to work.

I set a lock on a table on one computer.
On a different computer, LIST <tablename> shows a remote lock on that
table, sometimes.
In a block of code on the different computer, SET VAR vTableLocks =
(CVAL('TABLELOCKS')), vTableLocks is blank, sometimes.

I can't get enough consistent results/errors to know what questions to ask.

How long does it take for different workstations to see a table lock?
How does RBase determine who set the lock? USER - as in SET USER? NAME -
as in SET NAME? But NAME "must be saved to the configuration file"
(RBX.5 Help).  But doesn't everybody read the the same CFG file and
would have the same name?

Below is test code, vTableLocks doesn't contain MoparSysParams even
though it is locked (local lock) on a different computer (yes, the
sessions of RBase are all in the same current folder).
Is there a difference between setting a local lock and a remote lock? I
thought a lock was a lock, local and remote was just a matter of
perspective of who set the lock.

SET VAR vTableLocks VARCHAR
LABEL TestLock
SET VAR vTableLocks = (CVAL('TABLELOCKS'))
IF (SLOC(.vTableLocks,'MoparSysParams')) <> 0 THEN
   PAUSE FOR 2 USING 'Waiting for Pick Ticket Access'
   GOTO TestLock
ENDIF

SET LOCK MoparSysParams ON
RETURN

TIA
Doug
RBx.5E

arrrgh

--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/72ef7172-1993-8977-5079-7cdc16717937%40wi.rr.com.
--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/BN8PR06MB5346BEF8414A412CDB67C811AAE50%40BN8PR06MB5346.namprd06.prod.outlook.com<https://groups.google.com/d/msgid/rbase-l/BN8PR06MB5346BEF8414A412CDB67C811AAE50%40BN8PR06MB5346.namprd06.prod.outlook.com?utm_medium=email&utm_source=footer>.

--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/21ef156b-05eb-7884-3168-2dc0250a010d%40wi.rr.com<https://groups.google.com/d/msgid/rbase-l/21ef156b-05eb-7884-3168-2dc0250a010d%40wi.rr.com?utm_medium=email&utm_source=footer>.

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/2E4830CEC16615458329D3D83342F8D0014308EBB9%40EXCHANGE10.

Reply via email to