|
On 4/17/2017 11:33 AM, Roger Harman wrote:
Two jobs retrieved the same number.add/z-add combo is unknown.
NOTE: Not my code - I just have to work with it. Why it has the
** Data structure for next system number
** & next temporary reference.
D NextNum DS 14
D NSYSNA 1 7
D NSYSNN 1 7 0
D TMPRNA 8 14
D TMPRNN 8 14 0
C SrGetSys Begsr
C *DTAARA DEFINE SYSNBR NextNum
C *LOCK IN NextNum
C NSYSNA IFEQ *BLANKS
C Z-ADD 1 NSYSNN
C ENDIF
C NSYSNN ADD 1 UPDNBR
C Z-ADD UPDNBR NSYSNN
C OUT NextNum
C Endsr
Thanks for posting the code; I found it helpful. As a preface, I've
used *LOCK IN in many dozens of programs; over the 3 decades or so
probably a few billion update cycles. I've never, not once, seen an
issue with the OS. It's always been the program. That said, there is a
gotcha with this sample.
The data area is storing /two/ 'unique' numbers, right? You've been
focussed on two jobs that are trying to get a unique NSYSNN, but what if
there's a third job that's trying to get a unique TMPRNN? It could be
putting back an /old/ copy of NSYSNN as it increments TMPRNN.
Another possibility is a *PSSR/INFSR that somehow gets control between
the IN and the OUT. Seems unlikely, but we're looking for something
non-obvious, so I bring it up. The point is that job 1 might get number
555 and not increment it properly.
--
--buck
Try wiki.midrange.com!
--
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.
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.