DIO0 ;SFISC/GFT,TKW-BUILD SORT AND SUB-HDR ;28SEP2004 ;;22.0;VA FileMan;**2,23,138,144**;Mar 30, 1999;Build 5 ;Per VHA Directive 2004-038, this routine should not be modified. ; S C=",",Z=Z+1,DE=$P(DN,C,Z)_"=$O("_DI_$P(DN,C,1,Z)_")),DN="_(Z+1) ;22*138 I Z=1,$G(DPP(DJK,"PTRIX"))]"" D DIOO1 . S DE="DIOO1=$O("_DPP(DJK,"PTRIX")_"DIOO1)),DN=1.5,DD00=0" . S DY(1.5)="S DD00=$O("_DPP(DJK,"PTRIX")_"DIOO1,DD00)),DN=2 S:'DD00 DN=1" . I DPP(DJK,"PTRIX")?.E1"""B""," S DY(1.5)=DY(1.5)_" S:DD00&($G(^(+DD00))!('($D(^(+DD00))=1))) DN=1" . Q I DPQ,Z=1,$D(DPP(DJK,"IX")),$O(DPP(DJK,0)) D .S DXIX=$P(DPP(DJK),U) Q:'DXIX S DXIX(DXIX)=U_$P(DPP(DJK,"IX"),U,2)_$S($D(DPP(DJK,"PTRIX")):"DD00,D0",1:DN) .S W=0,%(1)="" F %=0:0 S W=$O(DPP(DJK,W)) Q:'W S %=%+1,%(1)=%(1)_C_"D"_% .S DXIX(DXIX)=DXIX(DXIX)_%(1) .K %,W Q I Z<$G(DPP(0)) S Y=$P($G(DPP(Z+1,"F")),U) I Y]""!($G(DPP(Z+1,"T"))]"") S:+$P(Y,"E")'=Y Y=""""_Y_"""" S DE=DE_","_$P(DN,C,Z+1)_"="_Y I 'DPQ,$D(DPP(Z)) D H I DPQ,Z=DD S DE=DE_" S:D0 DISTP=DISTP+1 D:'(DISTP#100) CSTP"_$P("^DIO2",1,$D(DIBTPGM))_" Q:'DN " S X=DE_" I "_$P(DN,C,Z)_$S(DD=Z:"'>0",1:"=""""") S Y="" D .I Z=1,$D(DPP(DJK,"T")),$D(DPP(DJK,"IX")) S Y=$P(DPP(DJK,"T"),U) .I $G(DPP(0)),Z<(DPP(0)+1) S Y=$P($G(DPP(Z,"T")),U) .I Y]"",Y'="@",Y'="z" S X=X_"!("_$$AFT^DIOC($P(DN,C,Z),Y)_")" .Q D0 S X=X_" S DN="_$S(Z=DD&($D(DPP(DJK,"PTRIX"))):1.5,1:(Z-1)),Y=Z-1 I Z=1 S X=X_",D0=-1" I $D(DPP(DJK,"PTRIX")) S X=X_" K DD00",$P(DN,C,1)="DD00" I 'DPQ,$D(DPP(Y)) S:$P(DPP(Y),U,4)["!" X="DRK=DRK+1,"_X_",DRK=0",DRK=0 D SUB S DY(Z)="S "_X I $D(DIBTPGM) D . S DY(Z)=$S(Z'=1:"DY"_Z,1:"EN")_" Q:'DN "_DY(Z)_$S(Z=1:" Q",Z=2&($D(DPP(DJK,"PTRIX"))):" G DYP",Z=2:" G EN",1:" G DY"_(Z-1)) . I $D(DPP(DJK,"PTRIX")),Z=1 S DY(1.5)="DYP Q:'DN "_DY(1.5)_" G:DN=1 EN" . Q G DIO0:Z