All of that is over my head. They have 7 machines now and will consolidate
them to one over the next two years. I think I will start with the machine
number as the first digit and start with 000001 for the first employee and
work my way up from there.
Paul Nelson
Cell 708-670-6978
Office 512-392-2577
nelsonp@xxxxxxxxxxxxx
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Adam Glauser
Sent: Monday, October 22, 2007 7:43 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Calling all math wizards
Paul Nelson wrote:
A client has posed an interesting problem. His employee master file
contains a 2 digit company number, a 3 digit division number, and a
5 digit employee number. He needs to have some math done to generate
a unique 7 digit number.
Don wrote:
Something tells me that there's a hash out there that could do the trick
for
you here..
A one-way hash was the first thing that came to mind for me too. Paul
could use the Qc3CalculateHash (QC3CALHA) API in an SQL stored
procedure. However, there are a couple of potential problems with this
approach.
1. The shortest possible hash value using the API comes from the MD5
algorithm. The length of an MD5 hash is 16 bytes. Paul would still
need to map from this hash value to a 7 digit number, introducing more
opportunity for collisions. Of course, it should be possible to test
for every possible combination of company number, division and employee
number, but it might take far too long.
2. It isn't feasible to go from the hash value to the number. It is
unclear whether round-tripping is a requirement or not.
3. The Qc3CalculateHash API wasn't introduced until V5R3.
Hope this helps,
Adam
As an Amazon Associate we earn from qualifying purchases.