× 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.



Hi, Bruce:

I did not mention CMPSWP as I wanted a technique to recommend to customers that they could easily recognize and understand how to implement, in their language(s) of choice. (Some customers are averse to using MI assembler instructions directly in their applications code.)

I see that Jim Sloan now supports this technique in his TAATOOLs product. See this link for details, especially "caveats" regarding the need to "reset" the next number value(s) stored in the user space(s), after a system failure (abnormal termination, IPL).

http://www.taatools.com/document/L_nbrctr.htm

It seems prudent to declare any field(s) containing such a number in the application's database files as unique key fields, so that any attempt to add a record with a "duplicate" next-number is detected and prevented, and the application designed to recover from this error situation (by calling a procedure to reset the next-number value in the user space beyond the range of any values already used in the associated file).

When I run some benchmarks, I will include a program using CMPSWP, and report on the relative performance of this technique.

Thanks,

Mark S. Waterbury

> Bruce Vining wrote:
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 ...

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.