× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



(written many years ago, and this only works for 20 character string)
jim

H*          CALC CHECK DIGIT FOR 20 CHAR NUMBER.
H*          FROM USPS PUB 109, CHAPTER 7
H*          WEIGHTED MOD 10
H*--------------------------------------------------------------- H* PROGRAM MODIFICATIONS -
H*
H*  09/07/00  WRITTEN    JF
H*  04/02/02  convert to ile
H*--------------------------------------------------------------- D @IN S 1 DIM(20)
C     *ENTRY        PLIST
C                   PARM                    @IN20            20
C                   PARM                    @CKD              1
C* MOVE INPUT TO AN ARRAY
C                   MOVEA     @IN20         @IN
C                   MOVE      *ZEROS        EVEN              3 0
C                   MOVE      *ZEROS        ODD               3 0
C                   MOVE      *ZEROS        @CKD#             1 0
C* ADD UP EVEN POSITIONS (RIGHT TO LEFT), SO ,19, 17, 15, ETC
C                   Z-ADD     19            X                 3 0
C                   DO        10
C                   MOVE      @IN(X)        @1
C                   ADD       @1            EVEN
C                   SUB       2             X
C                   ENDDO
C* ADD UP ODD POSITIONS (RIGHT TO LEFT), SO ,18, 16, 14, ETC.
C                   Z-ADD     18            X
C                   DO        9
C                   MOVE      @IN(X)        @1
C                   ADD       @1            ODD
C                   SUB       2             X
C                   ENDDO
C* MULT EVEN BY 3
C* ADD ODD
C* CHK DIGIT = NUMBER TO ADD TO NEAREST 10.
C     EVEN          MULT      3             TOTAL             5 0
C                   ADD       ODD           TOTAL
C                   Z-ADD     0             @CKD#
C                   DO        9
C                   MOVE      TOTAL         @1                1 0
C     @1            IFEQ      0
C                   LEAVE
C                   ENDIF
C                   ADD       1             TOTAL
C                   ADD       1             @CKD#
C                   ENDDO
C* END PGM
C                   MOVE      @CKD#         @CKD
C                   RETURN
----- Original Message ----- From: "Alan Shore" <AlanShore@xxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, April 12, 2006 2:39 PM
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.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.