Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DIVU

DIVU.m

Go to the documentation of this file.
  1. DIVU ;SFISC/DCM-VERIFY FIELDS UTILITIES ;8/1/95 1:02 PM
  1. ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
  1. ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
  1. ;;Licensed under the terms of the Apache License, Version 2.0.
  1. ;
  1. Q
  1. DE(FI,FD,N,G,S) ;
  1. Q:'$D(^DD($G(FI),0)) I $G(FD) Q:'$D(^(FD,0))
  1. I $G(G)']"" S G="DE"
  1. N Z,X,Y,%,H,D,I,J,V,K
  1. I $G(^DIC(FI,0))]"" S I(0)=^(0,"GL"),J(0)=+FI,V=0
  1. E D IJ(FI)
  1. S Y=I(0),X=V,H="",Z=0
  1. I +$G(S),V S S=$S('$P(S,U,2):V,1:$P(S,U,2)) S Z=S,X=X-S F %=0:1 S Y=Y_"D"_%_","_I(%+1)_"," I %=(S-1) Q
  1. L S D="D" S D=D_Z S Y=Y_D,H=H_"S "_D_"=0 F ",%="S "_D_"=$O("_Y_"))" I V>1 S @G@(Z)=%,H=H_"X "_G_"("_(Z)_")"
  1. E S H=H_%
  1. S H=H_" Q:"_D_"'>0 "
  1. S X=X-1,Z=Z+1
  1. L1 I X<0 D Q
  1. .I $G(N)]"",$G(FD)]"" D S H=H_" X "_G_"(99)",@G=H,@G@(99)=Y Q
  1. . . N DN,%,%N,%P,%4,Q
  1. . . S Q=";",%=^DD(FI,FD,0),%(2)=$G(^(2)),%4=$P(%,U,4),%N=$P(%4,Q),%P=$P(%4,Q,2)
  1. . . I FD=.001,%P="" S Y="S "_N_"=D"_V Q
  1. . . I %P=" " D CAL Q
  1. . . I $G(%P)]"" S Y=Y_","_%N_")"
  1. . . I %P S DN="$P(",%P="),U,"_%P_")"
  1. . . I $E(%P)="E" S DN="$E(",%P="),"_$E(%P,2,9)_")"
  1. . . I $G(DN)="" Q
  1. . . S Y="S "_N_"="_DN_"$G("_Y_%P
  1. . . I %(2)]"",$P(%,U,2)["O",$P(%,U,2)'["D" S Y=Y_",Y="_N_" "_%(2)_" S "_N_"=Y"
  1. . . Q
  1. . S @G=H Q
  1. S Y=Y_","_I(V-X)_"," G L
  1. ;
  1. CAL S Y=$P(%,U,5,99)_" S "_N_"=X" Q
  1. Q
  1. IJ(FI) ;set I( and J( and V=level
  1. Q:'$D(^DD($G(FI),0))
  1. N X,Y,S,Q,F S X=0,(S,Y)=FI,Q="""" F Q:'$D(^DD(Y,0,"UP")) S X=X+1,Y=^("UP")
  1. S V=X I X'=0 F X=X:-1 S Y=$G(^DD(S,0,"UP")) Q:'Y S F=$O(^DD(Y,"SB",S,0)) Q:'F S I(X)=$P($P($G(^DD(Y,F,0)),U,4),";"),K(X)=$O(^DD(S,0,"NM","")),J(X)=S,S=Y S:I(X)'=+I(X) I(X)=Q_I(X)_Q
  1. S I(0)=$G(^DIC(S,0,"GL")),J(0)=S
  1. Q
  1. DA(Z) ;convert D0,D1... to DA()
  1. N A,B,C,D K Z
  1. F A=0:1 S D="D"_A Q:'$D(@D)
  1. S C=0,A=A-1 F B=A:-1:0 S Z(B)=@("D"_C),C=C+1
  1. S Z=Z(0) K Z(0)
  1. Q
  1. DIBT(X,%,S) ;lookup sort template, return template's IEN
  1. N DIC,Y
  1. S X=$E(X,2,$L(X)-1),DIC="^DIBT(",DIC("S")="I $P(^(0),U,4)="_S,DIC(0)="ZM" D ^DIC
  1. S %=+Y
  1. Q