Roger,
Old and no longer used, but here was are coding.
This was an interactive job.
* NEXT ACCOUNT NUMBER
IBRDAT1 DS
I 1 70NACT#
C *IN59 DOUEQ'0'
C *LOCK IN BRDAT1 59
C END *IN59
C ADD 1 NACT#
C OUT BRDAT1
Paul
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Roger Harman
Sent: Sunday, April 16, 2017 7:10 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: DTAARA Lock Issue?
Nope. The *LOCK is definitely there.
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark S Waterbury
Sent: Sunday, April 16, 2017 1:41 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: DTAARA Lock Issue?
Roger:
Perhaps someone forgot to specify "*LOCK" on the IN statement, so you could have something like this example:
D DataArea DS DtaAra(NextNumber)
D NextNbr 15P 0 INZ
...
C IN DataArea
C ADD 1 NextNbr
C OUT DataArea
C MOVE NextNbr Result
and thus, no protection from multiple jobs simultaneously accessing and updating that data area. This will compile and run "just fine" and it might even seem to "work" okay most of the time, but,when two jobs run this code at the same time, you could experience exactly the issue you reported.
What is needed is:
C *LOCK IN DataArea
C ADD 1 NextNbr
C OUT DataArea
C MOVE NextNbr Result
Hope that helps...
Mark S. Waterbury
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.