VALIDATE 9 DIGIT ROUTING NUMBER

0 pts.
Tags:
RPG
What is the RPG code I need create in order to validate a bank routing number..I basically have the algorithm, but not sure how to separate each digit and make the necessary calculation for each of the 9 digits in order to validate that the user entered the correct routing number in a specific field..Please help!
ASKED: January 27, 2006  11:33 AM
UPDATED: November 25, 2009  7:02 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Francis responds:

“I wrote this program for a similar requirement. It isn’t a part of a service program, but it can be added to one easily enough. CALLP ARC988 with PASS = *blank, and the transit number you want to verify. If the number is good, PASS will be blank after the call. If PASS=”E”, then the transit number is not valid. Call it with PASS=”L” to set on *INLR (we do this when the calling program exits — this is for pre-ILE compatibility). Hope this is useful.”

– Debra Tart, associate editor

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • DebraTart
    Jonathan responds: I'm surprised that this is such a big problem. In order to separate the digits, you need to move the incoming data from its numeric field to a 9 position array where each position is 1 position numeric, zero decimals. Once this is done you simply write code to process each position of the array with the appropriate math to do the modulus check and then compare the result to the check digit. If they match, you have a good number; if not, the entered data is incorrect. If the requester is still confused, have him/her contact me directly. I may have a routine to do this. The ABA check is not pure modulus 10 or modulus 11. -- Debra Tart, associate editor
    0 pointsBadges:
    report
  • DebraTart
    Bill responds: "An easy way to do this would be to MOVEA the 9 digit number to a 9 place array and then operate on each element separately. Simple, but it works." -- Debra Tart, associate editor
    0 pointsBadges:
    report
  • TomLiotta
    Ideally, it will be a 3x3 array. The 1st, 4th and 7th digits are multiplied by 3; 2nd, 5th and 8th by 7; 3rd, 6th and 9th by 1 (unchanged). The values are summed and have modulus 10 applied. Result should be zero.
         H Debug
         H NoMain
    
         D ARRAYDIM        c                   3
         D CBR             pr            10u 0 extproc( 'ChkBankRouting' )
         D*BRN             s              9   
    
         P CBR             b                   export
    
         D CBR             pi            10u 0
         D*BRN             s              9    
    
         D sumBRN          s              5u 0 inz( 0 )
         D i               s              5u 0 inz( 0 )
    
         D BRN             s              9    inz( '222371863' )
         D pDigits         s               *   inz( %addr( BRN ) )
         d Digit           s              1s 0 dim( ARRAYDIM ) based( pDigits )
    
          /free
    
            for i = 1 to 3 ;
    
               sumBRN += ( 3 * Digit( 1 )) + ( 7 * digit( 2 )) + Digit( 3 ) ;
               pDigits += 3 ;
    
            endfor ;
    
           dump     ;
            return   %int(( %rem( sumBRN : 10 ) = 0 )) ;
    
          /end-free
    
         P CBR             e
    That has an example routing number as a constant for basic testing. Comment it out and uncomment the argument definitions to make it 'real'. Also, it's set to return a 4-byte integer because that's what I felt like testing with. You can make it an indicator variable and remove the %INT() bif in the RETURN statement. (Don't forget to use EXTPROC(*CL:) if you do.) Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following