source: FOIAVistA/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIWE3.m@ 1713

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

initial load of FOIAVistA 6/30/08 version

File size: 6.0 KB
Line 
1DIWE3 ;SFISC/GFT-WP - MOVE, DELETE, REPEAT, TRANSFER ;12:49 PM 5 Oct 1999
2 ;;22.0;VA FileMan;**8**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4M ;MOVE
5 S DWAFT=1 G 1:X=U,OPT:'X S (DW1,DW3)=0 D MOVE Q:$D(DTOUT) S:DW1>DW3 DW1=DW1+I,DW2=DW2+I D DEL:DW1
61 G ^DIWE1
7 ;
8OPT W ! G OPT^DIWE1
9 ;
10R ;REPEAT
11 S DWAFT=1 G 1:X=U,OPT:'X D MOVE
12 G 1
13 ;
14D ;DELETE
15 S DW1=X G 1:X=U,OPT:'X W " thru: "_DW1_"// " R DW2:DTIME S:'$T DTOUT=1
16 G 1:DW2=U!'$T S:DW2="" DW2=DW1 I DW1>DW2 W $C(7),"??" G OPT
17 I DW2>DWLC S DW2=DWLC W " ("_DW2_")"
18 S X=DW2-DW1+1,%=2 W !,"OK TO REMOVE "_X_" LINE"_$E("S",X>1)
19 D YN^DICN I %-1 W " <NOTHING DELETED>" G 1
20 S %=2 I DW1=1,DW2=DWLC W !,$C(7),"ARE YOU SURE YOU WANT TO DELETE THIS ENTIRE TEXT" D YN^DICN G 1:%-1
21 D DEL K DWL G 1
22 ;
23F R !,"From line: ",DWL:DTIME S:'$T DTOUT=1 G Q:DWL=U!'$T
24 I DWL?."?" D H G F
25 I +DWL'=DWL W $C(7)," ?? Please enter a number." G F
26MOVE R " thru: ",DW2:DTIME S:'$T DTOUT=1 G Q:DW2=U!'$T S DW1=DWL
27 I $E(DW2)="E"!($E(DW2)="e") S DW2=9999999
28 I 'DW2 S DW2=DW1 W " (",DW1,")"
29 S %=2 G YN:'DWAFT R " after line: ",DW3:DTIME S:'$T DTOUT=1 G Q:DW3=U!'$T
30 I DW1-1<DW3,DW2>DW3 G Q
31 I DW1<1!(DW2>DWLC)!(DW1>DW2)!(DW3<0)!(DW3>DWLC)!(+DW3'=DW3) G Q
32YN W !,"ARE YOU SURE" D YN^DICN
33 G Q:%-1 K ^UTILITY($J,"W") S I=0
34 I DWAFT?.N X "S J=DW1-.1 F S J=$O("_DIC_"J)) Q:J>DW2!(J'>0) I $D(^(J,0)) S X=^(0) D O" S:J="" J=-1 G DN
35 I DW1>DW2 G Q
36 N % S %=DW1-1 F S %=$O(^TMP($J,"DIWE3",%)) Q:%'>0!(%>DW2) I $D(^(%,0))#2 S X=^(0) D O
37DN G Q:'I X "F J=DWLC:-1:DW3+1 S "_DIC_"J+I,0)="_DIC_"J,0)","F J=1:1:I S "_DIC_"DW3+J,0)=^UTILITY($J,""W"",J,0) W ""."""
38 K ^UTILITY($J,"W"),DWL,X,DICMX,^TMP($J,"DIWE3") S DWLC=DWLC+I,@(DIC_"0)")=DWLC Q
39DEL S I=+DW1
40 X "F J=DW2+1:1:DWLC S "_DIC_"I,0)="_DIC_"J,0),I=I+1 W ""."""
41 S I=DW2-DW1
42 X "F J=DWLC-I:1:DWLC K "_DIC_"J) W ""."""
43 S DWLC=DWLC-I-1 Q
44H N DIR,X,Y,DIRUT,%
45 S DIR(0)="E"
46 F %=1:1 Q:'$D(^TMP($J,"DIWE3",%)) S X=$G(^(%,0)) W !,$J(%,3),">",X I %#15=0 D ^DIR Q:X=U!$D(DIRUT)
47 Q
48Q W " <NO CHANGE>",$C(7) S DW1=0 K DWL,X,DICMX,DWAFT Q
49O S I=I+1,^UTILITY($J,"W",I,0)=X Q
50Z ;
51 Q:X=""!(X[U)!(X>DWLC) S DW3=X
52 N VAL,FILE,FLD,WPROOT,IENS,ARR,RT,FI,FD,WPRT,IEN S FI=0,RT=DIC
53 D RT(RT,"ARR") I $G(ARR)=U G Z0
54 S FI=ARR("FILE"),FD=ARR("FLDNO"),WPRT=ARR("ROOT"),IEN=ARR("IENS")
55Z0 N MSG S MSG="",FILE=FI,FLD=$G(FD),WPROOT=$G(WPRT),IENS=$G(IEN)
56 R !,"From what text: ",VAL:DTIME I '$T!(U[VAL)!(VAL="") S DUOUT=1 Q
57 I VAL?1."?" D G Z0
58 .N X,Y,D,DIC,DIR,DZ,DIX,DIY,DIZ,DO,DD
59 .W !! I $G(FILE)=3.9 W ?5,"Enter the message number or SUBJECT of another mailman message, OR ",!
60 .I FILE,FILE'=3.9 W ?5,"Select another entry in this file OR"
61 .W !?5,"Use relational syntax to pick up information from a word-processing",!?5,"field in another file.",!
62 .W ?5,"ex. ""VALUE"":FILE NAME:WORD PROCESSING FIELD NAME",!
63 .I FILE D
64 ..W !,"Do you want the entire "_$O(^DD(FILE,0,"NM",0))_" list?"
65 ..S DZ="??" S DIR(0)="Y" D ^DIR Q:'Y
66 ..S DIC=WPROOT,DIC(0)="QEM",D="B" D DQ^DICQ
67 ..Q
68 .Q
69 I VAL'[":",'FILE S MSG="SELECT FILE TO TRANSFER FROM" D Q0 G Z0
70 I VAL[":" D PRSREL I MSG]"" D Q0 G Z0
71 D DIC I MSG]"" D Q0 G Z0
72 I FILE=3.9 S Y=+IENS D XM(.Y) Q:'Y S IENS=+Y_","
73 D GET1 I MSG]"" D Q0 G Z0
74 S DWAFT=U D F
75 Q
76RT(DIROOT,DIARR) ;
77 N QL,CROOT,FILE,GL,OK,RT,TOPFILE
78 Q:$G(DIROOT)=""
79 S CROOT=$NA(@$$CREF^DILF(DIROOT))
80 S:$G(DIARR)="" DIARR=$NA(^TMP($J,DIROOT))
81 K @DIARR
82 ;
83 S QL=$QL(CROOT)
84 I QL>1 D
85 . S RT=$NA(@CROOT,QL-2),FILE=+$P($G(@RT@(0)),U,2),RT=$$OREF^DILF(RT)
86 . I FILE,$D(^DD(FILE,0))#2 D
87 .. S TOPFILE=$$FNO^DILIBF(FILE)
88 .. I TOPFILE D
89 ... S GL=$G(^DIC(TOPFILE,0,"GL"))
90 ... I GL]"",RT[GL S OK=1 D RT1
91 S:'$G(OK) @DIARR=U
92 Q
93RT1 ;
94 N %,FLD,IENS,NOD,X,Y
95 S @DIARR@("FILE")=FILE
96 S @DIARR@("TOPFILE")=TOPFILE
97 S @DIARR@("ROOT")=RT
98 ;
99 S NOD=$QS(CROOT,QL),FLD=$O(^DD(FILE,"GL",NOD,0,""))
100 I FLD,$P($P($G(^DD(FILE,FLD,0)),U,4),";")=NOD S @DIARR@("FLDNO")=FLD
101 ;
102 S IENS="" F %=QL-3:-2:1 S IENS=IENS_$QS(CROOT,%)_","
103 S @DIARR@("IENS")=IENS
104 Q
105 ;
106PRSREL N X,FTYPE,T,M,W,I,FI,FD,WPRT S X=VAL
107 S T=$F(X," IN ") I T S X=$E(X,1,T-5),W=":",M=T-4,I=X_W_$E(VAL,T,999),T=$F(I," FILE",M) S:T&$F(W,$E(I,T)) I=$E(I,1,T-6)_$E(I,T,999) S X=I
108 S VAL=$P(X,":"),FI=$P(X,":",2),FD=$P(X,":",3)
109 I 'VAL,VAL'?1"`".N,VAL'?1"""".E1"""" S MSG="INVALID SYNTAX" Q
110 I $E(VAL)=$C(34) D
111 . I VAL?3"""".E3"""" S @("VAL="_VAL) Q
112 . S VAL=$E(VAL,2,$L(VAL)-1)
113 S FI=$S(FI="":0,FI&($G(^DIC(FI,0))]""):FI,FI'?.N:$O(^DIC("B",FI,"")),1:0)
114 I 'FI S MSG="INVALID FILE" Q
115 D DIAC I 'FI S MSG="NO READ ACCESS TO FILE" Q
116 S FD=$S(FD:FD,FD'?.N:$O(^DD(FI,"B",FD,"")),1:0)
117 I 'FD!('$D(^DD(FI,+FD,0))) S MSG="INVALID FIELD" Q
118 I FD S FTYPE=$P($G(^DD(+$P($G(^DD(FI,FD,0)),U,2),.01,0)),U,2) I FTYPE'["W" S MSG="NOT A WORD PROCESSING FLD" Q
119 I FTYPE["L" D
120 .N DIR,X,Y
121 .W $C(7),!!,"WARNING!",!,"The field you are transferring text from displays text without wrapping."
122 .W !,"The field you are transferring text into may display text differently."
123 .W !!,"Do you want to continue?",! N X,Y,DIR S DIR(0)="Y" D ^DIR
124 .W ! S:'Y MSG="TEXT TRANSFER CANCELLED" Q
125 S:MSG="" FILE=FI,FLD=FD,WPROOT=$G(^DIC(FI,0,"GL")) Q
126DIC N X,DIC,Y
127 S DIC=WPROOT,X=VAL,DIC(0)="QEM" D ^DIC
128 I Y<0 S MSG="NO RECORD FOUND" Q
129 I IENS]"" S IENS=+Y_","_IENS
130 E S IENS=+Y_","
131 Q
132GET1 N X K ^TMP($J,"DIWE3")
133 S X=$$GET1^DIQ(FILE,IENS,FLD,"Z","^TMP($J,""DIWE3"")")
134 I $D(^TMP($J,"DIWE3")) Q
135 S MSG="NO TEXT TO TRANSFER FROM"
136 Q
137NW N DIR,X,Y
138 W $C(7),!!,"WARNING!",!,"The field you are transferring text from displays text without wrapping."
139 W !,"The field you are transferring text into may display text differently."
140 W !!,"Do you want to continue?",! N X,Y,DIR S DIR(0)="Y" D ^DIR
141 W ! S:'Y MSG="TEXT TRANSFER CANCELLED" Q
142Q0 W " <"_MSG_">",$C(7) Q
143DIAC I FI=3.9 Q
144 N DIAC,DIFILE
145 S DIAC="RD",DIFILE=FI
146 D ^DIAC S:'DIAC FI=0
147 Q
148XM(Z) N %,A9,XMZ,ARR,MSG,A1
149 S A1=Z
150% W !,"Transfer which Response: Original Message// " R A9:DTIME I A9[U S MSG="TEXT TRANSFER CANCELLED",Z=0 D Q0 Q
151 I A9?1."?" S XMZ=+Z D ENT8^XMAH S Z=A1 G %
152 I A9=""!(A9=0)!(A9="O") Q
153 I A9 D Q:Z
154 . N A0 S %=$$HDR^XMGAPI2(+Y,.ARR,9) S A0=$G(ARR("RSP",A9))
155 . I A0 S Z=A0 Q
156 . S MSG="INVALID RESPONSE",Z=0 D Q0
157 S Z=A1 G %
Note: See TracBrowser for help on using the repository browser.