As a quick thought to this, could you use a multi-part sequential number that uses the port/user ID? Something like PORT.NO:".":SEQ.ID? Since you are asking with the thought that someone else may need a lock to get a new record key, I am assuming that John after Jane after Jack sequencing is not important, just assurance that record key duplication does not happen and that down to the second is not enough accuracy to use date/time as the record key.
Depending on other possible needs, it may just be a necessary evil/delay to hold a record lock until a transaction completes. BobW > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:owner-u2- > [EMAIL PROTECTED] On Behalf Of Stevenson, Charles > Sent: Friday, June 10, 2005 3:40 PM > To: u2-users@listserver.u2ug.org > Subject: [U2] Best practice for Sequential IDs using TRANSACTION START & > COMMIT/ROLLBACK > > For files with sequential numbers as record IDs, it is common practice > to use a control item (in dictionary or in a special control table) to > get the next sequential id counter, then write back the incremented > counter ASAP so it is available for the next process that needs to do > the same. Some variation on this theme (probably involving a utility > subroutine): > READVU SEQ.ID FROM ctrl.fvar, ctrl.id, n ... > WRITEV SEQ.ID+1 TO ctrl.fvar, ctrl.id, n > WRITE NEW.REC TO fvar, SEQ.ID > > === > BUT: > === > > If that happens inside an explicit transaction bounded by TRANSACTION > START and TRANSACTION COMMIT (or TRANSACTION ROLLBACK), the Sequential > ID control record will not actually be written and/or released until all > updates are done/ditched during commit/rollback. If the transaction is > extensive and involves many updates, this could be a serious bottleneck. > > Making sure that you read the next sequential id as close to the moment > of executing the commit would be helpful, but that is not always an > option in complicated transactions. > > What is the best practice for handling this? What is your experience? > Bottlenecks? > > Ideally, I know what I'd prefer: I wish U2 would handle sequential ids > internally for variants of Type-2 or dynamic SEQ.NUM files. That should > have happened a couple decades ago in PI and Pick. But back to the real > world. What is the best way to handle sequential IDs when using > explicit TRANSACTIONs? > > cds > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/