AZHLRERP ; DSM/GTH - PROCESS ERRORS FROM UNIX FILES FOR RER ; [ 02/19/93 9:28 AM ]
;;1.9X;DSM REMOTE ERROR REPORTING;;FEB 19, 1993
;
Q
;
OPT ; Set option in OPTION file.
;;Option 'AZHL REMOTE ERROR UNIX FILE PROCESSING' will be placed
;;in the OPTION file for daily processing, beginning tomorrow morning
;;at 0630 AM. You can change the frequency/time of scheduling by
;;using the TaskMan option thru the Kernel.
I $P(^%ZOSF("OS"),"^")'="MSM-UNIX" W !!,"SORRY. MSM-UNIX only.",! Q
I $S('$D(DUZ(0)):1,DUZ(0)'="@":1,1:0) W !,"PROGRAMMER ACCESS REQUIRED",! Q
NEW A,DA,DIC,DIE,DR
D HOME^%ZIS,DT^DICRW
W ! F %=1:1:4 S A=$P($T(OPT+%),";;",2) W $J("",IOM-$L(A)\2)_A,!!
S DIR(0)="Y",DIR("A")="Process <DSCON> and <INRPT> errors",DIR("B")="Y",DIR("?")="Do you want to process (save) the <DSCON> and <INRPT> errors?",DIR("??")="^D Q2^AZHLRERP"
D DIR Q:$D(DIRUT)
S DIC="^DIC(19,",X=$P($T(OPT+1),"'",2),DIC("DR")="1///RER UNIX File Processing;4///R;20///"_$S(Y:"@",1:"S:0 %=""DSCON^INRPT""")_";25///IN^AZHLRERP;200///T+1@0630;202///1D"
I $D(^DIC(19,"B",$E(X,1,30))) S DIE=DIC,DA=$O(^DIC(19,"B",$E(X,1,30),0)),DR=DIC("DR") D DIE I 1
E D FILE
W !!,"Done.",!
Q
;
IN ;EP - From TaskMan. Read in errors from remote site and place in FM file.
;
NEW A,D,E,F,H,I,J,L,N,P,R,V,XMB,XMTEXT
; List files in uucppublic, open HFS, list files to ^TMP.
S X=$$JOBWAIT^%HOSTCMD("ls -l /usr/spool/uucppublic/*z* > azhlrer.wrk")
F A=0:0 S A=$O(^%ZIS(1,A)) Q:'A I ^(A,"TYPE")="HFS" S IOP=$P(^%ZIS(1,A,0),U),%ZIS("IOPAR")="(""azhlrer.wrk"":""R"")" D ZIS Q:'POP
Q:POP!('A)
S D="/usr/spool/uucppublic/" K ^TMP($J)
U IO F R % Q:%="" S %=$P(%,"/",5) I (%?2.4U4N1"z"3N.1".z")!(%?1"%"4N1"z"3N.1".z") S:$E(%,$L(%)-1,$L(%))=".z" X=$$JOBWAIT^%HOSTCMD("unpack "_D_%),%=$E(%,1,$L(%)-2) I (%?2.4U4N1"z"3N)!(%?1"%"4N1"z"3N) S ^TMP($J,"RER",%)=""
S F="",X="ERR^AZHLRERP",@^%ZOSF("TRAP"),%=$O(^DIC(19,"B","AZHL REMOTE ERROR UNIX FILE PR",0)),A=$P($G(^DIC(19,%,20)),"""",2)
MAIN ;
F S F=$O(^TMP($J,"RER",F)) Q:F="" D
. U IO:(D_F) R L Q:'((L["<<< BEGIN '")&(L[", REMOTE ERROR REPORTING FOR '"))
. S P=$P(L,"'",2),I=$P(L,"'",4),R=$P($P($P(L,","),"v",2)," ",2)
. I '$D(^AZHLRER(I)) S (DINUM,X)=I,DIC="^AZHLRER(" D FILE
. R L D VARS
. F Q:(L="")!($E(L,1,12)=" >>> END") D
.. S ^(I)=+$G(^TMP($J,"COUNT",P,H,I))+1
.. I '$D(^AZHLRER(I,1,H)) S DIC="^AZHLRER("_I_",1,",(DINUM,X)=H,DA(1)=I S:'$D(^AZHLRER(I,1,0)) ^(0)="^8008907.01^" D FILE
.. S DIC="^AZHLRER("_I_",1,"_H_",1,",(DINUM,X)=E,DA(2)=I,DA(1)=H S:'$D(^AZHLRER(I,1,H,1,0)) ^(0)="^8008907.11^" D FILE
.. S E(1)=E,H(1)=H
.. S:'$D(^AZHLRER(I,1,H,1,E,1,0)) ^(0)="^8008907.111^"
.. F Q:E'=E(1)!(H'=H(1)) D
... I V=0 D
.... S $P(^AZHLRER(I,1,H,1,E,0),U,2)=P,$P(^(0),U,3)=R,$P(^(0),U,4)=$TR(V(2),"^","~"),$P(^(0),U,5)=$P($P(V(2),">"),"<",2),$P(^(0),U,6)=$P($P(V(2),":"),U,2)
.... S ^AZHLRER("C",P,I,H,E)="",^AZHLRER("D",$P($P(V(2),">"),"<",2),I,H,E)="",^AZHLRER("E",$P($P(V(2),":"),U,2),I,H,E)=""
.... Q
... E S DIC="^AZHLRER("_I_",1,"_H_",1,"_E_",1,",DINUM=V,X=V(1),DA(3)=I,DA(2)=H,DA(1)=E D FILE S ^AZHLRER(I,1,H,1,E,1,V,1)=V(2)
... R L D VARS
... Q
.. Q
. S X=$$JOBWAIT^%HOSTCMD("rm "_D_F)
. Q
S X=^%ZOSF("ERRTN"),@^%ZOSF("TRAP") D ZISC S X=$$JOBWAIT^%HOSTCMD("rm azhlrer.wrk")
BULLETIN ; ^TMP($J,"COUNT",namespace,$H-date,facility)=count
S (F,H,N)="",%=0 F S N=$O(^TMP($J,"COUNT",N)) Q:N="" F S H=$O(^TMP($J,"COUNT",N,H)) Q:H="" F S F=$O(^TMP($J,"COUNT",N,H,F)) Q:F="" S %=%+1,XMTEXT(%)=" "_N_", day "_H_", "_^(F)_" error"_$S(^(F)>1:"s",1:"")_" from "_F
I $L($O(^TMP($J,"COUNT",""))) S XMB="AZHL RER",XMTEXT="XMTEXT(" D XMB
K ^TMP($J)
PURGE S (DA(1),DA)=0 F S DA(1)=$O(^AZHLRER("B",DA(1))) Q:'DA(1) F S DA=$O(^AZHLRER(DA(1),1,"B",DA)) Q:'DA I (+$H-DA)>730 S DIK="^AZHLRER("_DA(1)_",1," D DIK
Q Q
;
FILE NEW A,D,E,F,H,I,J,L,N,P,R,V K DD,DO S DIC(0)="L" D FILE^DICN K DIC Q
DIE NEW A,D,E,F,H,I,J,L,N,P,R,V D ^DIE K DA,DR,DIE Q
DIK NEW A,D,E,F,H,I,J,L,N,P,R,V D ^DIK Q
DIR NEW A,D,E,F,H,I,J,L,N,P,R,V D ^DIR Q
VARS S H=$P(L,",",2),E=$P(L,",",3),V=$P($P(L,",",4),")"),V(1)=$P(L,"=",2),V(2)=$P(L,"=",3,99)
I +V=0,A]"",A[$P($P(V(2),">"),"<",2) F R L Q:L="" I '($P(L,",",2)=H)!'($P(L,",",3)=E) G VARS
Q
XMB NEW A,D,E,F,H,I,J,L,N,P,R,V D ^XMB Q
ZIS NEW A,D,E,F,H,I,J,L,N,P,R,V D ^%ZIS Q
ZISC NEW A,D,E,F,H,I,J,L,N,P,R,V D ^%ZISC Q
ERR ;EP - Possible entry if error ($ZT), probably due to incomplete file.
S X=$$JOBWAIT^%HOSTCMD("rm "_D_F)
G MAIN
Q2 ;EP - From DIR
W ! F %=2:1:7 W $P($T(Q2+%),";;",2),!
;;If you answer 'Y', the <DSCON> and <INRPT> errors will be processed.
;;If you answer 'N', the <DSCON> and <INRPT> errors will be ignored.
;; -- Note --
;;The errors in the quoted string of the ENTRY ACTION field of option
;;AZHL REMOTE ERROR UNIX FILE PROCESSING, will not be processed.
;;Edit that field if you want to add or delete errors to be IGNORED.
Q
AZHLRERP ; DSM/GTH - PROCESS ERRORS FROM UNIX FILES FOR RER ; [ 02/19/93 9:28 AM ]
+1 ;;1.9X;DSM REMOTE ERROR REPORTING;;FEB 19, 1993
+2 ;
+3 QUIT
+4 ;
OPT ; Set option in OPTION file.
+1 ;;Option 'AZHL REMOTE ERROR UNIX FILE PROCESSING' will be placed
+2 ;;in the OPTION file for daily processing, beginning tomorrow morning
+3 ;;at 0630 AM. You can change the frequency/time of scheduling by
+4 ;;using the TaskMan option thru the Kernel.
+5 IF $PIECE(^%ZOSF("OS"),"^")'="MSM-UNIX"
WRITE !!,"SORRY. MSM-UNIX only.",!
QUIT
+6 IF $SELECT('$DATA(DUZ(0)):1,DUZ(0)'="@":1,1:0)
WRITE !,"PROGRAMMER ACCESS REQUIRED",!
QUIT
+7 NEW A,DA,DIC,DIE,DR
+8 DO HOME^%ZIS
DO DT^DICRW
+9 WRITE !
FOR %=1:1:4
SET A=$PIECE($TEXT(OPT+%),";;",2)
WRITE $JUSTIFY("",IOM-$LENGTH(A)\2)_A,!!
+10 SET DIR(0)="Y"
SET DIR("A")="Process <DSCON> and <INRPT> errors"
SET DIR("B")="Y"
SET DIR("?")="Do you want to process (save) the <DSCON> and <INRPT> errors?"
SET DIR("??")="^D Q2^AZHLRERP"
+11 DO DIR
IF $DATA(DIRUT)
QUIT
+12 SET DIC="^DIC(19,"
SET X=$PIECE($TEXT(OPT+1),"'",2)
SET DIC("DR")="1///RER UNIX File Processing;4///R;20///"_$SELECT(Y:"@",1:"S:0 %=""DSCON^INRPT""")_";25///IN^AZHLRERP;200///T+1@0630;202///1D"
+13 IF $DATA(^DIC(19,"B",$EXTRACT(X,1,30)))
SET DIE=DIC
SET DA=$ORDER(^DIC(19,"B",$EXTRACT(X,1,30),0))
SET DR=DIC("DR")
DO DIE
IF 1
+14 IF '$TEST
DO FILE
+15 WRITE !!,"Done.",!
+16 QUIT
+17 ;
IN ;EP - From TaskMan. Read in errors from remote site and place in FM file.
+1 ;
+2 NEW A,D,E,F,H,I,J,L,N,P,R,V,XMB,XMTEXT
+3 ; List files in uucppublic, open HFS, list files to ^TMP.
+4 SET X=$$JOBWAIT^%HOSTCMD("ls -l /usr/spool/uucppublic/*z* > azhlrer.wrk")
+5 FOR A=0:0
SET A=$ORDER(^%ZIS(1,A))
IF 'A
QUIT
IF ^(A,"TYPE")="HFS"
SET IOP=$PIECE(^%ZIS(1,A,0),U)
SET %ZIS("IOPAR")="(""azhlrer.wrk"":""R"")"
DO ZIS
IF 'POP
QUIT
+6 IF POP!('A)
QUIT
+7 SET D="/usr/spool/uucppublic/"
KILL ^TMP($JOB)
+8 USE IO
FOR
READ %
IF %=""
QUIT
SET %=$PIECE(%,"/",5)
IF (%?2.4U4N1"z"3N.1".z")!(%?1"%"4N1"z"3N.1".z")
IF $EXTRACT(%,$LENGTH(%)-1,$LENGTH(%))=".z"
SET X=$$JOBWAIT^%HOSTCMD("unpack "_D_%)
SET %=$EXTRACT(%,1,$LENGTH(%)-2)
IF (%?2.4U4N1"z"3N)!(%?1"%"4N1"z"3N)
SET ^TMP($JOB,"RER",%)=""
+9 SET F=""
SET X="ERR^AZHLRERP"
SET @^%ZOSF("TRAP")
SET %=$ORDER(^DIC(19,"B","AZHL REMOTE ERROR UNIX FILE PR",0))
SET A=$PIECE($GET(^DIC(19,%,20)),"""",2)
MAIN ;
+1 FOR
SET F=$ORDER(^TMP($JOB,"RER",F))
IF F=""
QUIT
Begin DoDot:1
+2 USE IO:(D_F)
READ L
IF '((L["<<< BEGIN '")&(L[", REMOTE ERROR REPORTING FOR '"))
QUIT
+3 SET P=$PIECE(L,"'",2)
SET I=$PIECE(L,"'",4)
SET R=$PIECE($PIECE($PIECE(L,","),"v",2)," ",2)
+4 IF '$DATA(^AZHLRER(I))
SET (DINUM,X)=I
SET DIC="^AZHLRER("
DO FILE
+5 READ L
DO VARS
+6 FOR
IF (L="")!($EXTRACT(L,1,12)=" >>> END")
QUIT
Begin DoDot:2
+7 SET ^(I)=+$GET(^TMP($JOB,"COUNT",P,H,I))+1
+8 IF '$DATA(^AZHLRER(I,1,H))
SET DIC="^AZHLRER("_I_",1,"
SET (DINUM,X)=H
SET DA(1)=I
IF '$DATA(^AZHLRER(I,1,0))
SET ^(0)="^8008907.01^"
DO FILE
+9 SET DIC="^AZHLRER("_I_",1,"_H_",1,"
SET (DINUM,X)=E
SET DA(2)=I
SET DA(1)=H
IF '$DATA(^AZHLRER(I,1,H,1,0))
SET ^(0)="^8008907.11^"
DO FILE
+10 SET E(1)=E
SET H(1)=H
+11 IF '$DATA(^AZHLRER(I,1,H,1,E,1,0))
SET ^(0)="^8008907.111^"
+12 FOR
IF E'=E(1)!(H'=H(1))
QUIT
Begin DoDot:3
+13 IF V=0
Begin DoDot:4
+14 SET $PIECE(^AZHLRER(I,1,H,1,E,0),U,2)=P
SET $PIECE(^(0),U,3)=R
SET $PIECE(^(0),U,4)=$TRANSLATE(V(2),"^","~")
SET $PIECE(^(0),U,5)=$PIECE($PIECE(V(2),">"),"<",2)
SET $PIECE(^(0),U,6)=$PIECE($PIECE(V(2),":"),U,2)
+15 SET ^AZHLRER("C",P,I,H,E)=""
SET ^AZHLRER("D",$PIECE($PIECE(V(2),">"),"<",2),I,H,E)=""
SET ^AZHLRER("E",$PIECE($PIECE(V(2),":"),U,2),I,H,E)=""
+16 QUIT
End DoDot:4
+17 IF '$TEST
SET DIC="^AZHLRER("_I_",1,"_H_",1,"_E_",1,"
SET DINUM=V
SET X=V(1)
SET DA(3)=I
SET DA(2)=H
SET DA(1)=E
DO FILE
SET ^AZHLRER(I,1,H,1,E,1,V,1)=V(2)
+18 READ L
DO VARS
+19 QUIT
End DoDot:3
+20 QUIT
End DoDot:2
+21 SET X=$$JOBWAIT^%HOSTCMD("rm "_D_F)
+22 QUIT
End DoDot:1
+23 SET X=^%ZOSF("ERRTN")
SET @^%ZOSF("TRAP")
DO ZISC
SET X=$$JOBWAIT^%HOSTCMD("rm azhlrer.wrk")
BULLETIN ; ^TMP($J,"COUNT",namespace,$H-date,facility)=count
+1 SET (F,H,N)=""
SET %=0
FOR
SET N=$ORDER(^TMP($JOB,"COUNT",N))
IF N=""
QUIT
FOR
SET H=$ORDER(^TMP($JOB,"COUNT",N,H))
IF H=""
QUIT
FOR
SET F=$ORDER(^TMP($JOB,"COUNT",N,H,F))
IF F=""
QUIT
SET %=%+1
SET XMTEXT(%)=" "_N_", day "_H_", "_^(F)_" error"_$SELECT(^(F)>1:"s",1:"")_" from "_F
+2 IF $LENGTH($ORDER(^TMP($JOB,"COUNT","")))
SET XMB="AZHL RER"
SET XMTEXT="XMTEXT("
DO XMB
+3 KILL ^TMP($JOB)
PURGE SET (DA(1),DA)=0
FOR
SET DA(1)=$ORDER(^AZHLRER("B",DA(1)))
IF 'DA(1)
QUIT
FOR
SET DA=$ORDER(^AZHLRER(DA(1),1,"B",DA))
IF 'DA
QUIT
IF (+$HOROLOG-DA)>730
SET DIK="^AZHLRER("_DA(1)_",1,"
DO DIK
Q QUIT
+1 ;
FILE NEW A,D,E,F,H,I,J,L,N,P,R,V
KILL DD,DO
SET DIC(0)="L"
DO FILE^DICN
KILL DIC
QUIT
DIE NEW A,D,E,F,H,I,J,L,N,P,R,V
DO ^DIE
KILL DA,DR,DIE
QUIT
DIK NEW A,D,E,F,H,I,J,L,N,P,R,V
DO ^DIK
QUIT
DIR NEW A,D,E,F,H,I,J,L,N,P,R,V
DO ^DIR
QUIT
VARS SET H=$PIECE(L,",",2)
SET E=$PIECE(L,",",3)
SET V=$PIECE($PIECE(L,",",4),")")
SET V(1)=$PIECE(L,"=",2)
SET V(2)=$PIECE(L,"=",3,99)
+1 IF +V=0
IF A]""
IF A[$PIECE($PIECE(V(2),">"),"<",2)
FOR
READ L
IF L=""
QUIT
IF '($PIECE(L,",",2)=H)!'($PIECE(L,",",3)=E)
GOTO VARS
+2 QUIT
XMB NEW A,D,E,F,H,I,J,L,N,P,R,V
DO ^XMB
QUIT
ZIS NEW A,D,E,F,H,I,J,L,N,P,R,V
DO ^%ZIS
QUIT
ZISC NEW A,D,E,F,H,I,J,L,N,P,R,V
DO ^%ZISC
QUIT
ERR ;EP - Possible entry if error ($ZT), probably due to incomplete file.
+1 SET X=$$JOBWAIT^%HOSTCMD("rm "_D_F)
+2 GOTO MAIN
Q2 ;EP - From DIR
+1 WRITE !
FOR %=2:1:7
WRITE $PIECE($TEXT(Q2+%),";;",2),!
+2 ;;If you answer 'Y', the <DSCON> and <INRPT> errors will be processed.
+3 ;;If you answer 'N', the <DSCON> and <INRPT> errors will be ignored.
+4 ;; -- Note --
+5 ;;The errors in the quoted string of the ENTRY ACTION field of option
+6 ;;AZHL REMOTE ERROR UNIX FILE PROCESSING, will not be processed.
+7 ;;Edit that field if you want to add or delete errors to be IGNORED.
+8 QUIT