LEXQC ;ISL/KER - Query - Changes - Extract ;04/21/2014
;;2.0;LEXICON UTILITY;**62,80**;Sep 23, 1996;Build 10
;
; Global Variables
; ^DIC(81.3, ICR 4492
; ^ICPT( ICR 4489
; ^ICPT(0) ICR 4489
; ^TMP("LEXQC") SACC 2.3.2.5.1
; ^TMP("LEXQCO") SACC 2.3.2.5.1
;
; External References
; HOME^%ZIS ICR 10086
; $$ROOT^ICDEX ICR 5747
; $$FMADD^XLFDT ICR 10103
;
EN ; Main Entry Point
N LEXENV S LEXENV=$$EV^LEXQM Q:+LEXENV'>0
K ^TMP("LEXQCO",$J),^TMP("LEXQC",$J)
N LEXCDT,LEXEDT,LEXEXIT S LEXCDT=$$CSD^LEXQM Q:'$L(LEXCDT)
Q:+($G(LEXEXIT))>0 S LEXEDT=$P(LEXCDT,"^",1),LEXCDT=$P(LEXCDT,"^",2)
Q:LEXCDT'?7N D TASK
Q
TASK ; Task Re-indexing
N X,Y,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTQUEUED,ZTREQ
S LEXCDT=+($G(LEXCDT)) Q:LEXCDT'?7N S LEXEDT=$G(LEXEDT) Q:'$L(LEXEDT)
S ZTRTN="SEARCH^LEXQC",ZTSAVE("LEXCDT")="",ZTIO="",ZTDTH=$H
S ZTDESC="Search for CSV Changes on "_LEXEDT
D @ZTRTN D HOME^%ZIS S X=+($G(ZTSK))
W:+X>0 !!," A search for CSV changes on ",LEXEDT
W:+X>0 " has been queued (task ",+X,")",!
K Y,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN
Q
SEARCH ; Search for CSV changes
S:$D(ZTQUEUED) ZTREQ="@" S LEXCDT=$G(LEXCDT) Q:LEXCDT'?7N
N LEXBDT,LEXADT,LEXRT,LEXQTOT,LEXQLEN,LEXQSTR
S LEXBDT=$$FMADD^XLFDT(LEXCDT,-1),LEXADT=$$FMADD^XLFDT(DT,+1)
Q:LEXBDT'?7N Q:LEXADT'?7N K ^TMP("LEXQC",$J) W !!," "
S LEXQTOT=$P($G(^ICPT(0)),"^",4)
S LEXRT=$$ROOT^ICDEX(80) S LEXQTOT=LEXQTOT+$P($G(@(LEXRT_"0)")),"^",4)
S LEXRT=$$ROOT^ICDEX(80.1) S LEXQTOT=LEXQTOT+$P($G(@(LEXRT_"0)")),"^",4)
S LEXQTOT=LEXQTOT+$P($G(^DIC(81.3,0)),"^",4)
S LEXQLEN=68,LEXQSTR=+(LEXQTOT\LEXQLEN) S:LEXQSTR=0 LEXQSTR=1
D D09^LEXQC3,P09^LEXQC3,D10^LEXQC3,P10^LEXQC3,CPT^LEXQC4,MOD^LEXQC4
D EN^LEXQC2 D:$D(^TMP("LEXQCO",$J)) DSP^LEXQO("LEXQCO")
Q
LEXQC ;ISL/KER - Query - Changes - Extract ;04/21/2014
+1 ;;2.0;LEXICON UTILITY;**62,80**;Sep 23, 1996;Build 10
+2 ;
+3 ; Global Variables
+4 ; ^DIC(81.3, ICR 4492
+5 ; ^ICPT( ICR 4489
+6 ; ^ICPT(0) ICR 4489
+7 ; ^TMP("LEXQC") SACC 2.3.2.5.1
+8 ; ^TMP("LEXQCO") SACC 2.3.2.5.1
+9 ;
+10 ; External References
+11 ; HOME^%ZIS ICR 10086
+12 ; $$ROOT^ICDEX ICR 5747
+13 ; $$FMADD^XLFDT ICR 10103
+14 ;
EN ; Main Entry Point
+1 NEW LEXENV
SET LEXENV=$$EV^LEXQM
IF +LEXENV'>0
QUIT
+2 KILL ^TMP("LEXQCO",$JOB),^TMP("LEXQC",$JOB)
+3 NEW LEXCDT,LEXEDT,LEXEXIT
SET LEXCDT=$$CSD^LEXQM
IF '$LENGTH(LEXCDT)
QUIT
+4 IF +($GET(LEXEXIT))>0
QUIT
SET LEXEDT=$PIECE(LEXCDT,"^",1)
SET LEXCDT=$PIECE(LEXCDT,"^",2)
+5 IF LEXCDT'?7N
QUIT
DO TASK
+6 QUIT
TASK ; Task Re-indexing
+1 NEW X,Y,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTQUEUED,ZTREQ
+2 SET LEXCDT=+($GET(LEXCDT))
IF LEXCDT'?7N
QUIT
SET LEXEDT=$GET(LEXEDT)
IF '$LENGTH(LEXEDT)
QUIT
+3 SET ZTRTN="SEARCH^LEXQC"
SET ZTSAVE("LEXCDT")=""
SET ZTIO=""
SET ZTDTH=$HOROLOG
+4 SET ZTDESC="Search for CSV Changes on "_LEXEDT
+5 DO @ZTRTN
DO HOME^%ZIS
SET X=+($GET(ZTSK))
+6 IF +X>0
WRITE !!," A search for CSV changes on ",LEXEDT
+7 IF +X>0
WRITE " has been queued (task ",+X,")",!
+8 KILL Y,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN
+9 QUIT
SEARCH ; Search for CSV changes
+1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
SET LEXCDT=$GET(LEXCDT)
IF LEXCDT'?7N
QUIT
+2 NEW LEXBDT,LEXADT,LEXRT,LEXQTOT,LEXQLEN,LEXQSTR
+3 SET LEXBDT=$$FMADD^XLFDT(LEXCDT,-1)
SET LEXADT=$$FMADD^XLFDT(DT,+1)
+4 IF LEXBDT'?7N
QUIT
IF LEXADT'?7N
QUIT
KILL ^TMP("LEXQC",$JOB)
WRITE !!," "
+5 SET LEXQTOT=$PIECE($GET(^ICPT(0)),"^",4)
+6 SET LEXRT=$$ROOT^ICDEX(80)
SET LEXQTOT=LEXQTOT+$PIECE($GET(@(LEXRT_"0)")),"^",4)
+7 SET LEXRT=$$ROOT^ICDEX(80.1)
SET LEXQTOT=LEXQTOT+$PIECE($GET(@(LEXRT_"0)")),"^",4)
+8 SET LEXQTOT=LEXQTOT+$PIECE($GET(^DIC(81.3,0)),"^",4)
+9 SET LEXQLEN=68
SET LEXQSTR=+(LEXQTOT\LEXQLEN)
IF LEXQSTR=0
SET LEXQSTR=1
+10 DO D09^LEXQC3
DO P09^LEXQC3
DO D10^LEXQC3
DO P10^LEXQC3
DO CPT^LEXQC4
DO MOD^LEXQC4
+11 DO EN^LEXQC2
IF $DATA(^TMP("LEXQCO",$JOB))
DO DSP^LEXQO("LEXQCO")
+12 QUIT