|
Good points. And what Leif was suggesting looks simple also. Most likely a much better way to go. Bob -----Original Message----- From: mi400-admin@midrange.com [mailto:mi400-admin@midrange.com]On Behalf Of Dan Bale Sent: Thursday, May 09, 2002 11:05 AM To: mi400@midrange.com Subject: RE: [MI400] Generate hash code for a source member? A simple XFOOT solution, I'm thinking, will not catch changes where characters are switched, or where records are switched. I realize I could introduce some logic to multiply each element in a record by a different value, and do something similar by RRN, and then have to deal with overflow, etc., etc. By the time I've figured that all out, I could turn out using just a simple hash. As it turns out, I think I may have found the answer in Leif's ebook, as I've provided in my previous post. Just have to implement it now. Dan Bale SAMSA, Inc. 989-790-0507 DBale@SAMSA.com <mailto:DBale@SAMSA.com> Quiquid latine dictum sit altum viditur. (Whatever is said in Latin seems profound.) -----Original Message----- From: mi400-admin@midrange.com [mailto:mi400-admin@midrange.com]On Behalf Of Bob Crothers Sent: Thursday, May 09, 2002 11:14 AM To: mi400@midrange.com Subject: RE: [MI400] Generate hash code for a source member? Dan, First, you don't really need any of the "official" hash algorithms. That keeps things simple. Read the source record in as an array of 32 bit integers. Crossfoot the array. Add to the total for the member. Repeat for each record. Final value is your hash. Also, keep track of how many times your total overflows. Eg: If new total is less than old total, you over flowed. Keep the count. When doing the other side, the "total" and the overflow should match. This is not an elegant solution by any means, but it would be very easy to do and would work. Probably easiest to do out of RPG actually. Just zero the array before reading records. That way you don't even care what the record length is. Bob _______________________________________________ This is the MI Programming on the AS400 / iSeries (MI400) mailing list To post a message email: MI400@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/mi400 or email: MI400-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/mi400.
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.