Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACRFUFMC

ACRFUFMC.m

Go to the documentation of this file.
  1. ACRFUFMC ;IHS/OIRM/DSD/AEF - STANDALONE UTILITY TO VERIFY BANK ROUTING NUMBERS [ 05/02/2007 9:44 AM ]
  1. ;;2.1;ADMIN RESOURCE MGMT SYSTEM;**22**;NOV 05, 2001
  1. ;LOOP THROUGH CORE OPEN DOCUMENT TMP FILE AND FIND MATCH IN ARMS
  1. ;
  1. ;Algorithm to validate Bank Routing Number:
  1. ;The algorithm to check the ABA Routing Number is as follows:
  1. ;start with a routing number like 789456124.
  1. ;
  1. ;Here's how the algorithm works.
  1. ;First, strip out any non-numeric characters (like dashes or spaces)
  1. ;and makes sure the resulting string's length is nine digits,
  1. ;789456124
  1. ;Then multiply the first digit by 3,
  1. ;the second by 7, the third by 1, the fourth by 3,
  1. ;the fifth by 7, the sixth by 1, etc., and add them all up.
  1. ;
  1. ;(7 x 3) + (8 x 7) + (9 x 1) +
  1. ;(4 x 3) + (5 x 7) + (6 x 1) +
  1. ;(1 x 3) + (2 x 7) + (4 x 1) = 160
  1. ;If the resulting number is an integer multiple of 10, then the number is valid.
  1. ;To calculate what the checksum digit should be,
  1. ;follow the above algorithm for the first 8 digits.
  1. ;In the case above, you would come up with 156.
  1. ;Thus, to make the total number an integer multiple of 10,
  1. ;the final check digit must be 4.
  1. ;
  1. EN ;EP;
  1. K ^ACRZ("BADROUTE")
  1. N ACRV,ACRV0,ACRR,ACRX,ACRY,ACRZ
  1. S ACRV=0
  1. F S ACRV=$O(^AUTTVNDR(ACRV)) Q:'ACRV D
  1. .S ACRV0=$G(^AUTTVNDR(ACRV,0))
  1. .Q:$P(ACRV0,U,5) ;DON'T BOTHER WITH INACTIVE VENDORS
  1. .S ACRR=$P($G(^AUTTVNDR(ACRV,19)),U,2)
  1. .Q:ACRR="" ;NO BANK ROUTING TO VERIFY
  1. .I $$RCK(ACRR) Q ;PASSES CHECK
  1. .S ^ACRZ("BADROUTE",ACRV)=ACRV0_U_ACRR
  1. Q
  1. ; ****************************************************
  1. RCK(ACRR) ;EP;EXTRINSIC FUNCTION TO CHECKSUM THE EFT BANK ROUTING NUMBER
  1. ; ENTERS WITH THE ROUTING NUMBER = ACRX
  1. ;
  1. ; RETURNS 0 IF BAD
  1. ; 1 IF GOOD
  1. N ACRX
  1. S ACRX=$TR(ACRR," ")
  1. S ACRX=$TR(ACRX,"-")
  1. I $L(ACRX)'=9 Q 0 ;BAD LENGTH
  1. N I,P,PP,ACRT8,ACRT9,ACRLAST
  1. S ACRT8=0
  1. F I=1:1:9 S P(I)=$E(ACRX,I)
  1. F I=1:3:7 S PP(I)=P(I)*3
  1. F I=2:3:8 S PP(I)=P(I)*7
  1. F I=3:3:9 S PP(I)=P(I)*1
  1. F I=1:1:8 S ACRT8=ACRT8+PP(I)
  1. S ACRT9=ACRT8+PP(9)
  1. I ACRT9#10'=0 Q 0 ;NOT A MULTIPLE OF 10
  1. S ACRLAST=$E(ACRX,9)
  1. I ACRT8+ACRLAST'=ACRT9 Q 0 ;BAD CHECKSUM NUMBER
  1. Q 1