AGSSSMR2 ;IHS/ASDS/SDH - SSA/SSN Matching Report ;
;;7.1;PATIENT REGISTRATION;;AUG 25,2005
;
;Changed all references of ^AGSSTEMP to ^AGSSTMP1
;
;This routine does NOT process records from SSA. This report
;simply goes through file, sorting by verification code in the
;file and generates a report. This routine does the output. See
;AGSSSMR1 for loading of data in global.
;
S ;EP - START
N AGSSPICK
S AGSSFLAG=0
N AGCOUNT,AGSSPG
S AGSSPG=1
D HOME^%ZIS
S AGSSUFAC=$P(^AUTTLOC(AGSSITE,0),"^",10)
S DIR("A")="Output to printer or file? "
S DIR("B")="printer"
S DIR("?")="File will be delimited for Excel or Access; Printer will be to screen/device"
S DIR(0)="S^P:PRINTER;F:FILE"
D ^DIR S AGSSPICK=Y
I AGSSPICK["^" S AGQUIT=1
I AGSSPICK["F" D OUTFILE
I AGSSPICK["P" D OUTFILE2
D EXIT
Q
QUE ;que to taskman
S ZTRTN="PROC^AZHTAGSS"
S ZTDESC="SSN Matching Report"
S ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL
S ZTSAVE("AGSS*")=""
G OUTFILE2
Q
OUTFILE ;setup for printing to file
S AGEXT=+$G(^AGSSTMP1("REPORT#"))
I AGEXT=0 S ^AGSSTMP1("REPORT#")=1,AGEXT=1
E S ^AGSSTMP1("REPORT#")=AGEXT+1
S AGSSHFL2="ss"_AGSSUFAC_"_"_$G(AGEXT)_".txt"
W !!,"Output File: ",AGSSHFL2,!
S DIR(0)="F"
S DIR("A")="Enter directory for file: "
S DIR("B")="/usr/spool/uucppublic/"
D ^DIR S AGSSP2=Y
Q:AGSSP2["^"
I "\/"'[$E(AGSSP2) D
.S:^%ZOSF("OS")["UNIX" AGSSP2="/"_AGSSP2 Q
.S AGSSP2="\"_AGSSP2
I "\/"'[$E(AGSSP2,$L(AGSSP2)) D
.S:^%ZOSF("OS")["UNIX" AGSSP2=AGSSP2_"/" Q
.S AGSSP2=AGSSP2_"\"
U 0 W !,"WRITING FILE...."
D OPEN^%ZISH("SSNFILE",AGSSP2,AGSSHFL2,"W")
U IO
D PRINT
D CLOSE^%ZISH("SSNFILE")
Q
OUTFILE2 ;setup for output to device
N IO
S ZTRTN="PRINT2^AGSSSMR2"
S ZTDESC="SSN Matching Report"
S ZTSAVE("AGSS*")=""
S %ZIS="Q"
D ^%ZIS
Q:POP
I $D(IO("Q")) D Q
.K IO("Q")
.S ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL
.D ^%ZTLOAD
.W !,"TASK #",$G(ZTSK)," QUEUED"
E D @ZTRTN
Q
PROC ;start processing
K AGSSCNT
PRINT ;prints to comma-delimited file
S AGSSHDR="Report for SSA SSN Matching Application" D AGSSHDR
I $D(AGSS("NORUN")) W !,"NO RUN SET SO ... NO REPORT",! Q
W !,"Total Records in file from NPIRS/SSA",?40,$G(^AGSSTMP1(AGSSITE,0,"COUNTS","TOT")),?55,"for "_$S($P($G(^AUTTLOC(AGSSITE,0)),U,2)'="":$P(^AUTTLOC(AGSSITE,0),U,2),1:"ASUFAC#"_AGSSITE)
S (AGSSBGT,%H)=$G(^AGSSTMP1(AGSSITE,0,"BEGIN-TIME")) D YX^%DTC
W !,"Starting Time",?40,Y
S (AGSSFNT,%H)=$G(^AGSSTMP1(AGSSITE,0,"END-DELTRAN")) D YX^%DTC
W !,"Ending Time",?40,Y
S AGSSDAY=(AGSSFNT/1)-(AGSSBGT/1)*24*60*60,AGSSSEC=AGSSDAY+($P(AGSSFNT,",",2))-($P(AGSSBGT,",",2)),AGSSMIN=AGSSSEC\60
I AGSSMIN<1 S AGSSMIN=1
W !,"Processing Time",?50,AGSSMIN," minutes"
S T="^"
S AGSSC=""
S (AGSSUFAC,AGSSCVC,AGSSHRN)=""
F S AGSSUFAC=$O(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC)) Q:AGSSUFAC="" D
.F S AGSSCVC=$O(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC)) Q:AGSSCVC="" D
..Q:AGSSCVC="TOT"
..Q:($G(AGACCTS))'[AGSSCVC
..D VCHDR
..F S AGSSHRN=$O(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN)) Q:AGSSHRN="" D
...F S AGSSC=$O(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN,AGSSC)) Q:AGSSC="" D
....S AGSSREC=$G(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN,AGSSC))
....S AGSS1SSN=$P(AGSSREC,U,3)
....S AGSSLN=$P(AGSSREC,U,4)
....S AGSSFN=$P(AGSSREC,U,5)
....S AGSSMN=$P(AGSSREC,U,6)
....S AGSSDOB=$P(AGSSREC,U,7)
....S AGSSDOB=$E(AGSSDOB,5,6)_"/"_$E(AGSSDOB,7,8)_"/"_$E(AGSSDOB,1,4)
....S AGSSSEX=$P(AGSSREC,U,8)
....U IO W !,AGSS1SSN_T_AGSSLN_T_AGSSFN_T_AGSSMN_T_AGSSDOB_T_AGSSSEX_T_AGSSCVC_T_AGSSHRN
Q
PRINT2 ;prints to device
S (AGSSUFAC,AGSSCVC,AGSSHRN)=""
S AGSSC=""
S AGSSHDR="Report for SSA SSN Matching Application" D AGSSHDR
I $D(AGSS("NORUN")) W !,"NO RUN SET SO ... NO REPORT",! Q
U IO W !,"Total Records in file from NPIRS/SSA",?40,$G(^AGSSTMP1(AGSSITE,0,"COUNTS","TOT")),?55,"for "_$S($P($G(^AUTTLOC(AGSSITE,0)),U,2)'="":$P(^AUTTLOC(AGSSITE,0),U,2),1:"ASUFAC#"_AGSSITE)
S (AGSSBGT,%H)=$G(^AGSSTMP1(AGSSITE,0,"BEGIN-TIME")) D YX^%DTC
W !,"Starting Time",?40,Y
S (AGSSFNT,%H)=$G(^AGSSTMP1(AGSSITE,0,"END-DELTRAN")) D YX^%DTC
U IO W !,"Ending Time",?40,Y
S AGSSDAY=(AGSSFNT/1)-(AGSSBGT/1)*24*60*60,AGSSSEC=AGSSDAY+($P(AGSSFNT,",",2))-($P(AGSSBGT,",",2)),AGSSMIN=AGSSSEC\60
I AGSSMIN<1 S AGSSMIN=1
U IO W !,"Processing Time",?50,AGSSMIN," minutes"
S AGCOUNT=AGCOUNT+4
S AGSSFLAG=1
F S AGSSUFAC=$O(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC)) Q:AGSSUFAC="" D Q:X["^"
.F S AGSSCVC=$O(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC)) Q:AGSSCVC="" D Q:X["^"
..Q:AGSSCVC="TOT"
..Q:($G(AGACCTS))'[AGSSCVC
..D VCHDR
..F S AGSSHRN=$O(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN)) Q:AGSSHRN="" D Q:X["^"
...F S AGSSC=$O(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN,AGSSC)) Q:AGSSC="" D Q:X["^"
....S AGSSREC=$G(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN,AGSSC))
....S AGSS1SSN=$P(AGSSREC,U,3)
....S AGSSLN=$P(AGSSREC,U,4)
....S AGSSFN=$P(AGSSREC,U,5)
....S AGSSMN=$P(AGSSREC,U,6)
....S AGSSDOB=$P(AGSSREC,U,7)
....S AGSSDOB=$E(AGSSDOB,5,6)_"/"_$E(AGSSDOB,7,8)_"/"_$E(AGSSDOB,1,4)
....S AGSSSEX=$P(AGSSREC,U,8)
....U IO W !,?2,AGSS1SSN,?13,AGSSLN,?28,AGSSFN,?39,AGSSMN,?51,AGSSDOB,?64,AGSSSEX,?68,AGSSCVC,?71,AGSSHRN
....S AGCOUNT=$G(AGCOUNT)+1
....I $G(IOST)["C",(AGCOUNT>IOSL) D
.....I '$D(ZTQUEUED) U 0 K DIR S DIR(0)="E" D ^DIR K DIR
.....Q:X["^"
.....D AGSSHDR,COLHDR
....E D
.....I AGCOUNT>IOSL D AGSSHDR,COLHDR
I '$D(ZTQUEUED),(X'["^") U 0 K DIR S DIR(0)="E" D ^DIR K DIR
W !!!,"*** END OF REPORT ***"
S DIR(0)="E"
S DIR("A")="ENTER RETURN TO CONTINUE"
D ^DIR K DIR
I $G(IOST)'["C" D CLOSE^%ZISH("SSNFILE")
Q
VCHDR ;header for each error code
U IO W !," ============================================================"
I AGSSCVC="V" D
.U IO W !!,?3,"VC=V: VERIFIED SSNs - ",^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)," Records",!
I AGSSCVC="1" D
.U IO W !!,?3,"VC=1: SSNs not in file",!,?5,"(impossible number/never issued to anyone/no SSN) - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
I AGSSCVC="2" D
.U IO W !!,?3,"VC=2: Name and DOB match, sex code doesn't - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records",!
I AGSSCVC="3" D
.U IO W !!,?3,"VC=3: Name and sex match, DOB doesn't - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records",!
I AGSSCVC="4" D
.U IO W !!,?3,"VC=4: Name matches, sex and DOB don't - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records",!
I AGSSCVC="5" D
.U IO W !!,?3,"VC=5: Name doesn't match, DOB and sex not checked - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records",!
I AGSSCVC="*" D
.U IO W !!,?3,"VC=*: SSN not verified;",!,?5,"SSA located different SSN based on name/DOB- "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
I AGSSCVC="A" D
.U IO W !!,?3,"VC=A: SSN not verified;",!,?5,"SSA found different SSN matched on Name/DOB - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
I AGSSCVC="B" D
.U IO W !!,?3,"VC=B: SSN not verified",!,?35,"SSA found different SSN matching on name only - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
I AGSSCVC="C" D
.U IO W !!,?3,"VC=C: SSN not verified;",!,?5,"Multiple SSNs found matching on name/DOB - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
I AGSSCVC="D" D
.U IO W !!,?3,"VC=D: SSN not verified;",!,?5,"Multiple SSNs found matching on name only - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
I AGSSCVC="E" D
.U IO W !!,?3,"VC=E: SSN not verified;",!,?5,"SSA found multiple matches for SSN - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
D COLHDR
S AGCOUNT=AGCOUNT+4
Q
COLHDR ;
I AGSSPICK["F" U IO W !!,"SSN"_T_"Last Name"_T_"First Name"_T_"Middle Name"_T_"DOB"_T_"Sex"_T_"VC"_T_"HRN"
I AGSSPICK["P" U IO W !!,?2,"SSN",?13,"Last Name",?28,"First Name",?39,"Middle Name",?51,"DOB",?64,"Sex",?68,"VC",?71,"HRN"
S AGCOUNT=$G(AGCOUNT)+2
Q
EXIT D ^%ZISC
K AGSSHFL,AGSSQ,AGSSREC,AGSSVC,AGSSHRN,AGSSDOB,AGSSSEX
K AGHDDR,AGSBGTM,AGSCREC,AGSITE,AGSS1SSN,AGSS2SSN,AGSSBGT,AGSSC
K AGSSCNT,AGSSCVC,AGSSDAY,AGSSFIO,AGSSFN,AGSSFNT,AGSSLN,AGSSMIN
K AGSSMN,AGSSPATH,AGSSRTOT,AGSSSEC,AGSSUFAC,AGSSPICK
K AG,AGK
Q
AGSSPG ;EP - PAGE HANDLER
Q:($Y<(IOSL-4))!($G(DOUT)!$G(DFOUT)) S:'$D(AGSSPG) AGSSPG=0 S AGSSPG=AGSSPG+1 I $E(IOST)="C" R !,"^ to quit ",X:DTIME I $E(X)="^" S DOUT=1,DFOUT=1,AGCOUNT=AGCOUNT+1 Q
AGSSHDR ;EP - PAGE HEADER HANDLER
I AGSSPG'=1 U IO W !!
U IO W ! Q:'$D(AGSSHDR) S:'$D(AGSSLINE) $P(AGSSLINE,"-",IOM-2)="" S:'$D(AGSSPG) AGSSPG=1 I '$D(AGSSDT) D DT^DICRW S Y=DT D DD^%DT S AGSSDT=Y
W ?(IOM-20-$L(AGSSHDR)/2),AGSSHDR,?(IOM-25),AGSSDT,?(IOM-10),"PAGE: ",AGSSPG,!,AGSSLINE
I AGSSPG'=1 S AGCOUNT=3 ;5
E S AGCOUNT=3
S AGSSPG=AGSSPG+1
EAGSSPG Q
STOP ;EP - to stop background processing
S ^AGSSTMP1(AGSSITE,0,"STOP")=1
Q
AGSSSMR2 ;IHS/ASDS/SDH - SSA/SSN Matching Report ;
+1 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
+2 ;
+3 ;Changed all references of ^AGSSTEMP to ^AGSSTMP1
+4 ;
+5 ;This routine does NOT process records from SSA. This report
+6 ;simply goes through file, sorting by verification code in the
+7 ;file and generates a report. This routine does the output. See
+8 ;AGSSSMR1 for loading of data in global.
+9 ;
S ;EP - START
+1 NEW AGSSPICK
+2 SET AGSSFLAG=0
+3 NEW AGCOUNT,AGSSPG
+4 SET AGSSPG=1
+5 DO HOME^%ZIS
+6 SET AGSSUFAC=$PIECE(^AUTTLOC(AGSSITE,0),"^",10)
+7 SET DIR("A")="Output to printer or file? "
+8 SET DIR("B")="printer"
+9 SET DIR("?")="File will be delimited for Excel or Access; Printer will be to screen/device"
+10 SET DIR(0)="S^P:PRINTER;F:FILE"
+11 DO ^DIR
SET AGSSPICK=Y
+12 IF AGSSPICK["^"
SET AGQUIT=1
+13 IF AGSSPICK["F"
DO OUTFILE
+14 IF AGSSPICK["P"
DO OUTFILE2
+15 DO EXIT
+16 QUIT
QUE ;que to taskman
+1 SET ZTRTN="PROC^AZHTAGSS"
+2 SET ZTDESC="SSN Matching Report"
+3 SET ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL
+4 SET ZTSAVE("AGSS*")=""
+5 GOTO OUTFILE2
+6 QUIT
OUTFILE ;setup for printing to file
+1 SET AGEXT=+$GET(^AGSSTMP1("REPORT#"))
+2 IF AGEXT=0
SET ^AGSSTMP1("REPORT#")=1
SET AGEXT=1
+3 IF '$TEST
SET ^AGSSTMP1("REPORT#")=AGEXT+1
+4 SET AGSSHFL2="ss"_AGSSUFAC_"_"_$GET(AGEXT)_".txt"
+5 WRITE !!,"Output File: ",AGSSHFL2,!
+6 SET DIR(0)="F"
+7 SET DIR("A")="Enter directory for file: "
+8 SET DIR("B")="/usr/spool/uucppublic/"
+9 DO ^DIR
SET AGSSP2=Y
+10 IF AGSSP2["^"
QUIT
+11 IF "\/"'[$EXTRACT(AGSSP2)
Begin DoDot:1
+12 IF ^%ZOSF("OS")["UNIX"
SET AGSSP2="/"_AGSSP2
QUIT
+13 SET AGSSP2="\"_AGSSP2
End DoDot:1
+14 IF "\/"'[$EXTRACT(AGSSP2,$LENGTH(AGSSP2))
Begin DoDot:1
+15 IF ^%ZOSF("OS")["UNIX"
SET AGSSP2=AGSSP2_"/"
QUIT
+16 SET AGSSP2=AGSSP2_"\"
End DoDot:1
+17 USE 0
WRITE !,"WRITING FILE...."
+18 DO OPEN^%ZISH("SSNFILE",AGSSP2,AGSSHFL2,"W")
+19 USE IO
+20 DO PRINT
+21 DO CLOSE^%ZISH("SSNFILE")
+22 QUIT
OUTFILE2 ;setup for output to device
+1 NEW IO
+2 SET ZTRTN="PRINT2^AGSSSMR2"
+3 SET ZTDESC="SSN Matching Report"
+4 SET ZTSAVE("AGSS*")=""
+5 SET %ZIS="Q"
+6 DO ^%ZIS
+7 IF POP
QUIT
+8 IF $DATA(IO("Q"))
Begin DoDot:1
+9 KILL IO("Q")
+10 SET ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL
+11 DO ^%ZTLOAD
+12 WRITE !,"TASK #",$GET(ZTSK)," QUEUED"
End DoDot:1
QUIT
+13 IF '$TEST
DO @ZTRTN
+14 QUIT
PROC ;start processing
+1 KILL AGSSCNT
PRINT ;prints to comma-delimited file
+1 SET AGSSHDR="Report for SSA SSN Matching Application"
DO AGSSHDR
+2 IF $DATA(AGSS("NORUN"))
WRITE !,"NO RUN SET SO ... NO REPORT",!
QUIT
+3 WRITE !,"Total Records in file from NPIRS/SSA",?40,$GET(^AGSSTMP1(AGSSITE,0,"COUNTS","TOT")),?55,"for "_$SELECT($PIECE($GET(^AUTTLOC(AGSSITE,0)),U,2)'="":$PIECE(^AUTTLOC(AGSSITE,0),U,2),1:"ASUFAC#"_AGSSITE)
+4 SET (AGSSBGT,%H)=$GET(^AGSSTMP1(AGSSITE,0,"BEGIN-TIME"))
DO YX^%DTC
+5 WRITE !,"Starting Time",?40,Y
+6 SET (AGSSFNT,%H)=$GET(^AGSSTMP1(AGSSITE,0,"END-DELTRAN"))
DO YX^%DTC
+7 WRITE !,"Ending Time",?40,Y
+8 SET AGSSDAY=(AGSSFNT/1)-(AGSSBGT/1)*24*60*60
SET AGSSSEC=AGSSDAY+($PIECE(AGSSFNT,",",2))-($PIECE(AGSSBGT,",",2))
SET AGSSMIN=AGSSSEC\60
+9 IF AGSSMIN<1
SET AGSSMIN=1
+10 WRITE !,"Processing Time",?50,AGSSMIN," minutes"
+11 SET T="^"
+12 SET AGSSC=""
+13 SET (AGSSUFAC,AGSSCVC,AGSSHRN)=""
+14 FOR
SET AGSSUFAC=$ORDER(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC))
IF AGSSUFAC=""
QUIT
Begin DoDot:1
+15 FOR
SET AGSSCVC=$ORDER(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC))
IF AGSSCVC=""
QUIT
Begin DoDot:2
+16 IF AGSSCVC="TOT"
QUIT
+17 IF ($GET(AGACCTS))'[AGSSCVC
QUIT
+18 DO VCHDR
+19 FOR
SET AGSSHRN=$ORDER(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN))
IF AGSSHRN=""
QUIT
Begin DoDot:3
+20 FOR
SET AGSSC=$ORDER(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN,AGSSC))
IF AGSSC=""
QUIT
Begin DoDot:4
+21 SET AGSSREC=$GET(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN,AGSSC))
+22 SET AGSS1SSN=$PIECE(AGSSREC,U,3)
+23 SET AGSSLN=$PIECE(AGSSREC,U,4)
+24 SET AGSSFN=$PIECE(AGSSREC,U,5)
+25 SET AGSSMN=$PIECE(AGSSREC,U,6)
+26 SET AGSSDOB=$PIECE(AGSSREC,U,7)
+27 SET AGSSDOB=$EXTRACT(AGSSDOB,5,6)_"/"_$EXTRACT(AGSSDOB,7,8)_"/"_$EXTRACT(AGSSDOB,1,4)
+28 SET AGSSSEX=$PIECE(AGSSREC,U,8)
+29 USE IO
WRITE !,AGSS1SSN_T_AGSSLN_T_AGSSFN_T_AGSSMN_T_AGSSDOB_T_AGSSSEX_T_AGSSCVC_T_AGSSHRN
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+30 QUIT
PRINT2 ;prints to device
+1 SET (AGSSUFAC,AGSSCVC,AGSSHRN)=""
+2 SET AGSSC=""
+3 SET AGSSHDR="Report for SSA SSN Matching Application"
DO AGSSHDR
+4 IF $DATA(AGSS("NORUN"))
WRITE !,"NO RUN SET SO ... NO REPORT",!
QUIT
+5 USE IO
WRITE !,"Total Records in file from NPIRS/SSA",?40,$GET(^AGSSTMP1(AGSSITE,0,"COUNTS","TOT")),?55,"for "_$SELECT($PIECE($GET(^AUTTLOC(AGSSITE,0)),U,2)'="":$PIECE(^AUTTLOC(AGSSITE,0),U,2),1:"ASUFAC#"_AGSSITE)
+6 SET (AGSSBGT,%H)=$GET(^AGSSTMP1(AGSSITE,0,"BEGIN-TIME"))
DO YX^%DTC
+7 WRITE !,"Starting Time",?40,Y
+8 SET (AGSSFNT,%H)=$GET(^AGSSTMP1(AGSSITE,0,"END-DELTRAN"))
DO YX^%DTC
+9 USE IO
WRITE !,"Ending Time",?40,Y
+10 SET AGSSDAY=(AGSSFNT/1)-(AGSSBGT/1)*24*60*60
SET AGSSSEC=AGSSDAY+($PIECE(AGSSFNT,",",2))-($PIECE(AGSSBGT,",",2))
SET AGSSMIN=AGSSSEC\60
+11 IF AGSSMIN<1
SET AGSSMIN=1
+12 USE IO
WRITE !,"Processing Time",?50,AGSSMIN," minutes"
+13 SET AGCOUNT=AGCOUNT+4
+14 SET AGSSFLAG=1
+15 FOR
SET AGSSUFAC=$ORDER(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC))
IF AGSSUFAC=""
QUIT
Begin DoDot:1
+16 FOR
SET AGSSCVC=$ORDER(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC))
IF AGSSCVC=""
QUIT
Begin DoDot:2
+17 IF AGSSCVC="TOT"
QUIT
+18 IF ($GET(AGACCTS))'[AGSSCVC
QUIT
+19 DO VCHDR
+20 FOR
SET AGSSHRN=$ORDER(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN))
IF AGSSHRN=""
QUIT
Begin DoDot:3
+21 FOR
SET AGSSC=$ORDER(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN,AGSSC))
IF AGSSC=""
QUIT
Begin DoDot:4
+22 SET AGSSREC=$GET(^AGSSTMP1(AGSSITE,"RECS",AGSSUFAC,AGSSCVC,AGSSHRN,AGSSC))
+23 SET AGSS1SSN=$PIECE(AGSSREC,U,3)
+24 SET AGSSLN=$PIECE(AGSSREC,U,4)
+25 SET AGSSFN=$PIECE(AGSSREC,U,5)
+26 SET AGSSMN=$PIECE(AGSSREC,U,6)
+27 SET AGSSDOB=$PIECE(AGSSREC,U,7)
+28 SET AGSSDOB=$EXTRACT(AGSSDOB,5,6)_"/"_$EXTRACT(AGSSDOB,7,8)_"/"_$EXTRACT(AGSSDOB,1,4)
+29 SET AGSSSEX=$PIECE(AGSSREC,U,8)
+30 USE IO
WRITE !,?2,AGSS1SSN,?13,AGSSLN,?28,AGSSFN,?39,AGSSMN,?51,AGSSDOB,?64,AGSSSEX,?68,AGSSCVC,?71,AGSSHRN
+31 SET AGCOUNT=$GET(AGCOUNT)+1
+32 IF $GET(IOST)["C"
IF (AGCOUNT>IOSL)
Begin DoDot:5
+33 IF '$DATA(ZTQUEUED)
USE 0
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
+34 IF X["^"
QUIT
+35 DO AGSSHDR
DO COLHDR
End DoDot:5
+36 IF '$TEST
Begin DoDot:5
+37 IF AGCOUNT>IOSL
DO AGSSHDR
DO COLHDR
End DoDot:5
End DoDot:4
IF X["^"
QUIT
End DoDot:3
IF X["^"
QUIT
End DoDot:2
IF X["^"
QUIT
End DoDot:1
IF X["^"
QUIT
+38 IF '$DATA(ZTQUEUED)
IF (X'["^")
USE 0
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
+39 WRITE !!!,"*** END OF REPORT ***"
+40 SET DIR(0)="E"
+41 SET DIR("A")="ENTER RETURN TO CONTINUE"
+42 DO ^DIR
KILL DIR
+43 IF $GET(IOST)'["C"
DO CLOSE^%ZISH("SSNFILE")
+44 QUIT
VCHDR ;header for each error code
+1 USE IO
WRITE !," ============================================================"
+2 IF AGSSCVC="V"
Begin DoDot:1
+3 USE IO
WRITE !!,?3,"VC=V: VERIFIED SSNs - ",^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)," Records",!
End DoDot:1
+4 IF AGSSCVC="1"
Begin DoDot:1
+5 USE IO
WRITE !!,?3,"VC=1: SSNs not in file",!,?5,"(impossible number/never issued to anyone/no SSN) - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
End DoDot:1
+6 IF AGSSCVC="2"
Begin DoDot:1
+7 USE IO
WRITE !!,?3,"VC=2: Name and DOB match, sex code doesn't - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records",!
End DoDot:1
+8 IF AGSSCVC="3"
Begin DoDot:1
+9 USE IO
WRITE !!,?3,"VC=3: Name and sex match, DOB doesn't - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records",!
End DoDot:1
+10 IF AGSSCVC="4"
Begin DoDot:1
+11 USE IO
WRITE !!,?3,"VC=4: Name matches, sex and DOB don't - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records",!
End DoDot:1
+12 IF AGSSCVC="5"
Begin DoDot:1
+13 USE IO
WRITE !!,?3,"VC=5: Name doesn't match, DOB and sex not checked - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records",!
End DoDot:1
+14 IF AGSSCVC="*"
Begin DoDot:1
+15 USE IO
WRITE !!,?3,"VC=*: SSN not verified;",!,?5,"SSA located different SSN based on name/DOB- "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
End DoDot:1
+16 IF AGSSCVC="A"
Begin DoDot:1
+17 USE IO
WRITE !!,?3,"VC=A: SSN not verified;",!,?5,"SSA found different SSN matched on Name/DOB - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
End DoDot:1
+18 IF AGSSCVC="B"
Begin DoDot:1
+19 USE IO
WRITE !!,?3,"VC=B: SSN not verified",!,?35,"SSA found different SSN matching on name only - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
End DoDot:1
+20 IF AGSSCVC="C"
Begin DoDot:1
+21 USE IO
WRITE !!,?3,"VC=C: SSN not verified;",!,?5,"Multiple SSNs found matching on name/DOB - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
End DoDot:1
+22 IF AGSSCVC="D"
Begin DoDot:1
+23 USE IO
WRITE !!,?3,"VC=D: SSN not verified;",!,?5,"Multiple SSNs found matching on name only - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
End DoDot:1
+24 IF AGSSCVC="E"
Begin DoDot:1
+25 USE IO
WRITE !!,?3,"VC=E: SSN not verified;",!,?5,"SSA found multiple matches for SSN - "_^AGSSTMP1(AGSSITE,0,"COUNTS",AGSSCVC)_" Records"
End DoDot:1
+26 DO COLHDR
+27 SET AGCOUNT=AGCOUNT+4
+28 QUIT
COLHDR ;
+1 IF AGSSPICK["F"
USE IO
WRITE !!,"SSN"_T_"Last Name"_T_"First Name"_T_"Middle Name"_T_"DOB"_T_"Sex"_T_"VC"_T_"HRN"
+2 IF AGSSPICK["P"
USE IO
WRITE !!,?2,"SSN",?13,"Last Name",?28,"First Name",?39,"Middle Name",?51,"DOB",?64,"Sex",?68,"VC",?71,"HRN"
+3 SET AGCOUNT=$GET(AGCOUNT)+2
+4 QUIT
EXIT DO ^%ZISC
+1 KILL AGSSHFL,AGSSQ,AGSSREC,AGSSVC,AGSSHRN,AGSSDOB,AGSSSEX
+2 KILL AGHDDR,AGSBGTM,AGSCREC,AGSITE,AGSS1SSN,AGSS2SSN,AGSSBGT,AGSSC
+3 KILL AGSSCNT,AGSSCVC,AGSSDAY,AGSSFIO,AGSSFN,AGSSFNT,AGSSLN,AGSSMIN
+4 KILL AGSSMN,AGSSPATH,AGSSRTOT,AGSSSEC,AGSSUFAC,AGSSPICK
+5 KILL AG,AGK
+6 QUIT
AGSSPG ;EP - PAGE HANDLER
+1 IF ($Y<(IOSL-4))!($GET(DOUT)!$GET(DFOUT))
QUIT
IF '$DATA(AGSSPG)
SET AGSSPG=0
SET AGSSPG=AGSSPG+1
IF $EXTRACT(IOST)="C"
READ !,"^ to quit ",X:DTIME
IF $EXTRACT(X)="^"
SET DOUT=1
SET DFOUT=1
SET AGCOUNT=AGCOUNT+1
QUIT
AGSSHDR ;EP - PAGE HEADER HANDLER
+1 IF AGSSPG'=1
USE IO
WRITE !!
+2 USE IO
WRITE !
IF '$DATA(AGSSHDR)
QUIT
IF '$DATA(AGSSLINE)
SET $PIECE(AGSSLINE,"-",IOM-2)=""
IF '$DATA(AGSSPG)
SET AGSSPG=1
IF '$DATA(AGSSDT)
DO DT^DICRW
SET Y=DT
DO DD^%DT
SET AGSSDT=Y
+3 WRITE ?(IOM-20-$LENGTH(AGSSHDR)/2),AGSSHDR,?(IOM-25),AGSSDT,?(IOM-10),"PAGE: ",AGSSPG,!,AGSSLINE
+4 ;5
IF AGSSPG'=1
SET AGCOUNT=3
+5 IF '$TEST
SET AGCOUNT=3
+6 SET AGSSPG=AGSSPG+1
EAGSSPG QUIT
STOP ;EP - to stop background processing
+1 SET ^AGSSTMP1(AGSSITE,0,"STOP")=1
+2 QUIT