|
Martin, I have done some deleting old records using constraints. I use the cascading method to get a "waterfall" delete: delete one master record and all depending children are "automatically" removed as well. Some considerations, any way: 1) Journalling is required. 2) Duplicate keys are not allowed. 3) Orphaned records (details without master record) are not allowed (solved this using SQL to remove those records) 4) You can only link master to detail (parent to child), not the other way around (although that may be handy sometimes). 5) If the main PF is keyed, you may accidently remove the access path when removing the constraint. An example to illustrate this. An example that works: File A (master) primary key: OrdernumberA File B(child) primary key: OrdernumberA-OrderLineA File C (master) foreign key: OrdernumberA primary key: OrdernumberB File D (child) primary key: OrdernumberB-OrderlineB Constraint File A - File B: OrdernumberA File A - File C: OrdernumberA File C - File D: OrdernumberB When deleting a record from File A, all child records with the same ordernumber in File B were deleted. Because a constraint was made from File A to File C, all records in File C with the same ordernumberA from File A were also removed and a consequence of that records from File D were removed. Regards, Carel Teijgeler *********** REPLY SEPARATOR *********** On 29-4-03 at 15:37 Saunders, Martin P wrote: >I am canvassing for opinions on using ADDPFCST to effect data purges instead >of writing (comparatively) more complex RPG >programs to perform this >function. The way I see it, if we add the appropriate constraint to a detail >file which has an associated >header file with a primary key and specify >'cascading delete', deleting records from the header file willautomatically >zap the >associated detail records right? > >Is there a good reason why I've never seen this being used? Or is it just the >shops that I've worked with that do not think this is a >useful feature?
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.