× 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.



Sarvapriya - Thanks for the reply. Believe me, ANY response to ANY of my
questions is ALWAYS appreciated.
Bob Cozzi was kind enough to supply me with coding to handle a particular
method of MOD10. This method was the one I expected, however, when the
write-up was shown to me, it turned out that I had to tweak and change this
coding to handle how this particular MOD10 was supposed to be calculated.
However, thanks for your reply

Alan


                                                                       
             Sarvapriya_Tripat                                         
             hi@xxxxxxxxx                                              
             Sent by:                                                   To
             rpg400-l-bounces@         rpg400-l@xxxxxxxxxxxx           
             midrange.com                                               cc
                                                                       
                                                                   Subject
             04/13/2006 12:55          RE: Mod 10 check digit calculation
             PM                                                        
                                                                       
                                                                       
             Please respond to                                         
              RPG programming                                          
              on the AS400 /                                           
                  iSeries                                              
             <rpg400-l@midrang                                         
                  e.com>                                               
                                                                       
                                                                       




Alan,

Sorry for being late to the party, but would something like this work for
you. I have not tested it thoroughly though ( eg you need to validate that
the string coming in has numerics only). This is based on the logic given
in IBM DDS reference manual - CHECK keyword for display files.


     h NoMain

     d mod10           pr            10i 0
     d   string                     100a   const varying

     p mod10           b                   export
     d mod10           pi            10i 0
     d   string                     100a   const varying
     d sum             s             10i 0 inz(0)
     d x               s             10i 0 inz(2)
     d i               s             10i 0
      /free
         for i = 1 to %len(string);
            sum += %rem((%int(%subst(string:i:1))*x-1):9) + 1;
            x = 3-x;
         endfor;
         // Return the check digit
         return %rem((10-%rem(sum:10)-1):9)+1;
      /end-free
     p mod10           e


you could call it as -



     d mod10           pr            10i 0 ExtProc('MOD10')
     d   string                     100a   const varying


     d string          s             10a   varying
     d chkdigit        s             10I 0 inz(0)
      /free
         string = '61248';
         chkdigit = mod10(string);
         dsply %char(chkdigit);
         *inlr = '1';
      /end-free



==================================================================
Alan Shore wrote:
==================================================================


date: Wed, 12 Apr 2006 16:28:46 -0400
from: Alan Shore <AlanShore@xxxxxxxx>
subject: RE: Mod 10 check digit calculation


Unfortunately - we don't have the RPG xTools. Hence my cry for help

Alan


******************************************************************************


The  information contained in this electronic communication and any
accompanying document is confidential, may be attorney-client privileged,
and is intended only for the use of the addressee.  It is the property of
Ryder System, Inc.  Unauthorized use, disclosure or copying of this
communication, or any part of it, is strictly prohibited and may be
unlawful.  If you have received this communication in error, please notify
the sender immediately by return email, and destroy this communication and
all copies of it, including all attachments.  Electronic communication may
be susceptible to data corruption, interception and unauthorized tampering
and Ryder disclaims all liability of any kind for such actions or any
consequences that may arise directly or indirectly therefrom.
******************************************************************************

--
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.