× 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'd use a data queue with a batch job running somewhere.
Send a data queue entry,
The batch job waits on the queue for a request.
It handle the request by incrementing the counter and then sending a
response.
Then waits on the next request.
All programs needing the "next number" call a subprocedure wrapper which
posts the data queue entry, waits for the return value from the server/batch
job and returns the number to the caller.


-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of James H H Lampert
Sent: Wednesday, November 09, 2005 6:30 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Only one instance of program.

"Venkateshwar" <venkateshwar.raman@xxxxxxxxx> wrote:
> Is there anyway by which I can ensure that only one 
> instance of a program is running? This program generates a
> number and there is chance that it can be
> called by 2 programs to generate number and there is a 
> chance both can get same number.


"Instance of a program." Hmm. Technically, on an AS/400, 
there's never more than one "instance of a program" in 
memory at a time.

Of course, there could be many *activations* of a program 
in memory at a time, each with its own static and dynamic 
storage.

At any rate, I would imagine that all you should need to 
do is have it get an exclusive lock on something as soon 
as it starts executing, and release the lock just before 
it returns.

--
JHHL

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.