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

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1DIOS ;SFISC/GFT,TKW-BUILD SORT LOGIC ;12:07 PM 5 Aug 1999
2 ;;22.0;VA FileMan;**6**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 D INIT S ^UTILITY($J,"DX")=DX,^("F")="^UTILITY($J,0,"_DCC_U_(DPP+1)
5 F X=-1:0 S X=$O(DX(X)) Q:X="" S ^UTILITY($J,"DX",X)=DX(X)
6C K DX F DL=1:1:DPP S DX=+DPP(DL),V(DX,2)=DL,X=DP,(DPQ,DJ)=0,Z(DL)="" D A S X=999-$P($G(DPP(DL,"SER")),U,2),Y(DPQ,DX,X,$E($P(DPP(DL),U,2,3),1,30))=DL
7 F DL=1:1:DPP D I D5,DE>0,$D(DE(DL))=1 S DE(DL)=DE(DL)-(DE\D5) S:DE(DL)<4 DE(DL)=4
8 .K % S Z=Z(DL)
9U .F %=1:1 S D="",Y=$P(Z,",",%) Q:Y="" D
10 ..S %(%)="D"_V(Y) I $D(V(Y,9)) F I=1:1:%-1 S DIOS=$P(Z,",",I),%(I)="$$SUB^DIOS("_DIOS_")"
11 ..F I=1:1:% S D=D_","_%(I) I I=1 S D=D_","_DL
12 ..S DX(Y,U)=D_"))"
13 K DIOS S I=DP G GO
14 ;
15SUB(F) ;
16 N S,L
17 S L="",S=-1
18 F S L=$O(J(L)) Q:L="" I J(L)=F,$D(I(L,0)) S S=I(L,0) Q
19 Q S
20 ;
21A S W=$D(DPP(DL,X)),V(X)=DJ,Z(DL)=Z(DL)_X_C G ^DIOS1:'W
22 I W=1 S Z=X,V=DPP(DL,X),DJ=DJ+1,DPQ=DPQ+1,X=$O(DPP(DL,X)) S:X="" X=-1 S:+V'=V V=Q_V_Q S:$S($D(^DD(X,0,"UP")):^("UP")-Z,1:1) X=DX K J(DJ,X) S:J'<DJ&$D(J(DJ)) J=DJ-1 S J(DJ,X)=DL,V(X,1)=V,V(X,0)=Z,I(Z,X)=DL G A
23 S W=-1
24O S W=$O(DPP(DL,X,W)) I W="" S X=+V G A
25 S V=DPP(DL,X,W),DJ=W#100,V(+V,9,DL)=W,V(+V,8)=U_$P(V,U,2),DPQ=DPQ+1+DJ,I(X,+V)=DL,J=-1,J(DJ,X)=DL G O
26 ;
27GO K DISETP,DISAVX S X=I,I="" I $D(V(X,2)) S I=" X P("_X_")" I $D(DIBTPGM) S I=" D P"_DICP,DISETP=1
28 I V(X) S W="D"_V(X),I="F "_W_"="_W_":0"_I
29 S DX(X)=I,DPQ=X
30 S DX=X,I=$O(I(X,X)),F=-1 I I="" D I I="" G DIO1
31 . I $D(I)<9 Q:'$D(DIBTPGM) Q:$D(DISAVX(X)) S %=DX(X),%(1)=X,%(2)="DX" D SETU Q
32 . S I=$O(I(X,-1)) Q:I]""
33 . S I=$O(I(DP,-1)) I I]"" S DX=DP Q
34 . S DX=+$O(I(-1)),I=+$O(I(DX,-1))
35 . Q
36 S P=I(DX,I) K I(DX,I) G COLON:$D(V(I,9)) D MULPATH
37 S F="",(DX,%(0))=I,W="D"_V(I),%=DCC S:$D(DXIX(I)) F=DXIX(I) D:F="" GREF^DIOU(.V,.%,.F)
38 S DX(X)=DX(X)_" S "_D2_W_"=$O("_$E(F,1,$L(F)-2)_"0))"_DN_$P(")",U,'$D(DIBTPGM))_D1
39 I $D(DIBTPGM) S %=DX(X),%(1)=X,%(2)="DX" D SETU
40 G GO
41COLON S F=$O(V(I,9,F)) I F="" G GO
42 D MULPATH S DX(X)=DX(X)_$E(" S "_D2,1,$S(D2]"":$L(D2)+2,1:0))_DN I '$D(DIBTPGM) S DX(X)=DX(X)_C_F_")"
43 S DX(X)=DX(X)_D1
44 I $D(DIBTPGM) S %=DX(X),%(1)=X,%(2)="DX" D SETU
45 S DN=DPP(F,DX,V(I,9,F)),V=$P(DN,U,4,99)
46 I $P(DN,U,3) S V="S DIXX="_I_" "_V
47 E S V=V_" S D0=D(0) " D
48 .I '$D(DIBTPGM) S V=V_"X DX("_I_")" Q
49 .S V=V_"D DX"_DICDX
50 .Q
51 S DX(I,F)=V I $D(DIBTPGM) S %=V,%(1)=I_","_F,%(2)="DX" D SETU
52 G COLON
53 ;
54MULPATH S DN=" "_$E("XD",$D(DIBTPGM)+1)_$P(":$T",1,$D(V(X,2)))_" DX" D
55 .I $D(DIBTPGM) S DN=DN_DICDX Q
56 .S DN=DN_"("_I Q
57 S (D1,D2)="" F Z=J+1:1:V(X) S W="D"_Z,D(X)="("_X_C_P_")",%=W_D(X),D2=%_"="_W_C_D2,D1=$S(D1]"":D1_C,1:" S ")_W_"="_%
58 F V=0:1 S Y=$S($D(J(V,X)):X,$O(J(V,-1)):$O(J(V,-1)),1:-1) D:$D(D(Y)) Q:V'<V(X)
59 . I V<V(X) S DN=" S D"_V_"=D"_V_D(Y)_DN
60 . Q:'$D(V(X,9))
61 . S:V=0 DN=" N I,DIXX"_DN
62 . Q:V<V(X)
63 . I $D(V(X,2)) S DN=" S D"_V_"=D"_V_D(Y)_DN
64 . Q
65 Q
66 ;
67SETU ;FILE A LINE TO ^TMP FOR LATER INCLUSION IN ROUTINE
68 Q:%="" N A
69 I %(2)="DX" S A=$S(DICDX=1:"O",1:"DX"_(DICDX-1)),DISAVX(X)=""
70 I %(2)'="DX" S A=%(2)_DICOV,DICOV=DICOV+1
71 S %=A_$E(" ",$E(%)'=" ")_%
72 S ^TMP("DIBTC",$J,%(1),DICNT)=%,^((DICNT+.001))=" Q"
73 S A="DIC"_%(2) S @(A)=@(A)+1,DICNT=DICNT+1
74 I %(2)="DX",$D(DISETP) S DICP(X)=DICP,DICP=DICP+1 K DISETP
75 Q
76 ;
77INIT S:'$D(L) L=1 I $G(IO)=IO(0),L'=0,($G(IOST)=""!($G(IOST)?1"C".E)) D WAIT^DICD
78 S I=^DD("OS",DISYS,0),J=$P(I,U,7),DIOS=$S(J:J,1:63),J=$P(I,U,3),DE=$S(J:J,$G(^DD("SUB")):^("SUB"),1:255)
79 K I,J,Z S J=99,Q="""",DE=DPP*8-DE+23,D5=0
80 Q
81 ;
82DIO1 K %,I,J,P G ^DIO1
Note: See TracBrowser for help on using the repository browser.