GMTSRM4 ;SLC/JER,DLT - Create/Modify - Ins/Apnd/Del Comp ; 08/27/2002
;;2.7;Health Summary;**56**;Oct 20, 1995
;
; External References
; DBIA 10013 ^DIK (file #142)
;
INSRT ; Sets Summary Order to Insert Prior to Existing Node
N LO,NO S (NO,LO)=0 F S NO=$O(^GMT(142,GMTSIFN,1,NO)) Q:NO=SO S LO=NO
S CMP(.01)=+$J(((SO-LO)/2+LO),0,3),CMP(0)="^"_$P($G(CMP(0)),U,2,5),GMTSNEW=1
I '$D(^GMT(142,GMTSIFN,1,CMP(.01),0)) S CMP(.01)=CMP(.01)
W !,"Inserted as SUMMARY ORDER: ",CMP(.01)_" "_CMP("NM")
Q
APPND ; Sets Summary Order to Insert After Existing Node
N NO S NO=$O(^GMT(142,GMTSIFN,1,SO)) S CMP(.01)=$S(NO>0:+$J(((NO-SO)/2+SO),0,3),1:SO+5),GMTSNEW=1
I '$D(^GMT(142,GMTSIFN,1,CMP(.01),0)) S CMP(.01)=CMP(.01)
S CMP(0)="^"_$P($G(CMP(0)),U,2,5)
W !,"Appended as SUMMARY ORDER: ",CMP(.01)_" "_CMP("NM")
Q
DELCMP ; Deletes Component from Summary
N DA,DIK S DIK="^GMT(142,"_GMTSIFN_",1,",DA=OLDSO,DA(1)=GMTSIFN
S OLDSO("NM")=$S($D(^GMT(142,GMTSIFN,1,OLDSO,0)):$P(^GMT(142.1,$P(^GMT(142,GMTSIFN,1,OLDSO,0),U,2),0),U,1),1:"")
D ^DIK I SOACTION="D"!(SOACTION="O") W !,$S(SOACTION="O":"Overwriting",1:"Deleting")_" Summary Order "_OLDSO_" "_OLDSO("NM")
S CNT=$$GETCNT^GMTSRM(GMTSIFN)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSRM4 1244 printed Dec 13, 2024@02:00:10 Page 2
GMTSRM4 ;SLC/JER,DLT - Create/Modify - Ins/Apnd/Del Comp ; 08/27/2002
+1 ;;2.7;Health Summary;**56**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 10013 ^DIK (file #142)
+5 ;
INSRT ; Sets Summary Order to Insert Prior to Existing Node
+1 NEW LO,NO
SET (NO,LO)=0
FOR
SET NO=$ORDER(^GMT(142,GMTSIFN,1,NO))
if NO=SO
QUIT
SET LO=NO
+2 SET CMP(.01)=+$JUSTIFY(((SO-LO)/2+LO),0,3)
SET CMP(0)="^"_$PIECE($GET(CMP(0)),U,2,5)
SET GMTSNEW=1
+3 IF '$DATA(^GMT(142,GMTSIFN,1,CMP(.01),0))
SET CMP(.01)=CMP(.01)
+4 WRITE !,"Inserted as SUMMARY ORDER: ",CMP(.01)_" "_CMP("NM")
+5 QUIT
APPND ; Sets Summary Order to Insert After Existing Node
+1 NEW NO
SET NO=$ORDER(^GMT(142,GMTSIFN,1,SO))
SET CMP(.01)=$SELECT(NO>0:+$JUSTIFY(((NO-SO)/2+SO),0,3),1:SO+5)
SET GMTSNEW=1
+2 IF '$DATA(^GMT(142,GMTSIFN,1,CMP(.01),0))
SET CMP(.01)=CMP(.01)
+3 SET CMP(0)="^"_$PIECE($GET(CMP(0)),U,2,5)
+4 WRITE !,"Appended as SUMMARY ORDER: ",CMP(.01)_" "_CMP("NM")
+5 QUIT
DELCMP ; Deletes Component from Summary
+1 NEW DA,DIK
SET DIK="^GMT(142,"_GMTSIFN_",1,"
SET DA=OLDSO
SET DA(1)=GMTSIFN
+2 SET OLDSO("NM")=$SELECT($DATA(^GMT(142,GMTSIFN,1,OLDSO,0)):$PIECE(^GMT(142.1,$PIECE(^GMT(142,GMTSIFN,1,OLDSO,0),U,2),0),U,1),1:"")
+3 DO ^DIK
IF SOACTION="D"!(SOACTION="O")
WRITE !,$SELECT(SOACTION="O":"Overwriting",1:"Deleting")_" Summary Order "_OLDSO_" "_OLDSO("NM")
+4 SET CNT=$$GETCNT^GMTSRM(GMTSIFN)
+5 QUIT