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

ADEDCLK.m

Go to the documentation of this file.
ADEDCLK ;IHS/HQW/MJL - DICTIONARY ENTRY LOOK-UP UTILITY  [ 03/24/1999   8:35 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;IHS/HMW RENAMESPACED FROM AUDICLK
 N ADEDRNT1,ADEDNT,ADEG,ADEGLL,ADELKH,ADESUB,ADEDNTT,ADEGG,ADELK,ADEDRENT,ADEGGG,ADEPC
L1 N ADEPCC,ADEGL,ADEDENT,ADENEW G END:'$D(DR)!'$D(DIC)!'$D(DA) S ADELK("I")=1,DIC(1)=DIC,DR(1)=DR G END:+DR<.01!(+DIC<1)!(+DA<1)
 I $D(^DD(DIC,DR,0)) S ADEG=^DD(DIC,DR,0) G COMP:$P(ADEG,"^",2)["C" I +$P(ADEG,"^",2)>0 S ADELKERR=5 G END
L2 I '$D(^DD(DIC(ADELK("I")),DR(ADELK("I")),0)) S ADELKERR=3 G END
 S ADESUB=$P(^DD(DIC(ADELK("I")),DR(ADELK("I")),0),"^",4),ADEPC(ADELK("I"))=$P(ADESUB,";",2),ADESUB(ADELK("I"))=$P(ADESUB,";",1) I '$D(^DD(DIC(ADELK("I")),0,"UP")) G L4
L3 S ADELKERR=4 S:$D(ADEDRNT1) ADEDRENT=0 G END:'$D(ADEDRENT) G END:ADEDRENT'="0"&(+ADEDRENT<0) G END:ADEDRENT\1'=ADEDRENT S:ADEDRENT=0 ADENEW="" K ADELKERR
 S ADELK("I")=ADELK("I")+1,DIC(ADELK("I"))=^DD(DIC(ADELK("I")-1),0,"UP"),DR(ADELK("I"))=0,DR(ADELK("I"))=$O(^DD(DIC(ADELK("I")),"SB",DIC(ADELK("I")-1),DR(ADELK("I")))) G L2
L4 S ADEGL=^DIC(DIC(ADELK("I")),0,"GL")_DA,ADEGL(1)=ADEGL_",0)" I '$D(@ADEGL(1)) S ADELKERR=1 G END
 I ADELK("I")=1 K:$D(ADEDRENT) ADEDRENT G L5
 F ADELK("J")=ADELK("I"):-1:2 S ADEGL=ADEGL_","_ADESUB(ADELK("J")) S:ADELK("J")>2 ADEGL=ADEGL_",1"
L5 S ADEPCC=ADEPC(1) I '$D(ADEDRENT) S ADEDRENT="" G L6
L5A S ADEGL(0)=ADEGL_",0)" I '$D(@ADEGL(0)) S ADELKERR=6,ADEGL=ADEGL_",1,0)" G END
L5B S ADEDENT=$P(@ADEGL(0),"^",4) S:ADEDENT="" ADEDENT=0 I ADEDENT=0!(ADEDRENT>ADEDENT) S ADELKERR=2 G END
L5BB I $D(ADEDRNT1) D DNT4 G L5E:ADEDNT'="" S ADELKERR=2 G END
L5C I ADEDRENT>0 D DNT2 S ADEDRENT=ADEDNT G L5E:ADEDNTT>0 S ADELKERR=2 G END
L5D S ADEGL(0)=ADEGL_",0)" D DNT
L5E S ADEDRENT=","_ADEDRENT
L6 S ADEGL=ADEGL_ADEDRENT_","_ADESUB(1)_")" I ADEGL[",," S ADELKERR=2,ADENEW="" G END
 I '$D(@ADEGL) S ADELKERR=2,ADENEW="" G END
L6A S (ADELKPRN,ADELKDAT)=$P(@ADEGL,"^",ADEPC(1)) G END:ADELKPRN=""
L7 S ADEGG=$P(ADEG,"^",2),ADELK("H")=$P(ADEG,"^",3) G SET:ADEGG["S",DATE:ADEGG["D",PTR:ADEGG["P",TRX:$D(^DD(DIC(1),DR(1),2))
END K ADEDRENT,ADEDRNT1,D0,ADEDNT,ADEDNTT,ADELK,ADELKH,ADEGG,ADEGGG,ADEGLL,ADESUB,ADEPC,ADEDENT,ADEG,ADEGL
 S:'$D(ADELKPRN)&'$D(ADELKERR) ADELKERR=0
 Q
DNT S ADEDNT=0
DNT1 S ADEGLL=ADEGL_",DNT)",ADEDNT=$O(@ADEGLL) Q:ADEDNT'=+ADEDNT  S ADEDRENT=ADEDNT G DNT1
DNT2 S (ADEDNT,ADEDNTT)=0
DNT3 S ADEGLL=ADEGL_",DNT)",ADEDNT=$O(@ADEGLL) Q:ADEDNT=""  S ADEDNTT=ADEDNTT+1 Q:ADEDNTT=ADEDRENT  G DNT3
DNT4 S ADEDNT=0
DNT5 S ADEGLL=ADEGL_",DNT)",ADEDNT=$O(@ADEGLL) Q:ADEDNT=""  S:ADEDNT=ADEDRNT1 ADEDRENT=ADEDNT Q:ADEDRENT=ADEDNT  G DNT5
SET F ADELK("I")=1:1 S ADEGGG=$P(ADELK("H"),";",ADELK("I")) G END:ADEGGG="" S:$P(ADEGGG,":",1)=ADELKDAT ADELKPRN=$P(ADEGGG,":",2)
 G END
DATE S Y=ADELKDAT X ^DD("DD") S ADELKPRN=Y G END
PTR S ADEGGG="^"_ADELK("H")_ADELKDAT_",0)" I '$D(@ADEGGG) S ADELKERR=7 G END
 S ADELKPRN=$P(@ADEGGG,"^",1) G END
COMP S ADELKH=$E($P(ADEG,";",2),3,999),D0=DA X ADELKH S ADELKPRN=X G END
TRX S Y=ADELKDAT X ^DD(DIC(1),DR(1),2) S ADELKPRN=Y G END