I need to have some way of converting single characters in RPGLE into integers - does anyone know a good way? It has to work for all possible inputs and ideally provide a different integer for each input - at the very least it must provide a different value for all common inputs. I don't care particularly what the integers are. In a C like language I would take the ASCII value or similar - ideally I want something equivalent to that.
Example to make it clear how I want it to work:
characterData = "Hello";
for i = 1 to %len(string);
singleCharacter = %subst(characterData:i:1);
number = myFunction(singleCharacter);
dsply 'The value of ' + singleCharacter + ' is ' + %char(number);
endfor;
This would print
The value of H is 72 The value of e is 101 The value of l is 108 The value of l is 108 The value of o is 111
but note that I actually don't care what the numbers are, just that they are different for each input.
All of this in aid of building a hash function for character data in RPGLE, so if you know a good way of doing that then that would be a better answer.
Thanks