The quick answer is how do you want to do it? The way I have done it in the past is to first identify how to the software is to be licenced. Is it by processor, serial number, model, number of seats, etc. As an example, we'll just use the Serial Number. The serial number stored in system value QSRLNBR is an eight character field with leading blanks. I then jumble up the positions of the characters in the serial number to make it harder to decode, so ' 44CB123' becomes 'C1 43B24'. I then have an encryption routine that has nine arrays in it - one for use as an index and the others for each position of the serial number. Each array has 38 single character elements and may look like the example below. The important thing here is to not duplicate any character in the eight positional arrays. It doesn't matter if you have the same character in the same position in different arrays, but each character must be unique within the array itself. Your program should read through the eight jumbled up characters of the serial number and do a lookup on the Index array. The corresponding character from the "position" array should then be used for the encoded serial number. In opur example for instance, the encoded serial number would begin "0E...". The encoded serial number should then be stored somewhere for reference. Rather than have a decoding process to check that the software is licensed, your software at some convenient point should call the encoding routine and check the serial number against the one stored above. If they match it's okay, if not then end the job and sign-off. You can extend the licence key to contain whatever you like; Serial No, Model No, Processor Feature, No of Users, Expiration Date, etc. You just need more arrays. Only thing to remember is that your licence checking routine is called from a global routine that your customers don't have source for. Also make sure it's compiled so that it can't be debugged, traced, etc. Alternatively you can use IBM API's and make use of the Licensed Product features on the AS/400, but I haven't tried that, yet... Hope this helps. Jonathan www.astradyne-uk.com
Code
Code
Comment