|
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, Steve
Now 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.
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.