× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I would pick #4 - use of the Compare and Swap MI instruction (which can be
used by any of the ILE languages - though for CL you will need to be at
V5R4). Spin on shared storage (a user space being a fine candidate) and
this should run circles around options 1 thru 3 :-)

Bruce Vining




"Mark S. Waterbury" <mark.s.waterbury@xxxxxxx>
Sent by: midrange-l-bounces@xxxxxxxxxxxx
06/21/2007 10:29 AM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
cc

Subject
Performance question about "next number" methods






Can anyone comment on the performance of the following alternative "next
number" techniques:

1) increment a value stored in a data area (e.g. in RPG, something
like this):

*LOCK IN DATAAREA
ADD 1 NEXTNBR
OUT DATAAREA

2) store a record in a keyed "next numbers" file that stores the
current value for each file
(where the "key" is the name of the file that this next number
pertains to)

pseudo-code below:
read record with key, with a record lock
increment next number value
update record, releasing the record lock
return new value to caller

3) using newer features in DB2 UDB, e.g. a sequence or identity field

These techniques could be implemented in any ILE language, RPG IV,
COBOL, C, etc.

I am interested in the relative performance of one technique versus
another.

Thanks.

Mark S. Waterbury

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.