I am having trouble getting a check digit program to work using a nine-digit number to generate a tenth-check digit,...
I tried several ways, but I keep getting the wrong results. Any suggestions?
Try arithmetic... Without knowing which check digit algorithm you are using, I would not be able to comment. I would normally look at your code and run through the working and non-working values to see what was wrong --- pretty much what you would be doing. I would also check that the results I am TOLD I should get are in fact themselves correct!
But in general, you first have to understand the algorithm. Use paper and pen to run though the steps you would take to get a right answer every time.
Then take your successful method and design the code. You may need a few tweaks, but it should work.
Dig Deeper on iSeries ILE programming
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ...continue reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ...continue reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.