APCPRLOG ; IHS/TUCSON/LAB - OHPRD-TUCSON/LAB - UPDATE LOG IN REDO AUGUST 14, 1992 ; [ 04/30/2002 9:36 PM ]
;;2.0;IHS PCC DATA EXTRACTION SYSTEM;**1,3,6**;APR 03, 1998
;IHS/CMI/LAB - new date format
LOG ; UPDATE LOG
W:'$D(ZTQUEUED) !!,APCP("COUNT")," transactions were generated."
W:'$D(ZTQUEUED) !,"Updating Log entry."
D NOW^%DTC S APCP("RUN STOP")=%
S X="AD0"_"^"_$P(^AUTTSITE(1,1),U,3)_"^"_$P(^DIC(4,DUZ(2),0),U)_"^"_$$DATE($E(APCP("RUN START"),1,7))_"^"_$$DATE(APCP("RUN BEGIN"))_"^"_$$DATE(APCP("RUN END"))
S X=X_"^"_$S(APCPO("RUN")="REDO":"R",1:"")_"^"_APCP("COUNT")_"^"_APCP("VISITS STAT")_"^"
S Y=$G(APCP("ERROR COUNT"))+$G(APCP("DEMO PAT"))+$G(APCP("DEL NEVER SENT"))+$G(APCP("IN NO PP"))
S X=X_Y_"^"_$G(APCP("ERROR COUNT"))_"^"_$G(APCP("DEMO PAT"))_"^"_$G(APCP("FILENAME"))
S ^BAPCDATA(0)=X
S X=^APCPLOG(APCP("RUN LOG"),0),$P(X,U,3)="",$P(X,U,4)="",$P(X,U,5)="",$P(X,U,6)="",$P(X,U,7)="",$P(X,U,11)="",$P(X,U,12)="",$P(X,U,13)="",$P(X,U,15)=""
S $P(X,U,17)="",$P(X,U,18)="",$P(X,U,19)="",$P(X,U,21)="",$P(X,U,22)="",$P(X,U,23)="",$P(X,U,26)="",^APCPLOG(APCP("RUN LOG"),0)=X
S DA=APCP("RUN LOG"),DIE="^APCPLOG(",DR=".03////"_APCP("RUN START")_";.04////"_APCP("RUN STOP")_";.05////"_APCP("ERROR COUNT")_";.06////"_APCP("COUNT")_";.15///P"
D ^DIE
I $D(Y) S APCP("QFLG")=30 Q
S DA=APCP("RUN LOG"),DIE="^APCPLOG(",DR=".11////"_APCP("INPT")_";.14////"_APCP("CHA")_";.13////"_APCP("APC")_";.17////"_APCP("STAT")_";.18////"_$G(APCP("VISITS STAT")) D ^DIE I $D(Y) S APCP("QFLG")=30 Q
S DA=APCP("RUN LOG"),DIE="^APCPLOG(",DR=".19////"_$G(APCP("DEMO PAT"))_";.21////"_$G(APCP("EVENTS"))_";.22////"_$G(APCP("DELETED"))_";.23////"_$G(APCP("IN NO PP")) D ^DIE I $D(Y) S APCP("QFLG")=30 Q
S DA=APCP("RUN LOG"),DIE="^APCPLOG(",DR=".24///"_APCP("FILENAME")_";.25///"_$S(APCPO("RUN")="REDO":1,1:"")_";.26///"_APCP("DEL NEVER SENT") D ^DIE I $D(Y) S APCP("QFLG")=26 Q
;
Q
;
DATE(D) ;EP ;IHS/CMI/LAB - new date format - format date in YYYYMMDD format
I $G(D)="" Q ""
Q $E(D,1,3)+1700_$E(D,4,7)
;
APCPRLOG ; IHS/TUCSON/LAB - OHPRD-TUCSON/LAB - UPDATE LOG IN REDO AUGUST 14, 1992 ; [ 04/30/2002 9:36 PM ]
+1 ;;2.0;IHS PCC DATA EXTRACTION SYSTEM;**1,3,6**;APR 03, 1998
+2 ;IHS/CMI/LAB - new date format
LOG ; UPDATE LOG
+1 IF '$DATA(ZTQUEUED)
WRITE !!,APCP("COUNT")," transactions were generated."
+2 IF '$DATA(ZTQUEUED)
WRITE !,"Updating Log entry."
+3 DO NOW^%DTC
SET APCP("RUN STOP")=%
+4 SET X="AD0"_"^"_$PIECE(^AUTTSITE(1,1),U,3)_"^"_$PIECE(^DIC(4,DUZ(2),0),U)_"^"_$$DATE($EXTRACT(APCP("RUN START"),1,7))_"^"_$$DATE(APCP("RUN BEGIN"))_"^"_$$DATE(APCP("RUN END"))
+5 SET X=X_"^"_$SELECT(APCPO("RUN")="REDO":"R",1:"")_"^"_APCP("COUNT")_"^"_APCP("VISITS STAT")_"^"
+6 SET Y=$GET(APCP("ERROR COUNT"))+$GET(APCP("DEMO PAT"))+$GET(APCP("DEL NEVER SENT"))+$GET(APCP("IN NO PP"))
+7 SET X=X_Y_"^"_$GET(APCP("ERROR COUNT"))_"^"_$GET(APCP("DEMO PAT"))_"^"_$GET(APCP("FILENAME"))
+8 SET ^BAPCDATA(0)=X
+9 SET X=^APCPLOG(APCP("RUN LOG"),0)
SET $PIECE(X,U,3)=""
SET $PIECE(X,U,4)=""
SET $PIECE(X,U,5)=""
SET $PIECE(X,U,6)=""
SET $PIECE(X,U,7)=""
SET $PIECE(X,U,11)=""
SET $PIECE(X,U,12)=""
SET $PIECE(X,U,13)=""
SET $PIECE(X,U,15)=""
+10 SET $PIECE(X,U,17)=""
SET $PIECE(X,U,18)=""
SET $PIECE(X,U,19)=""
SET $PIECE(X,U,21)=""
SET $PIECE(X,U,22)=""
SET $PIECE(X,U,23)=""
SET $PIECE(X,U,26)=""
SET ^APCPLOG(APCP("RUN LOG"),0)=X
+11 SET DA=APCP("RUN LOG")
SET DIE="^APCPLOG("
SET DR=".03////"_APCP("RUN START")_";.04////"_APCP("RUN STOP")_";.05////"_APCP("ERROR COUNT")_";.06////"_APCP("COUNT")_";.15///P"
+12 DO ^DIE
+13 IF $DATA(Y)
SET APCP("QFLG")=30
QUIT
+14 SET DA=APCP("RUN LOG")
SET DIE="^APCPLOG("
SET DR=".11////"_APCP("INPT")_";.14////"_APCP("CHA")_";.13////"_APCP("APC")_";.17////"_APCP("STAT")_";.18////"_$GET(APCP("VISITS STAT"))
DO ^DIE
IF $DATA(Y)
SET APCP("QFLG")=30
QUIT
+15 SET DA=APCP("RUN LOG")
SET DIE="^APCPLOG("
SET DR=".19////"_$GET(APCP("DEMO PAT"))_";.21////"_$GET(APCP("EVENTS"))_";.22////"_$GET(APCP("DELETED"))_";.23////"_$GET(APCP("IN NO PP"))
DO ^DIE
IF $DATA(Y)
SET APCP("QFLG")=30
QUIT
+16 SET DA=APCP("RUN LOG")
SET DIE="^APCPLOG("
SET DR=".24///"_APCP("FILENAME")_";.25///"_$SELECT(APCPO("RUN")="REDO":1,1:"")_";.26///"_APCP("DEL NEVER SENT")
DO ^DIE
IF $DATA(Y)
SET APCP("QFLG")=26
QUIT
+17 ;
+18 QUIT
+19 ;
DATE(D) ;EP ;IHS/CMI/LAB - new date format - format date in YYYYMMDD format
+1 IF $GET(D)=""
QUIT ""
+2 QUIT $EXTRACT(D,1,3)+1700_$EXTRACT(D,4,7)
+3 ;