rvandehoek
New Member
I would like to create sequenced records in a table. I have a control table with a sequence number. Users can increase it and create an order record with this sequence number with this code:
promp-for order_nbr.
find order where order_nbr = input order_nbr no-error.
if not avail order then do:
find first control exclusive-lock.
control_nbr = control_nbr + 1.
release control.
create order.
order_nbr = control_nbr.
end.
The code continues with updating the order record. Now when a second user starts this code he get the message that the control table is in use. I don't understand this message because of the release in the code.
Is there a better way to do this?
Thanks, Rene
promp-for order_nbr.
find order where order_nbr = input order_nbr no-error.
if not avail order then do:
find first control exclusive-lock.
control_nbr = control_nbr + 1.
release control.
create order.
order_nbr = control_nbr.
end.
The code continues with updating the order record. Now when a second user starts this code he get the message that the control table is in use. I don't understand this message because of the release in the code.
Is there a better way to do this?
Thanks, Rene