DIVR ;SFISC/GFT-VERIFY FLDS ;8:43 AM 1 Jul 1999 [ 04/02/2003 8:25 AM ]
;;22.0;VA FileMan;**1001**;APR 1, 2003
;;22.0;VA FileMan;**7**;Mar 30, 1999
;THIS ROUTINE CONTAINS AN IHS MODIFICATION BY IHS/ASDST/GTH 04-04-01
;Per VHA Directive 10-93-142, this routine should not be modified.
I $D(DIVFIL)[0 N DIVDAT,DIVFIL,DIVMODE,DIVPG,POP D G:$G(POP) Q^DIV
. S DIVMODE="C"
. D DEVSEL^DIV Q:$G(POP)
. D INIT^DIV
S W="W !,""ENTRY#"_$S(V:"'S",1:"")_""",?10,"""_$P(^DD(A,.01,0),U)_""",?40,""ERROR"""
D LF Q:$D(DIRUT) S T=$E(T) S:"PS"[T&($D(DIVZ)[0) DIVZ=Z
K DIVREQK,DIVTYPE,DIVTMP
S DIVREQK=$D(^DD("KEY","F",A,DA))>9
I $D(^DD("IX","F",A,DA)) D
. S DIVTYPE=T,T="INDEX",DIVROOT=$$FROOTDA^DIKCU(A)
. D LOADVER^DIVC(A,DA,"DIVTMP")
K DG
F %=0:0 S %=$O(^DD(A,DA,1,%)) Q:%'>0 I $D(^(%,1)),$P(^(0),U,2,9)?1.A,^(2)?1"K ^".E1")",^(1)?1"S ^".E S DG(%)="I $D("_$E(^(2),3,99)_"),"_$E(^(1),3,99)
I T'="INDEX",'$D(^(+$O(^DD(A,DA,1,0)),1)) G E
I T'="INDEX",'$D(DG) W $C(7)_"(CANNOT CHECK"
E W "(CHECKING"
W " CROSS-REFERENCE)" D LF I $D(DIRUT) Q:$D(DQI) G Q
I $D(DG) D
. I T="INDEX" S E=DIVTYPE,DIVTYPE="IX"
. E S E=T,T="IX"
E S Y=$F(DDC,"%DT=""E") S:Y DDC=$E(DDC,1,Y-2)_$E(DDC,Y,999)
I DR["*" S DDC="Q" I $D(^DD(A,DA,12.1)) X ^(12.1) I $D(DIC("S")) S DDC(1)=DIC("S"),DDC="X DDC(1) E K X"
D 0 S X=$P(Y(0),U,4),Y=$P(X,S,2),X=$P(X,S)
I +X'=X S X=Q_X_Q I Y="" S DE=DE_"S X=DA D R" G XEC
S M="S X=$S($D(^(DA,"_X_")):$"_$S(Y:"P(^("_X_"),U,"_Y,1:"E(^("_X_"),"_$E(Y,2,9))_"),1:"""") D R"
I $L(M)+$L(DE)>250 S DE=DE_"X DE(1)",DE(1)=M
E S DE=DE_M
XEC K DIC,M,Y X DE Q:$D(DQI)
W:'$D(M) $C(7),!,"NO PROBLEMS"
Q S M=$O(^UTILITY("DIVR",$J,0)),E=$O(^(M)),DK=J(0)
I $D(ZTQUEUED) S ZTREQ="@"
;----- BEGIN IHS MODIFICATION
;THE LINE BELOW IS COMMENTED OUT AND REPLACED BY A NEW LINE TO
;PREVENT A <LINER> ERROR IN MSM AS LINE TAG 0 DOES NOT EXIST
;ORIGINAL MODIFICATION BY IHS/ASDST/GTH 04-04-01
;E I $T(+0^%ZISC)]"" D
E I $T(^%ZISC)]"" D
. ;----- END IHS MODIFICATION
. D ^%ZISC
E X $G(^%ZIS("C"))
G:'E!$D(DIRUT)!$D(ZTQUEUED) QX K DIBT,DISV D
. N C,D,I,J,L,O,Q,S,D0,DDA,DICL,DIFLD,DIU0
. D S2^DIBT1 Q
S DDC=0 I '$D(DIRUT) G Q:Y<0 F E=0:0 S E=$O(^UTILITY("DIVR",$J,E)) Q:E="" S DDC=DDC+1,^DIBT(+Y,1,E)=""
S:DDC>0 ^DIBT(+Y,"QR")=DT_U_DDC
QX K DIVINDEX,DIVKEY,DIVREQK,DIVROOT,DIVTMP,DIVTYPE
K ^UTILITY("DIVR",$J),DIRUT,DIROUT,DTOUT,DUOUT,DQI,DK,DA,DG,DQ,DE,T,P,E,M,DR,W,DDC,DIVZ Q
;
R Q:$D(DIRUT)
I X?." " Q:DR'["R"&'DIVREQK D G X
. I X="" S M="Missing"_$S(DIVREQK:" key value",1:"")
. E S M="Equals only 1 or more spaces"
G @T
;
P I @("$D(^"_DIVZ_"X,0))") S Y=X G F
S M="No '"_X_"' in pointed-to File" G X
;
S S Y=X X DDC I '$D(X) S M=Q_Y_Q_" fails screen" G X
Q:S_DIVZ[(S_X_":") S M=Q_X_Q_" not in Set" G X
;
D S Y=X,X=$E(Y,1,3)+1700,%=$E(Y,6,7) S:% X=%_"-"_X S:$E(Y,4,5) X=+$E(Y,4,5)_"-"_X
S:Y["." X=X_"@"_$E(Y_"00",9,10)_":"_$E(Y_"0000",11,12)_$S($E(Y,13,14):":"_$E(Y_"0",13,14),1:"")
N ;
K ;
F S DQ=X I X'?.ANP S M="Non-printing character" G X
X DDC Q:$D(X) S M=Q_DQ_Q_" fails Input Transform"
X I $O(^UTILITY("DIVR",$J,0))="" X W
S X=$S(V:DA(V),1:DA),^UTILITY("DIVR",$J,X)=""
S X=V I @(I(0)_"0)")
DA I 'X D Q
. D LF Q:$D(DIRUT)
. W DA,?10,$S($D(^(DA,0)):$P(^(0),U),1:DA),?40,$E(M,1,40)
. D:V LF
D LF Q:$D(DIRUT) W DA(X),?10,$P(^(DA(X),0),U) S X=X-1,@("Y=$D(^("_I(V-X)_",0))") G DA
;
0 ;
S Y=I(0),DE="",X=V
L S DA="DA" S:X DA=DA_"("_X_")" S Y=Y_DA,DE=DE_"F "_DA_"=0:0 ",%="S "_DA_"=$O("_Y_"))" I V>2 S DE(X+X)=%,DE=DE_"X DE("_(X+X)_")"
E S DE=DE_%
S DE=DE_" Q:"_DA_"'>0 S D"_(V-X)_"="_DA_" "
;I X=1,DIFLD=.01 S DE=DE_"X P:$D(^(DA(1),"_I(V)_",0)) ",P="S $P(^(0),U,2)="""_$P(^DD(J(V-1),P,0),U,2)_Q
S X=X-1 Q:X<0 S Y=Y_","_I(V-X)_"," G L
;
IX F %=0:0 S %=$O(DG(%)) Q:+%'>0 X DG(%) I '$T S M=Q_X_Q_" not properly Cross-referenced" G X
G @E
;
V I $P(X,S,2)'?1A.AN1"(".ANP,$P(X,S,2)'?1"%".AN1"(".ANP S M=Q_X_Q_" has the wrong format" G X
S M=$S($D(@(U_$P(X,S,2)_"0)")):^(0),1:"")
I '$D(^DD(A,DIFLD,"V","B",+$P(M,U,2))) S M=$P(M,U)_" FILE not in the DD" G X
I '$D(@(U_$P(X,S,2)_+X_",0)")) S M=U_$P(X,S,2)_+X_",0) does not exist" G X
G F
;
INDEX ;Check new indexes
;
;Set DIVINDEX(indexName,index#) = "" for indexes aren't set
;Set DIVKEY(file#,keyName,uiNumber) = "null" : if key field is null
; "uniq" : if key is not unique
K DIVKEY,DIINDEX
D VER^DIVC(A,DIVROOT,.DA,"DIVTMP",.DIVINDEX,.DIVKEY)
;
;If some indexes aren't set properly, print index info
I $D(DIVINDEX) D K DIVINDEX Q:$D(DIRUT)
. N DIVNAME,DIVNUM
. S DIVNAME="" F S DIVNAME=$O(DIVINDEX(DIVNAME)) Q:DIVNAME="" D Q:$D(DIRUT)
.. S DIVNUM=0 F S DIVNUM=$O(DIVINDEX(DIVNAME,DIVNUM)) Q:'DIVNUM D Q:$D(DIRUT)
... S M=Q_X_Q_": "_DIVNAME_" index (#"_DIVNUM_") not properly set"
... D IER
;
;If keys integrity is violated, print key info
I $D(DIVKEY) D K DIVKEY Q:$D(DIRUT)
. N DIVFILE,DIVKNM,DIVPROB,DIVXRNM
. S DIVFILE="" F S DIVFILE=$O(DIVKEY(DIVFILE)) Q:DIVFILE="" D Q:$D(DIRUT)
.. S DIVKNM="" F S DIVKNM=$O(DIVKEY(DIVFILE,DIVKNM)) Q:DIVKNM="" D Q:$D(DIRUT)
... S DIVXRNM="" F S DIVXRNM=$O(DIVKEY(DIVFILE,DIVKNM,DIVXRNM)) Q:DIVXRNM="" D Q:$D(DIRUT)
.... S DIVPROB=DIVKEY(DIVFILE,DIVKNM,DIVXRNM)
.... S M=Q_X_Q_": "_$S(DIVPROB="null":"Key values are missing.",1:"Key is not unique.")
.... S M=M_" (File #"_DIVFILE_", Key "_DIVKNM_", Index "_DIVXRNM_")"
.... D IER
;
;Continue with checking traditional xrefs (if any) and data type
G @DIVTYPE
;
IER ;Print info about invalid indexes. (Modeled after DA subroutine above)
N DIVTXT,DIVI,X
;
;Wrap message M to within 40 columns
S DIVTXT(0)=M D WRAP^DIKCU2(.DIVTXT,40)
;
;If nothing was written yet, write column headers
I $O(^UTILITY("DIVR",$J,0))="" X W
;
;Set ^UTILITY("DIVR",$J,topIen)="", X = level#, naked = top level root
S X=$S(V:DA(V),1:DA),^UTILITY("DIVR",$J,X)=""
S X=V I @(I(0)_"0)")
;
IER1 ;If top level, write record info and message
I 'X D Q
. D LF Q:$D(DIRUT) W DA,?10,$S($D(^(DA,0)):$P(^(0),U),1:DA)
. F DIVI=0:1 Q:$D(DIVTXT(DIVI))[0 D Q:$D(DIRUT)
.. I DIVI D LF Q:$D(DIRUT)
.. W ?40,DIVTXT(DIVI)
. D:V LF
;
;Else write subrecord info, decrement level, set naked = ^naked(node,0)
D LF Q:$D(DIRUT)
W DA(X),?10,$P(^(DA(X),0),U) S X=X-1,@("Y=$D(^("_I(V-X)_",0))")
G IER1
;
LF ;Issue a line feed or EOP read
I $Y+3<IOSL W ! Q
;
N DINAKED S DINAKED=$$LGR^%ZOSV
I IOST?1"C-".E D
. N DIR,X,Y
. S DIR(0)="E" W ! D ^DIR
;
I '$D(DIRUT) D
. I $D(ZTQUEUED),$$S^%ZTLOAD S (ZTSTOP,DIRUT)=1
. E W @IOF D HDR
S:DINAKED]"" DINAKED=$S(DINAKED["""""":$O(@DINAKED),1:$D(@DINAKED))
Q
;
HDR ;Print header
N DIVTAB
S DIVPG=$G(DIVPG)+1
W "VERIFY FIELDS REPORT"
;
S DIVTAB=IOM-1-$L(DIVFIL)-$L(DIVDAT)-$L(DIVPG)
I DIVTAB>1 W !,DIVFIL_$J("",DIVTAB)_DIVDAT_DIVPG
E W !,DIVFIL,!,$J("",IOM-1-$L(DIVDAT)-$L(DIVPG))_DIVDAT_DIVPG
W !,$TR($J("",IOM-1)," ","-"),!
Q
DIVR ;SFISC/GFT-VERIFY FLDS ;8:43 AM 1 Jul 1999 [ 04/02/2003 8:25 AM ]
+1 ;;22.0;VA FileMan;**1001**;APR 1, 2003
+2 ;;22.0;VA FileMan;**7**;Mar 30, 1999
+3 ;THIS ROUTINE CONTAINS AN IHS MODIFICATION BY IHS/ASDST/GTH 04-04-01
+4 ;Per VHA Directive 10-93-142, this routine should not be modified.
+5 IF $DATA(DIVFIL)[0
NEW DIVDAT,DIVFIL,DIVMODE,DIVPG,POP
Begin DoDot:1
+6 SET DIVMODE="C"
+7 DO DEVSEL^DIV
IF $GET(POP)
QUIT
+8 DO INIT^DIV
End DoDot:1
IF $GET(POP)
GOTO Q^DIV
+9 SET W="W !,""ENTRY#"_$SELECT(V:"'S",1:"")_""",?10,"""_$PIECE(^DD(A,.01,0),U)_""",?40,""ERROR"""
+10 DO LF
IF $DATA(DIRUT)
QUIT
SET T=$EXTRACT(T)
IF "PS"[T&($DATA(DIVZ)[0)
SET DIVZ=Z
+11 KILL DIVREQK,DIVTYPE,DIVTMP
+12 SET DIVREQK=$DATA(^DD("KEY","F",A,DA))>9
+13 IF $DATA(^DD("IX","F",A,DA))
Begin DoDot:1
+14 SET DIVTYPE=T
SET T="INDEX"
SET DIVROOT=$$FROOTDA^DIKCU(A)
+15 DO LOADVER^DIVC(A,DA,"DIVTMP")
End DoDot:1
+16 KILL DG
+17 FOR %=0:0
SET %=$ORDER(^DD(A,DA,1,%))
IF %'>0
QUIT
IF $DATA(^(%,1))
IF $PIECE(^(0),U,2,9)?1.A
IF ^(2)?1"K ^".E1")"
IF ^(1)?1"S ^".E
SET DG(%)="I $D("_$EXTRACT(^(2),3,99)_"),"_$EXTRACT(^(1),3,99)
+18 IF T'="INDEX"
IF '$DATA(^(+$ORDER(^DD(A,DA,1,0)),1))
GOTO E
+19 IF T'="INDEX"
IF '$DATA(DG)
WRITE $CHAR(7)_"(CANNOT CHECK"
+20 IF '$TEST
WRITE "(CHECKING"
+21 WRITE " CROSS-REFERENCE)"
DO LF
IF $DATA(DIRUT)
IF $DATA(DQI)
QUIT
GOTO Q
+22 IF $DATA(DG)
Begin DoDot:1
+23 IF T="INDEX"
SET E=DIVTYPE
SET DIVTYPE="IX"
+24 IF '$TEST
SET E=T
SET T="IX"
End DoDot:1
E SET Y=$FIND(DDC,"%DT=""E")
IF Y
SET DDC=$EXTRACT(DDC,1,Y-2)_$EXTRACT(DDC,Y,999)
+1 IF DR["*"
SET DDC="Q"
IF $DATA(^DD(A,DA,12.1))
XECUTE ^(12.1)
IF $DATA(DIC("S"))
SET DDC(1)=DIC("S")
SET DDC="X DDC(1) E K X"
+2 DO 0
SET X=$PIECE(Y(0),U,4)
SET Y=$PIECE(X,S,2)
SET X=$PIECE(X,S)
+3 IF +X'=X
SET X=Q_X_Q
IF Y=""
SET DE=DE_"S X=DA D R"
GOTO XEC
+4 SET M="S X=$S($D(^(DA,"_X_")):$"_$SELECT(Y:"P(^("_X_"),U,"_Y,1:"E(^("_X_"),"_$EXTRACT(Y,2,9))_"),1:"""") D R"
+5 IF $LENGTH(M)+$LENGTH(DE)>250
SET DE=DE_"X DE(1)"
SET DE(1)=M
+6 IF '$TEST
SET DE=DE_M
XEC KILL DIC,M,Y
XECUTE DE
IF $DATA(DQI)
QUIT
+1 IF '$DATA(M)
WRITE $CHAR(7),!,"NO PROBLEMS"
Q SET M=$ORDER(^UTILITY("DIVR",$JOB,0))
SET E=$ORDER(^(M))
SET DK=J(0)
+1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 ;----- BEGIN IHS MODIFICATION
+3 ;THE LINE BELOW IS COMMENTED OUT AND REPLACED BY A NEW LINE TO
+4 ;PREVENT A <LINER> ERROR IN MSM AS LINE TAG 0 DOES NOT EXIST
+5 ;ORIGINAL MODIFICATION BY IHS/ASDST/GTH 04-04-01
+6 ;E I $T(+0^%ZISC)]"" D
+7 IF '$TEST
IF $TEXT(^%ZISC)]""
Begin DoDot:1
+8 ;----- END IHS MODIFICATION
+9 DO ^%ZISC
End DoDot:1
+10 IF '$TEST
XECUTE $GET(^%ZIS("C"))
+11 IF 'E!$DATA(DIRUT)!$DATA(ZTQUEUED)
GOTO QX
KILL DIBT,DISV
Begin DoDot:1
+12 NEW C,D,I,J,L,O,Q,S,D0,DDA,DICL,DIFLD,DIU0
+13 DO S2^DIBT1
QUIT
End DoDot:1
+14 SET DDC=0
IF '$DATA(DIRUT)
IF Y<0
GOTO Q
FOR E=0:0
SET E=$ORDER(^UTILITY("DIVR",$JOB,E))
IF E=""
QUIT
SET DDC=DDC+1
SET ^DIBT(+Y,1,E)=""
+15 IF DDC>0
SET ^DIBT(+Y,"QR")=DT_U_DDC
QX KILL DIVINDEX,DIVKEY,DIVREQK,DIVROOT,DIVTMP,DIVTYPE
+1 KILL ^UTILITY("DIVR",$JOB),DIRUT,DIROUT,DTOUT,DUOUT,DQI,DK,DA,DG,DQ,DE,T,P,E,M,DR,W,DDC,DIVZ
QUIT
+2 ;
R IF $DATA(DIRUT)
QUIT
+1 IF X?." "
IF DR'["R"&'DIVREQK
QUIT
Begin DoDot:1
+2 IF X=""
SET M="Missing"_$SELECT(DIVREQK:" key value",1:"")
+3 IF '$TEST
SET M="Equals only 1 or more spaces"
End DoDot:1
GOTO X
+4 GOTO @T
+5 ;
P IF @("$D(^"_DIVZ_"X,0))")
SET Y=X
GOTO F
+1 SET M="No '"_X_"' in pointed-to File"
GOTO X
+2 ;
S SET Y=X
XECUTE DDC
IF '$DATA(X)
SET M=Q_Y_Q_" fails screen"
GOTO X
+1 IF S_DIVZ[(S_X_"
QUIT
SET M=Q_X_Q_" not in Set"
GOTO X
+2 ;
D SET Y=X
SET X=$EXTRACT(Y,1,3)+1700
SET %=$EXTRACT(Y,6,7)
IF %
SET X=%_"-"_X
IF $EXTRACT(Y,4,5)
SET X=+$EXTRACT(Y,4,5)_"-"_X
+1 IF Y["."
SET X=X_"@"_$EXTRACT(Y_"00",9,10)_":"_$EXTRACT(Y_"0000",11,12)_$SELECT($EXTRACT(Y,13,14):":"_$EXTRACT(Y_"0",13,14),1:"")
N ;
K ;
F SET DQ=X
IF X'?.ANP
SET M="Non-printing character"
GOTO X
+1 XECUTE DDC
IF $DATA(X)
QUIT
SET M=Q_DQ_Q_" fails Input Transform"
X IF $ORDER(^UTILITY("DIVR",$JOB,0))=""
XECUTE W
+1 SET X=$SELECT(V:DA(V),1:DA)
SET ^UTILITY("DIVR",$JOB,X)=""
+2 SET X=V
IF @(I(0)_"0)")
DA IF 'X
Begin DoDot:1
+1 DO LF
IF $DATA(DIRUT)
QUIT
+2 WRITE DA,?10,$SELECT($DATA(^(DA,0)):$PIECE(^(0),U),1:DA),?40,$EXTRACT(M,1,40)
+3 IF V
DO LF
End DoDot:1
QUIT
+4 DO LF
IF $DATA(DIRUT)
QUIT
WRITE DA(X),?10,$PIECE(^(DA(X),0),U)
SET X=X-1
SET @("Y=$D(^("_I(V-X)_",0))")
GOTO DA
+5 ;
0 ;
+1 SET Y=I(0)
SET DE=""
SET X=V
L SET DA="DA"
IF X
SET DA=DA_"("_X_")"
SET Y=Y_DA
SET DE=DE_"F "_DA_"=0:0 "
SET %="S "_DA_"=$O("_Y_"))"
IF V>2
SET DE(X+X)=%
SET DE=DE_"X DE("_(X+X)_")"
+1 IF '$TEST
SET DE=DE_%
+2 SET DE=DE_" Q:"_DA_"'>0 S D"_(V-X)_"="_DA_" "
+3 ;I X=1,DIFLD=.01 S DE=DE_"X P:$D(^(DA(1),"_I(V)_",0)) ",P="S $P(^(0),U,2)="""_$P(^DD(J(V-1),P,0),U,2)_Q
+4 SET X=X-1
IF X<0
QUIT
SET Y=Y_","_I(V-X)_","
GOTO L
+5 ;
IX FOR %=0:0
SET %=$ORDER(DG(%))
IF +%'>0
QUIT
XECUTE DG(%)
IF '$TEST
SET M=Q_X_Q_" not properly Cross-referenced"
GOTO X
+1 GOTO @E
+2 ;
V IF $PIECE(X,S,2)'?1A.AN1"(".ANP
IF $PIECE(X,S,2)'?1"%".AN1"(".ANP
SET M=Q_X_Q_" has the wrong format"
GOTO X
+1 SET M=$SELECT($DATA(@(U_$PIECE(X,S,2)_"0)")):^(0),1:"")
+2 IF '$DATA(^DD(A,DIFLD,"V","B",+$PIECE(M,U,2)))
SET M=$PIECE(M,U)_" FILE not in the DD"
GOTO X
+3 IF '$DATA(@(U_$PIECE(X,S,2)_+X_",0)"))
SET M=U_$PIECE(X,S,2)_+X_",0) does not exist"
GOTO X
+4 GOTO F
+5 ;
INDEX ;Check new indexes
+1 ;
+2 ;Set DIVINDEX(indexName,index#) = "" for indexes aren't set
+3 ;Set DIVKEY(file#,keyName,uiNumber) = "null" : if key field is null
+4 ; "uniq" : if key is not unique
+5 KILL DIVKEY,DIINDEX
+6 DO VER^DIVC(A,DIVROOT,.DA,"DIVTMP",.DIVINDEX,.DIVKEY)
+7 ;
+8 ;If some indexes aren't set properly, print index info
+9 IF $DATA(DIVINDEX)
Begin DoDot:1
+10 NEW DIVNAME,DIVNUM
+11 SET DIVNAME=""
FOR
SET DIVNAME=$ORDER(DIVINDEX(DIVNAME))
IF DIVNAME=""
QUIT
Begin DoDot:2
+12 SET DIVNUM=0
FOR
SET DIVNUM=$ORDER(DIVINDEX(DIVNAME,DIVNUM))
IF 'DIVNUM
QUIT
Begin DoDot:3
+13 SET M=Q_X_Q_": "_DIVNAME_" index (#"_DIVNUM_") not properly set"
+14 DO IER
End DoDot:3
IF $DATA(DIRUT)
QUIT
End DoDot:2
IF $DATA(DIRUT)
QUIT
End DoDot:1
KILL DIVINDEX
IF $DATA(DIRUT)
QUIT
+15 ;
+16 ;If keys integrity is violated, print key info
+17 IF $DATA(DIVKEY)
Begin DoDot:1
+18 NEW DIVFILE,DIVKNM,DIVPROB,DIVXRNM
+19 SET DIVFILE=""
FOR
SET DIVFILE=$ORDER(DIVKEY(DIVFILE))
IF DIVFILE=""
QUIT
Begin DoDot:2
+20 SET DIVKNM=""
FOR
SET DIVKNM=$ORDER(DIVKEY(DIVFILE,DIVKNM))
IF DIVKNM=""
QUIT
Begin DoDot:3
+21 SET DIVXRNM=""
FOR
SET DIVXRNM=$ORDER(DIVKEY(DIVFILE,DIVKNM,DIVXRNM))
IF DIVXRNM=""
QUIT
Begin DoDot:4
+22 SET DIVPROB=DIVKEY(DIVFILE,DIVKNM,DIVXRNM)
+23 SET M=Q_X_Q_": "_$SELECT(DIVPROB="null":"Key values are missing.",1:"Key is not unique.")
+24 SET M=M_" (File #"_DIVFILE_", Key "_DIVKNM_", Index "_DIVXRNM_")"
+25 DO IER
End DoDot:4
IF $DATA(DIRUT)
QUIT
End DoDot:3
IF $DATA(DIRUT)
QUIT
End DoDot:2
IF $DATA(DIRUT)
QUIT
End DoDot:1
KILL DIVKEY
IF $DATA(DIRUT)
QUIT
+26 ;
+27 ;Continue with checking traditional xrefs (if any) and data type
+28 GOTO @DIVTYPE
+29 ;
IER ;Print info about invalid indexes. (Modeled after DA subroutine above)
+1 NEW DIVTXT,DIVI,X
+2 ;
+3 ;Wrap message M to within 40 columns
+4 SET DIVTXT(0)=M
DO WRAP^DIKCU2(.DIVTXT,40)
+5 ;
+6 ;If nothing was written yet, write column headers
+7 IF $ORDER(^UTILITY("DIVR",$JOB,0))=""
XECUTE W
+8 ;
+9 ;Set ^UTILITY("DIVR",$J,topIen)="", X = level#, naked = top level root
+10 SET X=$SELECT(V:DA(V),1:DA)
SET ^UTILITY("DIVR",$JOB,X)=""
+11 SET X=V
IF @(I(0)_"0)")
+12 ;
IER1 ;If top level, write record info and message
+1 IF 'X
Begin DoDot:1
+2 DO LF
IF $DATA(DIRUT)
QUIT
WRITE DA,?10,$SELECT($DATA(^(DA,0)):$PIECE(^(0),U),1:DA)
+3 FOR DIVI=0:1
IF $DATA(DIVTXT(DIVI))[0
QUIT
Begin DoDot:2
+4 IF DIVI
DO LF
IF $DATA(DIRUT)
QUIT
+5 WRITE ?40,DIVTXT(DIVI)
End DoDot:2
IF $DATA(DIRUT)
QUIT
+6 IF V
DO LF
End DoDot:1
QUIT
+7 ;
+8 ;Else write subrecord info, decrement level, set naked = ^naked(node,0)
+9 DO LF
IF $DATA(DIRUT)
QUIT
+10 WRITE DA(X),?10,$PIECE(^(DA(X),0),U)
SET X=X-1
SET @("Y=$D(^("_I(V-X)_",0))")
+11 GOTO IER1
+12 ;
LF ;Issue a line feed or EOP read
+1 IF $Y+3<IOSL
WRITE !
QUIT
+2 ;
+3 NEW DINAKED
SET DINAKED=$$LGR^%ZOSV
+4 IF IOST?1"C-".E
Begin DoDot:1
+5 NEW DIR,X,Y
+6 SET DIR(0)="E"
WRITE !
DO ^DIR
End DoDot:1
+7 ;
+8 IF '$DATA(DIRUT)
Begin DoDot:1
+9 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET (ZTSTOP,DIRUT)=1
+10 IF '$TEST
WRITE @IOF
DO HDR
End DoDot:1
+11 IF DINAKED]""
SET DINAKED=$SELECT(DINAKED["""""":$ORDER(@DINAKED),1:$DATA(@DINAKED))
+12 QUIT
+13 ;
HDR ;Print header
+1 NEW DIVTAB
+2 SET DIVPG=$GET(DIVPG)+1
+3 WRITE "VERIFY FIELDS REPORT"
+4 ;
+5 SET DIVTAB=IOM-1-$LENGTH(DIVFIL)-$LENGTH(DIVDAT)-$LENGTH(DIVPG)
+6 IF DIVTAB>1
WRITE !,DIVFIL_$JUSTIFY("",DIVTAB)_DIVDAT_DIVPG
+7 IF '$TEST
WRITE !,DIVFIL,!,$JUSTIFY("",IOM-1-$LENGTH(DIVDAT)-$LENGTH(DIVPG))_DIVDAT_DIVPG
+8 WRITE !,$TRANSLATE($JUSTIFY("",IOM-1)," ","-"),!
+9 QUIT