DGMSRPT2 ;ALB/LBD - Military Service Inconsistency Report; 01/05/04
;;5.3;Registration;**562**; Aug 13,1993
;
; This routine prints the Military Service Data Inconsistencies
; report from the extracted data stored in ^XTMP("DSMSRPT").
;
;
EN(DGBEG,DGEND,DGSRT) ; Entry point called from ^DGMSRPT
; INPUT: DGBEG - Starting record number to print
; DGEND - Ending record number to print
; DGSRT - Sort order for report (Name or SSN)
N PG,LINE,RPTDT,CRT,OUT,DSH,CNT,MXLNE,DGXTMP,DGTOT,LOOP
S:$G(ZTSK) ZTREQ="@"
D PRTVAR
U IO D HDR
I 'DGTOT W !!,?10,"*** There are no records to print ***" S OUT=$$PAUSE Q
S LOOP="LOOP"_DGSRT
D @LOOP Q:OUT
D TOT Q:OUT
W ! S OUT=$$PAUSE
Q
LOOPN ; Sort by name. Loop through ^XTMP("DGMSRPT","MSINC","NAM", x-ref
N NM,DFN
S NM=""
F S NM=$O(@DGXTMP@("NAM",NM)) Q:NM=""!(CNT>DGEND)!OUT S DFN="" F S DFN=$O(@DGXTMP@("NAM",NM,DFN)) Q:DFN=""!(CNT>DGEND)!OUT S CNT=CNT+1 I CNT'<DGBEG,CNT'>DGEND D PRINT
Q
LOOPS ; Sort by SSN. Loop through ^XTMP("DGMSRPT","MSINC","SSN", x-ref
N S2,S4,S9,DFN
S S2=""
F S S2=$O(@DGXTMP@("SSN",S2)) Q:S2=""!(CNT>DGEND)!OUT S S4="" F S S4=$O(@DGXTMP@("SSN",S2,S4)) Q:S4=""!(CNT>DGEND)!OUT D
. S S9=""
. F S S9=$O(@DGXTMP@("SSN",S2,S4,S9)) Q:S9=""!(CNT>DGEND)!OUT S DFN="" F S DFN=$O(@DGXTMP@("SSN",S2,S4,S9,DFN)) Q:DFN=""!(CNT>DGEND)!OUT S CNT=CNT+1 I CNT'<DGBEG,CNT'>DGEND D PRINT
Q
PRINT ; Print detail
N VET,CT,CAT,IN
Q:'$D(@DGXTMP@(DFN))
S VET=$G(@DGXTMP@(DFN,0))
I LINE>MXLNE S OUT=$$PAUSE Q:OUT D HDR
W !,$P(VET,U,2),?12,$E($P(VET,U,1),1,25)
S LINE=LINE+1,CAT=0
F CT=1:1 S CAT=$O(@DGXTMP@(DFN,CAT)) Q:CAT=""!OUT D
. I CT>1 D
. . I LINE>MXLNE S OUT=$$PAUSE Q:OUT D HDR
. . W ! S LINE=LINE+1
. W ?37,CAT
. S IN="" F S IN=$O(@DGXTMP@(DFN,CAT,IN)) Q:IN=""!OUT D
. . I IN>1 D Q:OUT
. . . I LINE>MXLNE S OUT=$$PAUSE Q:OUT D HDR
. . . W ! S LINE=LINE+1
. . W ?43,@DGXTMP@(DFN,CAT,IN)
Q
TOT ; Print total records at the end of the report
I LINE+5>MXLNE S OUT=$$PAUSE Q:OUT D HDR
W !!," Starting Record #:",$$RJ^XLFSTR(DGBEG,7)
W !," Ending Record #:",$$RJ^XLFSTR(DGEND,7)
W !!,"Total Records Printed:",$$RJ^XLFSTR((DGEND-DGBEG)+1,7)," out of ",DGTOT
Q
PRTVAR ; Set up variables needed to print report
S CRT=$S($E(IOST,1,2)="C-":1,1:0)
S DGXTMP="^XTMP(""DGMSRPT"",""MSINC"")"
S DGTOT=+$G(@DGXTMP@("CNT","VET"))
S:'$G(DGBEG) DGBEG=1 S:'$G(DGEND) DGEND=DGTOT
S:$G(DGSRT)="" DGSRT="N"
S (PG,CNT,OUT)=0,RPTDT=$$FMTE^XLFDT(DT),MXLNE=$S(CRT:15,1:52)
S DSH="",$P(DSH,"=",80)=""
Q
HDR ; Print report header
S PG=PG+1,LINE=0
W @IOF
W ?0,"Report Date: ",RPTDT,?68,"Page: ",$$RJ^XLFSTR(PG,4)
W !,"Sorted By: "_$S(DGSRT="N":"Name",1:"SSN (Terminal Digits)")
W !!,$$CJ^XLFSTR("MILITARY SERVICE DATA INCONSISTENCIES DETAIL REPORT",80)
W !!,"SSN",?12,"Veteran's Name",?37,"Cat. Inconsistencies"
W !,DSH
Q
PAUSE() ; If report is sent to screen, prompt for next page or quit
N DIR,DIRUT,DUOUT,DTOUT,X,Y
I 'CRT Q 0
S DIR(0)="E"
D ^DIR I 'Y Q 1
Q 0
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGMSRPT2 3077 printed Oct 16, 2024@18:45:01 Page 2
DGMSRPT2 ;ALB/LBD - Military Service Inconsistency Report; 01/05/04
+1 ;;5.3;Registration;**562**; Aug 13,1993
+2 ;
+3 ; This routine prints the Military Service Data Inconsistencies
+4 ; report from the extracted data stored in ^XTMP("DSMSRPT").
+5 ;
+6 ;
EN(DGBEG,DGEND,DGSRT) ; Entry point called from ^DGMSRPT
+1 ; INPUT: DGBEG - Starting record number to print
+2 ; DGEND - Ending record number to print
+3 ; DGSRT - Sort order for report (Name or SSN)
+4 NEW PG,LINE,RPTDT,CRT,OUT,DSH,CNT,MXLNE,DGXTMP,DGTOT,LOOP
+5 if $GET(ZTSK)
SET ZTREQ="@"
+6 DO PRTVAR
+7 USE IO
DO HDR
+8 IF 'DGTOT
WRITE !!,?10,"*** There are no records to print ***"
SET OUT=$$PAUSE
QUIT
+9 SET LOOP="LOOP"_DGSRT
+10 DO @LOOP
if OUT
QUIT
+11 DO TOT
if OUT
QUIT
+12 WRITE !
SET OUT=$$PAUSE
+13 QUIT
LOOPN ; Sort by name. Loop through ^XTMP("DGMSRPT","MSINC","NAM", x-ref
+1 NEW NM,DFN
+2 SET NM=""
+3 FOR
SET NM=$ORDER(@DGXTMP@("NAM",NM))
if NM=""!(CNT>DGEND)!OUT
QUIT
SET DFN=""
FOR
SET DFN=$ORDER(@DGXTMP@("NAM",NM,DFN))
if DFN=""!(CNT>DGEND)!OUT
QUIT
SET CNT=CNT+1
IF CNT'<DGBEG
IF CNT'>DGEND
DO PRINT
+4 QUIT
LOOPS ; Sort by SSN. Loop through ^XTMP("DGMSRPT","MSINC","SSN", x-ref
+1 NEW S2,S4,S9,DFN
+2 SET S2=""
+3 FOR
SET S2=$ORDER(@DGXTMP@("SSN",S2))
if S2=""!(CNT>DGEND)!OUT
QUIT
SET S4=""
FOR
SET S4=$ORDER(@DGXTMP@("SSN",S2,S4))
if S4=""!(CNT>DGEND)!OUT
QUIT
Begin DoDot:1
+4 SET S9=""
+5 FOR
SET S9=$ORDER(@DGXTMP@("SSN",S2,S4,S9))
if S9=""!(CNT>DGEND)!OUT
QUIT
SET DFN=""
FOR
SET DFN=$ORDER(@DGXTMP@("SSN",S2,S4,S9,DFN))
if DFN=""!(CNT>DGEND)!OUT
QUIT
SET CNT=CNT+1
IF CNT'<DGBEG
IF CNT'>DGEND
DO PRINT
End DoDot:1
+6 QUIT
PRINT ; Print detail
+1 NEW VET,CT,CAT,IN
+2 if '$DATA(@DGXTMP@(DFN))
QUIT
+3 SET VET=$GET(@DGXTMP@(DFN,0))
+4 IF LINE>MXLNE
SET OUT=$$PAUSE
if OUT
QUIT
DO HDR
+5 WRITE !,$PIECE(VET,U,2),?12,$EXTRACT($PIECE(VET,U,1),1,25)
+6 SET LINE=LINE+1
SET CAT=0
+7 FOR CT=1:1
SET CAT=$ORDER(@DGXTMP@(DFN,CAT))
if CAT=""!OUT
QUIT
Begin DoDot:1
+8 IF CT>1
Begin DoDot:2
+9 IF LINE>MXLNE
SET OUT=$$PAUSE
if OUT
QUIT
DO HDR
+10 WRITE !
SET LINE=LINE+1
End DoDot:2
+11 WRITE ?37,CAT
+12 SET IN=""
FOR
SET IN=$ORDER(@DGXTMP@(DFN,CAT,IN))
if IN=""!OUT
QUIT
Begin DoDot:2
+13 IF IN>1
Begin DoDot:3
+14 IF LINE>MXLNE
SET OUT=$$PAUSE
if OUT
QUIT
DO HDR
+15 WRITE !
SET LINE=LINE+1
End DoDot:3
if OUT
QUIT
+16 WRITE ?43,@DGXTMP@(DFN,CAT,IN)
End DoDot:2
End DoDot:1
+17 QUIT
TOT ; Print total records at the end of the report
+1 IF LINE+5>MXLNE
SET OUT=$$PAUSE
if OUT
QUIT
DO HDR
+2 WRITE !!," Starting Record #:",$$RJ^XLFSTR(DGBEG,7)
+3 WRITE !," Ending Record #:",$$RJ^XLFSTR(DGEND,7)
+4 WRITE !!,"Total Records Printed:",$$RJ^XLFSTR((DGEND-DGBEG)+1,7)," out of ",DGTOT
+5 QUIT
PRTVAR ; Set up variables needed to print report
+1 SET CRT=$SELECT($EXTRACT(IOST,1,2)="C-":1,1:0)
+2 SET DGXTMP="^XTMP(""DGMSRPT"",""MSINC"")"
+3 SET DGTOT=+$GET(@DGXTMP@("CNT","VET"))
+4 if '$GET(DGBEG)
SET DGBEG=1
if '$GET(DGEND)
SET DGEND=DGTOT
+5 if $GET(DGSRT)=""
SET DGSRT="N"
+6 SET (PG,CNT,OUT)=0
SET RPTDT=$$FMTE^XLFDT(DT)
SET MXLNE=$SELECT(CRT:15,1:52)
+7 SET DSH=""
SET $PIECE(DSH,"=",80)=""
+8 QUIT
HDR ; Print report header
+1 SET PG=PG+1
SET LINE=0
+2 WRITE @IOF
+3 WRITE ?0,"Report Date: ",RPTDT,?68,"Page: ",$$RJ^XLFSTR(PG,4)
+4 WRITE !,"Sorted By: "_$SELECT(DGSRT="N":"Name",1:"SSN (Terminal Digits)")
+5 WRITE !!,$$CJ^XLFSTR("MILITARY SERVICE DATA INCONSISTENCIES DETAIL REPORT",80)
+6 WRITE !!,"SSN",?12,"Veteran's Name",?37,"Cat. Inconsistencies"
+7 WRITE !,DSH
+8 QUIT
PAUSE() ; If report is sent to screen, prompt for next page or quit
+1 NEW DIR,DIRUT,DUOUT,DTOUT,X,Y
+2 IF 'CRT
QUIT 0
+3 SET DIR(0)="E"
+4 DO ^DIR
IF 'Y
QUIT 1
+5 QUIT 0