source: FOIAVistA/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XTVRC1.m@ 1608

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

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1XTVRC1 ; ISCSF/JLI ** SAVE AND COMPARE ROUTINES ;12/7/93 13:56 ;4/27/88 1:34 PM
2 ;;7.3;TOOLKIT;;Apr 25, 1995
3 K ^TMP($J)
4 K ^TMP($J) X ^%ZOSF("RSEL") G:$O(^UTILITY($J,""))="" KILL S %X="^UTILITY($J,",%Y="^TMP($J," D %XY^%RCR K ^UTILITY($J)
5ASK R !!?5,"Do you want to QUEUE this job? YES// ",X:DTIME W ! G:'$T!(X[U) KILL S:X="" X="Y" S X=$E(X) I "YyNn"'[X W $C(7)," ??",!,"ANSWER 'YES' OR 'NO'",! G ASK
6 I "Yy"[X S ZTIO="",ZTRTN="DQ^XTVRC1",ZTDESC="XTVRC1-RECORD ROUTINE CHANGES",ZTSAVE("^TMP($J,")="" D ^%ZTLOAD K ZTIO,ZTRTN,ZTDESC,ZTSAVE,^TMP($J) G KILL
7DQ ;
8 S X="N",%DT="T" D ^%DT S XTVTIM=Y
9 S XTROU=0 F XTIROU=0:0 S XTROU=$O(^TMP($J,XTROU)) Q:XTROU="" D LCHEK I L D LOOP
10KILL K XTVTIM,XTROU,XTIROU,XCNP,DIF,%,%DT,%Y,%GO,%H,%N,%UCN,DA,DLAYGO,I,J,L,X,Y,DIC,^TMP($J)
11 Q
12 ;
13LCHEK ;S L=$L(XTROU),L=$S(L<6:1,$E(XTROU,L-3,L)="INIT":0,$E(XTROU,L-4,L)?1"INIT"1N:0,$E(XTROU,L-3,L)?1"INI"1N:0,L<8:1,$E(XTROU,L-2,L)'?3N:1,$E(XTROU,5,8)?1"I"3N:0,$E(XTROU,4,8)?1"IN"3N:0,$E(XTROU,3,8)?1"INI"3N:0,1:1)
14 ;S L=$L(XTROU),L=$S(L<6:1,$E(XTROU,L-3,L)?1"INI"1(1"T",1"S",1N):0,$E(XTROU,L-3,L)?1"I"1(1"N",1N)2NU:0,$E(XTROU,L-4,L)?1"IN"1(1"I",1N)2NU:0,$E(XTROU,L-4,L)?1"INI"1(1"T",1"N")2NU:0,1:1)
15 S L=$L(XTROU) I L<6 S L=1 Q
16 S XX=$E(XTROU,L-3,L) I XX?1"INIT"!(XX?1"INIS")!(XX?1"INI"1N) S L=0 K XX Q
17 I XX?1"IN"2NU!(XX?1"I"1N2NU) S L=0 K XX Q
18 S XX=$E(XTROU,L-4,L) I XX?1"INI"2NU!(XX?1"IN"1N2NU)!(XX?1"INIT"2NU)!(XX?1"INI"1N2NU) S L=0 K XX Q
19 S L=1 K XX
20 Q
21 ;
22LOOP ;
23 K ^TMP($J,0) S X=XTROU,XCNP=0,DIF="^TMP($J,0," X ^%ZOSF("LOAD") ;XTL1="ZL @XTROU F I=0:1 S X=$T(+I) Q:X="""" S ^TMP($J,0,I)=X" X XTL1
24 I '$D(^XTV(8991,"B",XTROU)) S X=""""_XTROU_"""",DIC(0)="XL",DIC=8991,DLAYGO=8991 D ^DIC Q:Y'>0
25 S DA=$O(^XTV(8991,"B",XTROU,0)) Q:DA'>0
26 S I=0 F J=0:0 S J=$O(^XTV(8991,DA,1,J)) Q:J'>0 S I=J
27 I I>0 D CHK I I=0 Q
28 S XTLL=I,X=XTVTIM,DIC="^XTV(8991,"_DA_",1,",DIC("P")=8991.01,DIC(0)="L",DLAYGO=8991,DA(1)=DA S:'$D(@(DIC_"0)")) @(DIC_"0)")="^8991.01" D ^DIC S DA=+Y Q:DA'>0
29 S DIC="^XTV(8991,"_DA(1)_",1,"_DA_",1,"
30 F I=0:0 S I=$O(^TMP($J,0,I)) Q:I'>0 S @(DIC_I_",0)")=^(I,0),K=I
31 S ^XTV(8991,DA(1),1,DA,1,0)="^8991.11^"_K_"^"_K
32 I XTLL>0 S I=XTLL D CHKA
33 K DA,DIC,I,J,XTJJ,XTJL,K,XTKK,L,XTL1,XTLL,M,P,V,X,Y
34 Q
35 ;
36CHK ;
37 S DIC="^XTV(8991,"_DA_",1,"_I_",1,"
38 F J=0:0 S J=$O(^TMP($J,0,J)) Q:J'>0 Q:'$D(@(DIC_J_",0)")) Q:^(0)'=^TMP($J,0,J,0)
39 I J'>0 S I=0 Q
40 Q
41 ;
42CHKA ;
43 S DIC="^XTV(8991,"_DA(1)_",1,"_I_",1,"
44 S L=1 F J=0:0 S J=$O(^TMP($J,0,J)) Q:J'>0 Q:'$D(@(DIC_L_",0)")) S M=0 S:^(0)'=^TMP($J,0,J,0) M=1 D:M CHK1 I 'M K @(DIC_L_",0)") S L=L+1
45 I J'>0 F J=0:0 Q:'$D(@(DIC_L_",0)")) D LDEL
46 I J>0 F J=J-1:0 S J=$O(^TMP($J,0,J)) Q:J'>0 D JADD
47 S L=0 F J=0:0 S J=$O(^XTV(8991,DA,1,I,1,J)) Q:J'>0 S L(0)=J,L=L+1
48 I L>0 S ^XTV(8991,DA,1,I,1,0)="^8991.11^"_L(0)_"^"_L
49 Q
50 ;
51CHK1 ;
52 S XTDONE=0
53 F XTJJ=J:0 S XTJJ=$O(^TMP($J,0,XTJJ)) Q:XTJJ'>0 I ^(XTJJ,0)=@(DIC_L_",0)") D CHK2 Q
54 I 'XTDONE D LDEL S J=J-1
55 K XTDONE
56 Q
57 ;
58CHK2 ;
59 F XTLL=L+1:1 Q:'$D(@(DIC_XTLL_",0)"))!(XTDONE>2) F XTJL=J:0 S XTJL=$O(^TMP($J,0,XTJL)) Q:XTJL'>0!(XTJL'<XTJJ) S XTDONE=$S(^(XTJL,0)=@(DIC_XTLL_",0)"):XTDONE+1,1:0) I XTDONE D CHK3 Q:XTDONE>2 Q:'$D(@(DIC_XTLL_",0)"))
60 I 'XTDONE D JADD
61 S XTDONE='XTDONE
62 Q
63 ;
64CHK3 ;
65 F XTKK=0:0 S XTLL=XTLL+1,XTJL=XTJL+1 S XTDONE=$S('$D(^TMP($J,0,XTJL,0))!'$D(@(DIC_XTLL_",0)")):0,^TMP($J,0,XTJL,0)=@(DIC_XTLL_",0)"):XTDONE+1,1:0) Q:'XTDONE!(XTDONE>2)
66 Q
67 ;
68JADD ;
69 S XTLL=0 F XTJJ=0:0 S XTJJ=$O(@(DIC_L_",""INS"","_XTJJ_")")) Q:XTJJ'>0 S XTLL=XTJJ
70 S XTJJ=XTLL+1,@(DIC_L_",""INS"","_XTJJ_",0)")=^TMP($J,0,J,0)
71 S @(DIC_L_",""INS"",0)")="^8991.12^"_XTJJ_"^"_XTJJ
72 Q
73 ;
74LDEL ;
75 S @(DIC_L_",""DEL"")")=@(DIC_L_",0)") S @(DIC_L_",0)")="" S L=L+1
76 Q
Note: See TracBrowser for help on using the repository browser.