ABSPOSXE ; IHS/FCS/DRS - Support - error log search ;
;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
Q
ERRLOG ;EP - search error log for $ZE in a POS routine
; ^%ZTER(1,$Hdate,m,n,"ZE")=$ZERROR value
N DERANGE S DERANGE=$$DTRANGE^ABSPOSX Q:'DERANGE
D SEARCH($$HRANGE^ABSPOSX(DERANGE))
Q
RECENT D SEARCH($H-1_U_+$H)
Q
SEARCH(RANGE) ;EP -
W !,"Searching error log for Point of Sale errors...",!
N COUNT S COUNT=0
N H F H=$P(RANGE,U):1:$P(RANGE,U,2) D SEARCH1
I 'COUNT W "None found",!
Q
SEARCH1 ; for one given H
N A,B,C
S A=""
F S A=$O(^%ZTER(1,H,A)) Q:A="" D
. S B=""
. F S B=$O(^%ZTER(1,H,A,B)) Q:B="" D
. . I $$CHECK(H,A,B) D REPORT(H,A,B) S COUNT=COUNT+1
Q
CHECK(H,A,B) ; ^%ZTER(1,H,A,B,... is it for Point of Sale?
N R S R=$$ZEROU(H,A,B) ; routine name in $ZERROR
I R?1"ABSP".E Q 1 ;
S R=$$XQY0(H,A,B) ; option name in variable XQY0
I R?1"ABSP".E Q 1
Q 0
REPORT(H,A,B) ;
W "Error # ",B," on "
N H1 S H1=$P($G(^%ZTER(1,H,A,B,"H")),U) I 'H1 S H1=H
W $$HPRINT(H1)
I A'=1 W " (subscript A=",A,"?)"
W !
W "Code: ",$G(^%ZTER(1,H,A,B,"LINE")),!
W "$ZE=",$$ZE(H,A,B),!
W "XQY0=",$$XQY0(H,A,B),!
Q
HPRINT(%H) ;
N Y,X,% D YX^%DTC
Q Y
ZE(H,A,B) ; return $ZERROR variable from error log entry
Q $G(^%ZTER(1,H,A,B,"ZE"))
ZEROU(H,A,B) ; return routine name from $ZERROR value
N X S X=$$ZE(H,A,B)
I X'[U Q ""
S X=$P(X,U,2)
S X=$P(X,":")
Q X
XQY0(H,A,B) Q $$VAR("XQY0",H,A,B)
VAR(VAR,H,A,B) ; return value of variable or "<UNDEF>" if not found
N V,STOP,VAL S V=""
F S V=$O(^%ZTER(1,H,A,B,"ZV",V)) Q:V="" D Q:$D(VAL)
. I $P($G(^%ZTER(1,H,A,B,"ZV",V,0)),U)=VAR D
. . S VAL=^%ZTER(1,H,A,B,"ZV",V,"D")
Q $S($D(VAL):VAL,1:"<UNDEF>")
ABSPOSXE ; IHS/FCS/DRS - Support - error log search ;
+1 ;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
+2 QUIT
ERRLOG ;EP - search error log for $ZE in a POS routine
+1 ; ^%ZTER(1,$Hdate,m,n,"ZE")=$ZERROR value
+2 NEW DERANGE
SET DERANGE=$$DTRANGE^ABSPOSX
IF 'DERANGE
QUIT
+3 DO SEARCH($$HRANGE^ABSPOSX(DERANGE))
+4 QUIT
RECENT DO SEARCH($HOROLOG-1_U_+$HOROLOG)
+1 QUIT
SEARCH(RANGE) ;EP -
+1 WRITE !,"Searching error log for Point of Sale errors...",!
+2 NEW COUNT
SET COUNT=0
+3 NEW H
FOR H=$PIECE(RANGE,U):1:$PIECE(RANGE,U,2)
DO SEARCH1
+4 IF 'COUNT
WRITE "None found",!
+5 QUIT
SEARCH1 ; for one given H
+1 NEW A,B,C
+2 SET A=""
+3 FOR
SET A=$ORDER(^%ZTER(1,H,A))
IF A=""
QUIT
Begin DoDot:1
+4 SET B=""
+5 FOR
SET B=$ORDER(^%ZTER(1,H,A,B))
IF B=""
QUIT
Begin DoDot:2
+6 IF $$CHECK(H,A,B)
DO REPORT(H,A,B)
SET COUNT=COUNT+1
End DoDot:2
End DoDot:1
+7 QUIT
CHECK(H,A,B) ; ^%ZTER(1,H,A,B,... is it for Point of Sale?
+1 ; routine name in $ZERROR
NEW R
SET R=$$ZEROU(H,A,B)
+2 ;
IF R?1"ABSP".E
QUIT 1
+3 ; option name in variable XQY0
SET R=$$XQY0(H,A,B)
+4 IF R?1"ABSP".E
QUIT 1
+5 QUIT 0
REPORT(H,A,B) ;
+1 WRITE "Error # ",B," on "
+2 NEW H1
SET H1=$PIECE($GET(^%ZTER(1,H,A,B,"H")),U)
IF 'H1
SET H1=H
+3 WRITE $$HPRINT(H1)
+4 IF A'=1
WRITE " (subscript A=",A,"?)"
+5 WRITE !
+6 WRITE "Code: ",$GET(^%ZTER(1,H,A,B,"LINE")),!
+7 WRITE "$ZE=",$$ZE(H,A,B),!
+8 WRITE "XQY0=",$$XQY0(H,A,B),!
+9 QUIT
HPRINT(%H) ;
+1 NEW Y,X,%
DO YX^%DTC
+2 QUIT Y
ZE(H,A,B) ; return $ZERROR variable from error log entry
+1 QUIT $GET(^%ZTER(1,H,A,B,"ZE"))
ZEROU(H,A,B) ; return routine name from $ZERROR value
+1 NEW X
SET X=$$ZE(H,A,B)
+2 IF X'[U
QUIT ""
+3 SET X=$PIECE(X,U,2)
+4 SET X=$PIECE(X,":")
+5 QUIT X
XQY0(H,A,B) QUIT $$VAR("XQY0",H,A,B)
VAR(VAR,H,A,B) ; return value of variable or "<UNDEF>" if not found
+1 NEW V,STOP,VAL
SET V=""
+2 FOR
SET V=$ORDER(^%ZTER(1,H,A,B,"ZV",V))
IF V=""
QUIT
Begin DoDot:1
+3 IF $PIECE($GET(^%ZTER(1,H,A,B,"ZV",V,0)),U)=VAR
Begin DoDot:2
+4 SET VAL=^%ZTER(1,H,A,B,"ZV",V,"D")
End DoDot:2
End DoDot:1
IF $DATA(VAL)
QUIT
+5 QUIT $SELECT($DATA(VAL):VAL,1:"<UNDEF>")