|
Well since I was sort of rude, here's the routine from RPG xTools: D GetModulus10Ex PI 10I 0 ******************************************************* ** (c) Copyright 2004 - Robert Cozzi, Jr. ** All rights reserved. ** Part of the RPG xTools *SRVPGM ****************************************************** D nInput 30P 0 Const D bHasCheckDigit... D 1N Const OPTIONS(*NOPASS) D nCheckDigit S 5I 0 Inz(0) D Number DS D nZoned 30S 0 Inz D zDigit 1S 0 Dim(%size(nZoned)) Overlay(nZoned) D Filler Like(nZoned) D Odd_DS DS Inz D nOdd 2S 0 Dim(%size(nZoned)) D p_DS S * Inz(%addr(Odd_DS)) D AllAll_DS DS Based(p_DS) D nAllOdd1 1S 0 Dim(%size(nZoned)) D nAllOdd2 1S 0 Dim(%size(nZoned)) D i S 5I 0 D bOdd S 1N Inz(*ON) D nCheckSum S 10I 0 D nEvenSum S 10I 0 D nOddSum S 10I 0 D nOddSum1 S 10I 0 D nOddSum2 S 10I 0 D nStart S 10I 0 D nShift S 10I 0 C eval nZoned = nInput C if %Parms >= 2 and C bHasCheckDigit = *ON C eval nShift = 1 C else C eval nShift = 0 C endif C eval nStart = %Len(nZoned) - %Len(%Char(nZoned)) C eval nStart = nStart + 1 C for i = (%Len(nZoned) - nShift) DOWNTO nStart C if bOdd C eval nOdd(i) = zDigit(i) * 2 C else C eval nEvenSum = nEvenSum + zDigit(i) C endif C eval bOdd = NOT (bOdd) C endfor C xfoot nAllOdd1 nOddSum1 C xfoot nAllOdd2 nOddSum2 C eval nCheckSum= nOddSum1 + nOddSum2 + nEvenSum C dow %REM(nCheckSum+nCheckDigit:10)<> 0 C eval nCheckDigit = nCheckDigit + 1 C enddo ** Check Digit 10 needs no translation in Modulus10; ** but for ISBN it needs to be replaced with an "X". C return nCheckDigit P GetModulus10Ex E -Bob Cozzi www.RPGxTools.com RPG xTools - Enjoy programming again. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Shore Sent: Wednesday, April 12, 2006 3:29 PM To: RPG programming on the AS400 / iSeries Subject: RE: Mod 10 check digit calculation Unfortunately - we don't have the RPG xTools. Hence my cry for help Alan "Bob Cozzi" <cozzi@xxxxxxxxx> Sent by: To rpg400-l-bounces@ "'RPG programming on the AS400 / midrange.com iSeries'" <rpg400-l@xxxxxxxxxxxx> cc 04/12/2006 04:06 Subject PM RE: Mod 10 check digit calculation Please respond to RPG programming on the AS400 / iSeries <rpg400-l@midrang e.com> Alan, RPG xTools has the modulus calculations in it and it is being used to everything including 400 million books' UPC/GTIN validation. -Bob Cozzi www.RPGxTools.com RPG xTools - Enjoy programming again. -----Original Message----- From: rpg400-l-bounces+cozzi=rpgiv.com@xxxxxxxxxxxx [mailto:rpg400-l-bounces+cozzi=rpgiv.com@xxxxxxxxxxxx] On Behalf Of Alan Shore Sent: Wednesday, April 12, 2006 1:40 PM To: RPG programming on the AS400 / iSeries Subject: Mod 10 check digit calculation Hi gang, does anyone have a program/sub-routine/mod etc. to calculate the mod 10 check-digit for a numbers with varying sizes. I know the procedure for what is required in calculating the answer, but right now I'm up to my neck with everything else. It would be MUCH appreciated if someone could post whatever code they have. Thanks in advance Alan Shore NBTY, Inc (631) 244-2000 ext. 5019 AShore@xxxxxxxx -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.