source: WorldVistAEHR/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFSPC.m@ 862

Last change on this file since 862 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.0 KB
RevLine 
[613]1MPIFSPC ;SLC/ARS-MASTER PATIENT INDEX SYSTEM CHECK SUM RTN ;SEP 4, 1996
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**48**;30 Apr 99;Build 6
3 ;MPICHECK
4CHECKDG(NUM) ;Check Digit Calculation
5 ;change to local array of MPI global.
6 ;D EXIN **48 CHANGE TO FUNCTION CALL
7 ;K I,J,LTH,MPID,MPIMAP,MPIT,TAB,VAL
8 N TMP
9 S TMP=$$EXIN(NUM)
10 Q TMP
11READ ;
12 ;
13EXIN(NUM) ;**48 MADE THIS A FUNCTION CALL
14 N SUM,I,J,LTH,MPID,MPIMAP,MPIT,TAB,VAL
15 I $L(NUM)'=16 D
16 .; W !,"I WILL PAD TO 16!"
17 .S LTH=($L(NUM)+1) F I=LTH:1:16 S NUM="0"_NUM
18 F MPIT=1:1:6 D
19 .; For each check digit, compute a value
20 .F MPID=1:1:16 D
21 ..S MPIMAP(MPIT,0,"MAP")=0
22 ..S MPIMAP(MPIT,MPID)=$E(NUM,MPID),VAL=MPIMAP(MPIT,MPID)
23 ..S SUM=(MPIMAP(MPIT,MPID)+(MPIMAP(MPIT,MPID-1,"MAP")))#10
24 ..S MPIMAP(MPIT,MPID,"MAP")=$P($P(^MPIF(984.5,MPIT,SUM),"^",2),";",MPID)
25 .S TAB(MPIT)=MPIMAP(MPIT,16,"MAP")
26 .;Q
27 S SUM=""
28 F J=1:1:6 D
29 .S SUM=SUM_TAB(J)
30 Q SUM
31 ;
32 ;Before calculation of check digits the number must be
33 ;expanded to sixteen digits by padding zeros to the
34 ;left of the number.
Note: See TracBrowser for help on using the repository browser.