Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HLUOPT4

HLUOPT4.m

Go to the documentation of this file.
  1. HLUOPT4 ;OIFO-O/LJA - Purging Entries in file #772 and #773 ;02/04/2004 16:37
  1. ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
  1. ;
  1. ; This routine was created by patch HL*1.6*109
  1. ;
  1. SHOW120 ; Call SHOWXTMP with 30 second redisplay...
  1. D SHOWXTMP(120)
  1. QUIT
  1. ;
  1. ASKSHOW ; Ask whether want to monitor purging job progress...
  1. N ACTION,XTMP
  1. S XTMP=$O(^XTMP("HLUOPT1 9999999.999999"),-1) QUIT:XTMP'["HLUOPT1 " ;->
  1. W !!,"As purging jobs run, they record critical information in the ^XTMP global for"
  1. W !,"later review. (This information is updated every two minutes.) You can view"
  1. W !,"purge information now..."
  1. F S ACTION=$$ACTION QUIT:'ACTION D
  1. . I ACTION=1 D SHOWALL^HLUOPT5(XTMP)
  1. . I ACTION=2 D SHOWXTMP(120)
  1. . I ACTION=3 D
  1. . . W @IOF
  1. . . D GRAPH^HLUOPT5
  1. . . S X=$$BTE^HLCSMON("Press RETURN to continue... ",1)
  1. QUIT
  1. ;
  1. ACTION() ;
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR(0)="S^1:Display all available purging data (full screen);2:Display purging summary (single line);3:Display purging graph;4:Exit."
  1. S DIR("?",1)="Option #1 displays all available purging data, for the last job."
  1. S DIR("?",2)=""
  1. S DIR("?",3)="Option #2 displays the most valuable purging data, but not all data. This"
  1. S DIR("?",4)="option includes data for the last purging job, plus previous puring jobs."
  1. S DIR("?",5)=""
  1. S DIR("?")="Option #3 displays purging times and totals in a graphic representation."
  1. D ^DIR
  1. QUIT $S(+Y=1:1,+Y=2:2,+Y=3:3,1:"")
  1. ;
  1. SHOWXTMP(SEC) ; Continual redisplay of purging progress ever SEC seconds...
  1. N ABORT,ACTIVE,HDR,IOINHI,IOINORM,X,XTMP
  1. ;
  1. S X="IOINHI;IOINORM" D ENDR^%ZISS
  1. S HDR=" Task-Number Start-Time Timestamp Finish-time 772@ 773@ Time-NOW"
  1. ;
  1. ; Get last purging process' XTMP...
  1. S XTMP=$O(^XTMP("HLUOPT1 9999999.999999"),-1)
  1. S ACTIVE=0 ; Default...
  1. I XTMP]"" S X=$P($G(^XTMP(XTMP,"RUN")),U,4) I X'?7N.E S ACTIVE=1
  1. ;
  1. ; Show last 10 runs...
  1. D SHOWNUM($S(ACTIVE:9,1:18))
  1. ;
  1. ; Redisplay SEC defaults to 30...
  1. S SEC=$S($G(SEC)>0:+SEC,1:30)
  1. ;
  1. ; What if no purging process exists?
  1. I XTMP']""!('ACTIVE) D QUIT ;->
  1. . W !!,"There is no currently running purge job..."
  1. . S X=$$BTE^HLCSMON("Press RETURN to exit... ",1)
  1. ;
  1. W !!,"Any old jobs that exist will be shown above. The current (or last) purge job"
  1. W !,"is shown below. The information on each line will automatically refresh"
  1. W !,"every ",SEC," seconds (or whenever you press RETURN.)"
  1. W !!,IOINHI,"Note!!",IOINORM," Enter '^' when you are ready to exit."
  1. W !!,"Current (or last) purge job..."
  1. W !
  1. S CT=0
  1. ;
  1. F D QUIT:ABORT
  1. . S ABORT=1,CT=CT+1
  1. . D LINERUN(XTMP)
  1. . R X:SEC QUIT:X]"" ;-> Quit if they enter anything
  1. . I CT>17 W ! S CT=0
  1. . S ABORT=0
  1. ;
  1. QUIT
  1. ;
  1. SHOWNUM(NUM) ; Show last NUM entries...
  1. N CT,HOLD,XTMP
  1. ; ACTIVE -- req
  1. S XTMP="HLUOPT1 9999999.99999"
  1. ; If last job is active, don't include it in array...
  1. I ACTIVE S XTMP=$O(^XTMP(XTMP),-1) QUIT:XTMP'["HLUOPT1 " ;->
  1. S CT=0
  1. F S XTMP=$O(^XTMP(XTMP),-1) Q:(CT>(NUM-1))!(XTMP'["HLUOPT1 ") D
  1. . S CT=CT+1
  1. . S HOLD(XTMP)=""
  1. QUIT:'$D(HOLD) ;->
  1. W !!,"Recent purge runs..."
  1. W !!,HDR,!,$$REPEAT^XLFSTR("-",IOM)
  1. S XTMP=""
  1. F S XTMP=$O(HOLD(XTMP)) Q:XTMP']"" D
  1. . D LINERUN(XTMP)
  1. QUIT
  1. ;
  1. LINERUN(XTMP) ; Display one line...
  1. N I,PCE1,PCE2,PCE3,PCE4,PCE5,PCE6,PCE7,PCE8,PCE9,PCE10,PCE11
  1. N PCE12,PCE13,PCE14
  1. S RUN=$G(^XTMP(XTMP,"RUN"))
  1. F I=1:1:14 S @("PCE"_I)=$P(RUN,U,I)
  1. S PCE2=$$SDT(PCE2),PCE3=$$SDT(PCE3),PCE4=$$SDT(PCE4)
  1. I ($P(PCE2,"@"))=$$SDT(DT) S PCE3=" "_$P(PCE3,"@",2)
  1. I ($P(PCE2,"@"))=$$SDT(DT) S PCE4=" "_$P(PCE4,"@",2)
  1. I CT=1 W !,HDR,!,$$REPEAT^XLFSTR("-",IOM)
  1. W !,$J(PCE1,12),?14,PCE2,?26,PCE3,?38,PCE4,?50,$J(PCE8,8)
  1. W ?59,$J(PCE10,8)
  1. W ?69,$$SDT($$NOW^XLFDT)
  1. QUIT
  1. ;
  1. SDT(DATE) ; Return shortened form of date...
  1. I DATE?7N QUIT $E(DATE,4,5)_"/"_$E(DATE,6,7) ;->
  1. I DATE?7N1"."1.N QUIT $E(DATE,4,5)_"/"_$E(DATE,6,7)_"@"_$E($P($$FMTE^XLFDT(DATE),"@",2),1,5)
  1. QUIT ""
  1. ;
  1. XTMPBEGN ; Initialize ^XTMP nodes for use in purging monitoring...
  1. N NOW
  1. S NOW=$$NOW^XLFDT,XTMP="HLUOPT1 "_NOW
  1. S ^XTMP(XTMP,0)=$$FMADD^XLFDT(NOW,14)_U_NOW_U_$G(DUZ)_U_"HLUOPT1 Purging"
  1. S ^XTMP(XTMP,"RUN")=$G(ZTSK)_U_NOW_U_NOW_U_U_"RUNNING"_U_"XTMPBEGN"
  1. QUIT
  1. ;
  1. XTMPUPD(XTMP,STATUS,WHERE) ; Update the data in purging's ^XTMP...
  1. N NOW,RUN
  1. ;
  1. ; Required variables...
  1. S NOW=$$NOW^XLFDT
  1. ;
  1. ; Update node...
  1. S RUN=$G(^XTMP(XTMP,"RUN"))
  1. S $P(RUN,U,3)=$$NOW^XLFDT ; Timestamp
  1. I STATUS="FINISHED"!(STATUS["ABORTED") S $P(RUN,U,4)=NOW ; Finish time
  1. S $P(RUN,U,5)=STATUS ; Status
  1. S $P(RUN,U,6)=WHERE ; Whereabouts
  1. S $P(RUN,U,7)=$G(XTMP(772,"REV")) ; # 772 reviewed
  1. S $P(RUN,U,8)=$G(XTMP(772,"DEL")) ; # 772 deleted
  1. S $P(RUN,U,9)=$G(XTMP(773,"REV")) ; # 773 reviewed
  1. S $P(RUN,U,10)=$G(XTMP(773,"DEL")) ;# 773 deleted
  1. S $P(RUN,U,11)=$G(XTMP(772,"LAST")) ; Last 772 IEN
  1. S $P(RUN,U,12)=$G(XTMP(772,"FAIL")) ; # failed purge check (in a row)
  1. S $P(RUN,U,13)=$G(XTMP(773,"LAST")) ; Last 773 IEN
  1. S $P(RUN,U,14)=$G(XTMP(773,"FAIL")) ; # failed purge check (in a row)
  1. S $P(RUN,U,15)=$G(XTMP(772,"LAST","TIME")) ; Last 772s .01 time
  1. S $P(RUN,U,16)=$G(XTMP(773,"LAST","TIME")) ; Last 773's 772s .01 time
  1. S ^XTMP(XTMP,"RUN")=RUN
  1. ;
  1. QUIT
  1. ;
  1. LOCKTELL ; Process is locked, so new purge job can't be started...
  1. N X
  1. W !!,"The '^HL(""HLUOPT1"")' lock is already owned by another purge job! So, this"
  1. W !,"purge job cannot be started."
  1. S X=$$BTE^HLCSMON("Press RETURN to exit... ",1)
  1. QUIT
  1. ;
  1. INIT ; Moved here from HLUOPT1 (ran out of room)
  1. ; If no data are stored in file 869.3, fields 41, 42, and 43,
  1. ; the default number for these fields is 7, 30, 90, respectively.
  1. N I,HLIEN,HLREC,HLDEF
  1. S HLDEF="7^30^90^90"
  1. S HLIEN=+$O(^HLCS(869.3,0))
  1. S HLREC=$S(HLIEN:$G(^HLCS(869.3,HLIEN,4)),1:"")
  1. F I=1:1:4 I '$P(HLREC,U,I) S $P(HLREC,U,I)=$P(HLDEF,U,I)
  1. ;
  1. ; If AWAITING ACK<COMPLETED -- or -- AWAITING ACK > ALL -- or -- PURGE < ALL use the default values (for an invalid date(s) has been entered into the paramters)
  1. I $P(HLREC,U,2)<$P(HLREC,U,1)!($P(HLREC,U,3)<$P(HLREC,U,2))!($P(HLREC,U,3)>$P(HLREC,U,4)) D
  1. . S HLREC=HLDEF
  1. ;
  1. I $D(ZTQUEUED) D Q
  1. . S HLPDT("COMP")=$$FMADD^XLFDT(DT,-$P(HLREC,U,1))_.9
  1. . S HLPDT("WAIT")=$$FMADD^XLFDT(DT,-$P(HLREC,U,2))_.9
  1. . S HLPDT("ALL")=$$FMADD^XLFDT(DT,-$P(HLREC,U,3))_.9
  1. . S HLPDT("ERR")=$$FMADD^XLFDT(DT,-$P(HLREC,U,4))_.9
  1. ;
  1. ; get input data from user
  1. N DIR,X,Y,DIRUT
  1. ; input cutoff date for "Successfully Completed" messages
  1. S DIR(0)="D^:"_$$FMADD^XLFDT(DT,-1)_":EX"
  1. S DIR("A",1)=" Enter inclusive date up to which to purge SUCCESSFULLY COMPLETED"
  1. S DIR("A")=" messages"
  1. S DIR("B")="T"_-$P(HLREC,U,1)
  1. S DIR("?",1)=" The suggested cutoff date to purge 'Successfully Completed' messages"
  1. S DIR("?",2)=" is seven days prior to today."
  1. S DIR("?")=" Must be on or before "_$$FMTE^XLFDT($$FMADD^XLFDT(DT,-1),2)_"."
  1. W ! D ^DIR I $D(DIRUT) S HLEXIT=1 Q
  1. S HLPDT("COMP")=Y
  1. K DIR
  1. ;
  1. ; input cutoff date for "Awaiting Acknowledgement" messages
  1. S DIR(0)="D^:"_HLPDT("COMP")_":EX"
  1. S DIR("A",1)=" Enter inclusive date up to which to purge AWAITING ACK"
  1. S DIR("A")=" messages"
  1. S DIR("B")="T"_-$P(HLREC,U,2)
  1. S DIR("?",1)=" The suggested cutoff date to purge 'Awaiting Acknowledgment' messages"
  1. S DIR("?",2)=" is thirty days prior to today."
  1. S DIR("?")=" Must be on or before "_$$FMTE^XLFDT(HLPDT("COMP"),2)_"."
  1. W ! D ^DIR I $D(DIRUT) S HLEXIT=1 Q
  1. S HLPDT("WAIT")=Y
  1. K DIR
  1. ;
  1. ; Input for Vaporization Date
  1. S DIR(0)="D^:"_HLPDT("WAIT")_":EX"
  1. S DIR("A",1)=" Enter inclusive date up to which to purge all messages, regardless"
  1. S DIR("A")=" of status (except ERROR status)"
  1. S DIR("B")="T"_-$P(HLREC,U,3)
  1. S DIR("?",1)=" The suggested cutoff date to purge all messages (except for 'Error' messages)"
  1. S DIR("?",2)=" is 90 days prior to today."
  1. S DIR("?")=" Must be on or before "_$$FMTE^XLFDT(HLPDT("WAIT"),2)_"."
  1. W ! D ^DIR I $D(DIRUT) S HLEXIT=1 Q
  1. S HLPDT("ALL")=Y+.9
  1. K DIR
  1. ;
  1. ; prompt whether to purge "Error" messages
  1. S DIR(0)="Y"
  1. S DIR("A")=" Do you also want to purge messages with an ERROR status"
  1. S DIR("B")="NO"
  1. S DIR("?",1)=" Enter 'Yes' to purge entries whose status is 'error'."
  1. S DIR("?",2)=" If you have reviewed/resolved the cause of the problem of those",DIR("?")=" entries with an 'error' status answer 'Yes'. Otherwise answer 'No'."
  1. W ! D ^DIR I $D(DIRUT) S HLEXIT=1 Q
  1. K DIR
  1. I 'Y S HLPDT("ERR")=0
  1. E D Q:HLEXIT
  1. . ; input cutoff date for "Error" messages
  1. . S DIR(0)="D^:"_HLPDT("WAIT")_":EX"
  1. . S DIR("A",1)=" WARNING: You should have investigated all errors because purging"
  1. . S DIR("A",2)=" these messages permanently removes them from the system."
  1. . S DIR("A",3)=" "
  1. . S DIR("A",4)=" Enter inclusive date up to which to purge ERROR"
  1. . S DIR("A")=" messages"
  1. . S DIR("B")="T"_-$P(HLREC,U,4)
  1. . S DIR("?",1)=" The suggested cutoff date to purge 'Error' messages"
  1. . S DIR("?",2)=" is 90 days prior to today."
  1. . S DIR("?")=" Must be on or before "_$$FMTE^XLFDT(HLPDT("WAIT"),2)_"."
  1. . W ! D ^DIR I $D(DIRUT) S HLEXIT=1 Q
  1. . S HLPDT("ERR")=Y+.9
  1. . K DIR
  1. ;
  1. ; prompt whether to run this purge in the background
  1. S DIR(0)="YA"
  1. S DIR("A")=" Would you like to queue this purge? "
  1. S DIR("B")="YES"
  1. S DIR("?")=" If run in the foreground, you will see dots and a total count."
  1. W ! D ^DIR I $D(DIRUT) S HLEXIT=1 Q
  1. S HLTASK=Y
  1. K DIR
  1. W !," "
  1. ;
  1. S HLPDT("COMP")=HLPDT("COMP")+.9,HLPDT("WAIT")=HLPDT("WAIT")+.9
  1. Q
  1. ;
  1. EOR ;HLUOPT4 - Purging Entries in file #772 and #773 ;12/10/02 16:37