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

PSOHLSG4.m

Go to the documentation of this file.
  1. PSOHLSG4 ;BIR/LC-Purge entries from file 52.51 ;03/20/96
  1. ;;7.0;OUTPATIENT PHARMACY;**26**;DEC 1997
  1. PURGE ;Purge data from the External Interface file
  1. I $D(ZTQUEUED) G DQ
  1. S X1=DT,X2=-7 D C^%DTC S Y=X X ^DD("DD") S DIR("B")=Y
  1. S DIR(0)="D^:"_X_":EX",DIR("A")="Enter cutoff date for purge",DIR("?")="The cutoff date must be at least seven days before today"
  1. D ^DIR G Q:$D(DIRUT) S PDT=Y_.999999
  1. S DIR(0)="YA",DIR("B")="NO",DIR("A")="Purge entries that were not successfully processed? ",DIR("?",1)="Enter 'Yes' to purge entries whose status is 'process failed'."
  1. S DIR("?",2)="If you have reviewed/resolved the cause of the problem of those entries",DIR("?")="with an 'error' status answer 'Yes'. Otherwise answer 'No'."
  1. W ! D ^DIR G Q:$D(DIRUT) K DIR S PERR=Y
  1. S ZTRTN="DQ^PSOHLSG4",ZTSAVE("PERR")="",ZTSAVE("PDT")="",ZTIO="",ZTSAVE("DA1")="",ZTSAVE("DA")=""
  1. S ZTDESC="Purge External Interface file entries on or before "_$E(PDT,4,5)_"/"_$E(PDT,6,7)_"/"_$E(PDT,2,3) D ^%ZTLOAD
  1. ;W !!,"Purge queued to run in background." G Q
  1. G Q
  1. DQ ;Taskman entry point for running purge of External Interface file
  1. S:'$D(PERR) PERR=0 I '$D(PDT) S X1=DT,X2=-7 D C^%DTC S PDT=X_.999999
  1. F PDATE=0:0 S PDATE=$O(^PS(52.51,"AC1",PDATE)) Q:'PDATE!(PDATE>PDT) D
  1. .F PSOIN=0:0 S PSOIN=$O(^PS(52.51,"AC1",PDATE,PSOIN)) Q:'PSOIN D
  1. ..S PSOTR=$P($G(^PS(52.51,PSOIN,0)),"^",10)
  1. ..I 'PERR,PSOTR=3 Q
  1. ..I PSOTR=1!(PSOTR=4) Q
  1. ..S DIK="^PS(52.51,",DA=PSOIN D ^DIK
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. Q K %H,DA,DIR,DIRUT,DIK,PDT,PERR,PTR,X,X1,X2,XMDUZ,XMK,XMZ,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,DELCNT
  1. ;
  1. Q