|
There is a pause for the user to enter the check date. That could be a problem. I like your idea of immediate update, and then subtract one in case the user cancels out. WHy is the DATA AREA considered, "safer" than a file in this scenario? Thanks for all your help, Steve
I believe your problem may originate with the order in which you are doing things? Get the existing number, add 1 to it, and immediately update the file with the new number, thereby unlocking the record. Then display it. If the problem is that the user may cancel out, you can always chain to the file, get the new existing number (make sure it is the same as the one on the canceled screen), sub 1, and update the file. As a policy I never leave a file open for a screen program. Too many users go to lunch or get a phone call and someone always gets burned, in a non-predictable way. steema@xxxxxxxxxxxxx wrote:There is one program that generates the check number. It is a simple RPG that chains the file by company only, adds 1 to the existing number and places this on the screen for the user. I have put in a chain right there to ensure that this new number does not already exist, and I have also added a log file to this program. There is also another program that does checks which I am checking now but I beleive it only calls the first program. I was told that for checks, they don't indicate the division ever, only company. I still want to know what happens to the file lock, when a term. freezes. Thank you, SteveNow I have found out, that someone here thinks it occurs when the users terminal gets LOCKED. But first of all, wouldn't a record lock remain in effect or would the CL program that holds the lock in effect deallocate this lock? yet the check number started to change, did change? its a bit confusing, but it makes some possible sense.Record locks have nothing at all to do with the creation of the check number. Furthermore, _object_ locks (ALCOBJ) have nothing to do with the contents of any particular record. It's hard to tell what you mean by 'terminal gets locked.' Sounds like a program failure of some sort. > I am looking at a situation that occassionaly > occurs, that a check number is allowed to be > entered that is a dup. > the key is CO, Div, batch#, check#, > so you could have the same number and a diff batch. If the key is Co, Div, Batch, Check, then the database designer is explicitly allowing for duplicate check numbers, as long as they occur in a different company or division or batch. > Or to put it another way, how would you > design such a program in such a > way that a dup could NEVER happen? My choice would be to create a new logical file keyed by check number, unique. That way the database enforces your business rule (no duplicate check numbers.) However, as Lim warns, this could ripple through the application, causing problems you don't want if there are already 'duplicate' check numbers in the file. As Jerry asked, where do these check numbers come from? Does the application generate them, or are they input from somewhere (like a customer payment batch?) If your application generates the check number, there are two tried and true mechanisms for guaranteeing a unique number. Data area and control file. *lock in dtaara // locks dtaara; nobody else can read add 1 check out dtaara 'check' chain ctlfile // locks record; nobody else can chain add 1 check update ctlfile --buck -- This is the RPG programming on the AS400 / 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.-- --------------------------------- Booth Martin http://www.Martinvt.com --------------------------------- -- This is the RPG programming on the AS400 / 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.
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.