source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIAXU.m@ 862

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

initial load of WorldVistAEHR

File size: 3.4 KB
RevLine 
[613]1DIAXU ;SFISC/DCM-UPDATE DESTINATION FILE ;8/16/96 16:42
2 ;;22.0;VA FileMan;;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5DIAX ;called from ^DIAX (Update Destination File option)
6DQ ;
7 I $D(ZTQUEUED) N DIAR,DIAX S ZTREQ="@",DIAR=6,DIAX=1 D MRK^DIARU
8 N DIAXF,DIAXFRT S DIAXF=$P(^DIAR(1.11,DIARC,0),U,2),DIAXFRT=$$ROOT^DILFD(DIAXF)
9 D EXTRACT(DIAXF,DIARB,DIARP)
10 D UPDATE^DIARU
11 I $D(ZTQUEUED),$G(DIERR) S ZTIO=DIAXIOP,ZTRTN="XREP^DIAXU",ZTDESC="EXTRACT TOOL EXCEPTION REPORT",ZTSAVE("^TMP(""DIAXU"",$J)")="",ZTSAVE("^TMP(""DIERR"",$J)")="",ZTSAVE("DIARC")="" D ^%ZTLOAD Q
12XREP ;
13 I $D(ZTQUEUED) S ZTREQ="@"
14 D ^DIAXP
15 Q
16EN ; obsolete, replaced by EXTRACT
17 N %,DIAXERR S DIAXERR=""
18 D CLEAN^DIEFU
19 F %=$G(DIAXF)_U_"DIAXF",$G(DIAXFE)_U_"DIAXFE",$G(DIAXT)_U_"DIAXT" I $P(%,U,1)']"" D ERR(201,$P(%,U,2))
20 Q:$G(DIERR)
21 D EXTRACT(DIAXF,DIAXFE,DIAXT,$S($D(DIAXDEL):"D",1:""))
22 I '$G(DIERR),$D(^TMP("DIAXU",$J,"RESULT",DIAXF,DIAXFE)) S DIAXDA=^(DIAXFE)
23 Q
24 ;
25DIPT N X,D,SCR,DIARP,DIAR,DIPG
26 S X=$S(DIAXT:DIAXT,1:$P($P(DIAXT,"[",2),"]")),D="F"_DIAXF,SCR="I $P(^(0),U,8)=2"
27 S DIARP=$$FIND1^DIC(.4,"","XA",X,D,SCR,DIAXERR)
28 Q:$G(DIERR) I 'DIARP D ERR(202,"EXTRACT TEMPLATE") Q
29 S DIAR=6,DIPG=1,DIAXT=DIARP,DIAXDF=$P(^DIPT(DIAXT,0),U,9),DIAXDFRT=$$ROOT^DILFD(DIAXDF)
30 D EN^DIAXM
31 Q
32DIK N DIK,DA
33 S DIK=$$ROOT^DILFD(DIAXF),DA=DIAXFE
34 D ^DIK
35 Q
36K K @DIAXTFR,@DIAXTTO
37 Q
38ONE I '$$VENTRY^DIEFU(DIAXF,DIAXFE) D ERR(601,DIAXFE),STE() Q
39 D ^DIAXD I $G(DIERR) D:$D(DIAXFILE) D STE() Q
40 . N DIERR,A S A("IEN")=DIAXFE
41 . D BLD^DIALOG(1300,"",.A)
42 D ^DIAXF I $G(DIERR) D STE() Q
43 Q:$D(DIAX)
44 I $G(DIAXFLGS)["D" D DIK
45 I $G(DIAXDA) S @DIAXRSLT@("RESULT",DIAXF,DIAXFE)=DIAXDA
46 Q
47 ;
48DIBT N SCR,D
49 S D="F"_DIAXF,SCR="I $P(^(0),U,4)="_DIAXF_",'$P(^(0),U,8)"
50 S DIAXST=$S($G(DIAXST):DIAXST,1:$$FIND1^DIC(.401,"","AX",DIAXST,D,SCR,DIAXERR))
51 I 'DIAXST!('$D(^DIBT(DIAXST,1))) D ERR(202,"SEARCH TEMPLATE") S:$G(DIAR) DIAR="" Q
52 N Z S Z=0 F S Z=$O(^DIBT(DIAXST,1,Z)) Q:Z'>0 D
53 . N DIAXDA,DIAXFE,DIERR
54 . S DIAXFE=Z
55 . D ONE
56 . Q:$G(DIERR)
57 . I $G(DIAX) D Q
58 . . N FDA,IEN
59 . . S FDA(1.14,"+"_+DIAXFE_","_DIARC_",",.01)=DIAXDA,IEN(DIAXFE)=DIAXDA
60 . . D UPDATE^DIE("","FDA","IEN")
61 . . S @(DIAXFRT_"DIAXFE,-9)")=DIARC
62 . I $G(DIAXFLGS)["D" K ^DIBT(DIAXST,1,DIAXFE)
63 Q
64STE(FI,IEN) N Z
65 S:$G(FI)="" FI=DIAXF
66 S:$G(IEN)="" IEN=DIAXFE
67 S DIERRZ=(DIERR+DIERRZ)_U_($P(DIERR,U,2)+($P(DIERRZ,U,2)))
68 F DIERRLST=DIERRLST:1:$O(^TMP("DIERR",$J,"E"),-1) S Z=DIERRLST_";"
69 S @DIAXRSLT@("RESULT","ERR",FI,IEN)=Z
70 Q
71ERR(DIAXER,DIAXTXT) ;
72 D BLD^DIALOG(DIAXER,DIAXTXT,"",DIAXERR,"F")
73 Q
74EXTRACT(DIAXF,DIAXSRCE,DIAXT,DIAXFLGS,DIAXSCR,DIAXFILE,DIAXRSLT,DIAXERRA) ;
75 N DIAXST,DIAXFE,T,DIFM,DIOVRD,DIERRLST,DIAXTFR,DIAXTTO,DIAXDF,DIAXDFRT,DIAXERR,DIERRZ,DIAXDA
76 S DIAXRSLT=$S($G(DIAXRSLT)]"":DIAXRSLT,1:"^TMP(""DIAXU"",$J)"),(DIFM,DIOVRD)=1,(DIERRLST,DIERRZ)=0,DIAXERR=""
77 K ^TMP("DIAXU",$J),^TMP("DIAX",$J),^TMP($J) D CLEAN^DIEFU
78 I '$G(DIAR) D Q:$G(DIERR)
79 . N %,PARAM F %=1:1:3 S PARAM=$S(%=1:$G(DIAXF)_U_"FILE",%=2:$G(DIAXSRCE)_U_"SOURCE",1:$G(DIAXT)_U_"EXTRACT TEMPLATE") I $P(PARAM,U)']"" D ERR(202,$P(PARAM,U,2))
80 . Q:$G(DIERR)
81 . I '$$VFILE^DIEFU(DIAXF) D ERR(202,"FILE") Q
82 . I $G(DIAXSRCE) S DIAXFE=+DIAXSRCE,T="ONE"
83 . I $E(DIAXSRCE)="[" S DIAXST=$P($P(DIAXSRCE,"[",2),"]"),T="DIBT"
84 . D DIPT
85 . Q
86 E S T="DIBT",DIAXST=DIAXSRCE
87 D ^DIAXT I $G(DIERR) S:$G(DIAR) DIAR="" Q
88 D @T,K
89 I $G(DIERRZ) S DIERR=DIERRZ
90 I $G(DIERR),$G(DIAXERRA)]"" M @DIAXERRA@("DIERR")=^TMP("DIERR",$J) K ^TMP("DIERR",$J)
91 Q
Note: See TracBrowser for help on using the repository browser.