source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCFACPS.m@ 1742

Last change on this file since 1742 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 2.9 KB
Line 
1PRCFACPS ;WISC@ALTOONA/CTB/DL-PURGE CODE SHEET CONTINUATION ;1/29/98 1300
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4DQ ;;PURGE CODE SHEETS AND TRANSMISSION RECORDS
5 D:$D(ZTQUEUED) KILL^%ZTLOAD
6 S PRCFNAME=$S(PRCFASYS["CLM":"FEE/FEN",PRCFASYS["ISM":"ISM",PRCFASYS["IRS":"IRS",1:"LOG")
7 L +^PRCF(423,0):5 I '$T S X="Code Sheet file unavailable - File lock timeout.*" D MSG^PRCFQ Q
8 W:$D(IOF) @IOF W PRCFNAME_" CODE SHEET & TRANSMISSION RECORD DELETION TRANSCRIPT" D NOW^PRCFQ W ?IOM-$L(%X),%X
9 S $P(LINE,"-",IOM-2)="" W !,LINE,!!,"Option queued by: ",$S($D(DUZ):$P(^VA(200,DUZ,0),"^"),1:"Menu Manager"),!,"Date/Time queued: ",PRCFA("QTIME"),!,"From Device: ",PRCFA("QION")
10 W !!!,PRCFNAME_" code sheet deletion has begun for station ",PRC("SITE"),!,"I am deleting all "_PRCFNAME_" code sheets created or transmitted on or before ",PRCFA("DATE"),".",!
11 S (DA,J)=0,U="^" F K=1:1 S DA=$O(^PRCF(423,DA)) Q:'DA D KILLCS
12 W !!,"Done - deleted ",J," ",PRCFNAME," code sheets. ",$P(^PRCF(423,0),"^",4)," code sheets remaining."
13 W !!,"I will now begin cleaning up the Log Transmission Record file.",!,"I will delete all "_PRCFNAME_" batches and transmission records created on or before ",PRCFA("DATE"),!
14 S (DA,JX)=0,DIK="^PRCF(421.2," F K=1:1 S DA=$O(^PRCF(421.2,DA)) Q:'DA I $D(^(DA,0)) S X=^(0) I +$P(X,"-",2)>0!(PRCFASYS[$P(X,"-",2)),$P(X,"^",10)<PRCFA("KDATE"),(+X=PRC("SITE")!(+X="")) D ^DIK S JX=JX+1 W:JX#50=0 "."
15 W !!,"Done - Deleted ",JX," Batch and Transmission records. ",$P(^PRCF(421.2,0),"^",4)," transmission/batch records remaining.",!! Q
16XREF ;CLEAN UP OF XREF'S IN FILE 423
17 S XREF="A" F ZI=1:1 S XREF=$O(^PRCF(423,XREF)) Q:XREF="" S VAL="" F ZJ=1:1 S VAL=$O(^PRCF(423,XREF,VAL)) Q:VAL="" S DA=0 F ZK=1:1 S DA=$O(^PRCF(423,XREF,VAL,DA)) Q:DA="" K:'$D(^PRCF(423,DA)) ^PRCF(423,XREF,VAL,DA)
18 S XREF="C",VAL="" F ZJ=1:1 S VAL=$O(^PRCF(423,XREF,VAL)) Q:VAL="" I VAL["^" S DA=0,VAL1=$P(VAL,"^") F ZK=1:1 S DA=$O(^PRCF(423,XREF,VAL,DA)) Q:DA="" K ^PRCF(423,XREF,VAL,DA) S ^PRCF(423,XREF,VAL1,DA)=""
19 K XREF,VAL,DA,ZI,ZJ,ZK Q
20KILLCS S ZERO=$S($D(^PRCF(423,DA,0)):^(0),1:""),TRANS=$S($D(^("TRANS")):^("TRANS"),1:""),ZLOG=$S($D(^(300)):^(300),1:""),ONE=$S($D(^(1)):^(1),1:"")
21 I ZERO="",TRANS="",ZLOG="",ONE G K
22 I $P(ZERO,"^",2)'=PRC("SITE"),$P(ZERO,"^",2)]"" Q
23 I PRCFASYS'[$P(ZERO,"^",10),$P(ZERO,"^",10)]"" Q
24 I +$P(TRANS,U,3)>PRCFA("KDATE")!(+$P(TRANS,U,9)>PRCFA("KDATE")) Q
25 S J=J+1 W:J#50=0 "."
26 I $P(ZERO,U,6)'="" K ^PRCF(423,"C",$P(ZERO,U,6),DA)
27 K:$P(ZERO,U,1)'="" ^PRCF(423,"B",$P(ZERO,U),DA)
28 K:$P(TRANS,U,5)'="" ^PRCF(423,"AD",$P(TRANS,U,5),DA)
29 K:$P(TRANS,U,6)]"" ^PRCF(423,"AE",$P(TRANS,U,6),DA)
30 K:$P(ZLOG,U,24)]"" ^PRCF(423,"D",$P(ZLOG,U,24),DA)
31 K:$P(ZLOG,U,25)]"" ^PRCF(423,"AN",$P(ZLOG,U,25),DA)
32 K:$P(ONE,U,29)]"" ^PRCF(423,"AI",$P(ONE,U,29),DA)
33K K ONE,ZERO,TRANS,ZLOG,^PRCF(423,"AC","N",DA)
34 F ZX="AJ","AK","AL","AM" K ^PRCF(423,ZX,"Y",DA)
35 K ^PRCF(423,DA),ZX S:$P(^PRCF(423,0),"^",4)>0 $P(^(0),U,4)=$P(^(0),U,4)-1 Q
36 Q
Note: See TracBrowser for help on using the repository browser.