GMRGPNB2 ;CISC/RM-SENTENCE BUILDER (cont.) ;2/15/91
;;3.0;Text Generator;;Jan 24, 1996
SNTP ;
S GMRGC0=+GMRGSNT(GMRGSNT) Q:GMRGC0'>0 S GMRGE0=""
S GMRGB0=$O(^GMR(124.3,GMRGPDA,1,"B",GMRGC0,0)) I GMRGB0>0 S GMRGST=GMRGB0,GMRGST(1)=GMRGPDA,GMRGST(2)=$S(GMRGCSW=1:%,1:GMRGPDT) D STAT^GMRGRUT0 S GMRGF0=GMRGSTAT,GMRGST=GMRGB0,GMRGST(1)=GMRGPDA,GMRGST(2)=GMRGPDT D STAT^GMRGRUT0
I GMRGB0>0 S GMRGE0=$S($P(GMRGSTAT,"^",3)=1:"",$P(GMRGSTAT,"^")=$P(GMRGF0,"^"):$P(^GMR(124.3,GMRGPDA,1,GMRGB0,0),"^",2),1:$P(^GMR(124.3,GMRGPDA,1,GMRGB0,2,$P(GMRGSTAT,"^"),0),"^",4))
I S GMRGADD=$S($P(GMRGSTAT,"^",3)=1:"",$P(GMRGSTAT,"^")=$P(GMRGF0,"^"):$S($D(^GMR(124.3,GMRGPDA,1,GMRGB0,"ADD")):"1;"_GMRGB0_";0",1:""),1:$S($D(^GMR(124.3,GMRGPDA,1,GMRGB0,2,$P(GMRGSTAT,"^"),"ADD")):"1;"_GMRGB0_";2;"_$P(GMRGSTAT,"^"),1:""))
S GMRGE0(0)=$S($D(^GMRD(124.2,GMRGC0,0)):^(0),1:"")
S GMRGNAR=GMRGPAR_"^S^"_GMRGSPC_"^^"_GMRGRM,GMRGNAR(0)=$P(GMRGE0(0),"^")_"^"_GMRGE0,GMRGNAR("LEAD")=GMRGSNT(GMRGSNT,"LEAD"),GMRGNAR("TRAIL")=GMRGSNT(GMRGSNT,"TRAIL")_$S($P(GMRGSNT(GMRGSNT,0),"^",2)'=3:"",1:".") D STORETXT^GMRGRUT1
S GMRGJ0=0 F GMRGC0=0:0 S GMRGC0=$O(GMRGSNT(GMRGSNT,GMRGC0)) Q:GMRGC0'>0 D CHILD S GMRGJ0=1
S GMRGSSW=1
Q:'GMRGADD
S GMRGNAR=GMRGPAR_"^T^"_GMRGSPC_"^^"_GMRGRM,GMRGNAR("LEAD")="Additional Text: ",GMRGNAR("TRAIL")=""
S GMRGNAR(0)=$S('$P(GMRGADD,";",3):^GMR(124.3,GMRGPDA,1,$P(GMRGADD,";",2),"ADD"),1:^GMR(124.3,GMRGPDA,1,$P(GMRGADD,";",2),2,$P(GMRGADD,";",4),"ADD")) D STORETXT^GMRGRUT1
Q
CHILD ;
S GMRGH0=+GMRGSNT(GMRGSNT,GMRGC0) Q:GMRGH0'>0 S GMRGE0=""
S GMRGB0=$O(^GMR(124.3,GMRGPDA,1,"B",GMRGH0,0)) I GMRGB0>0 S GMRGST=GMRGB0,GMRGST(1)=GMRGPDA,GMRGST(2)=$S(GMRGCSW=1:%,1:GMRGPDT) D STAT^GMRGRUT0 S GMRGF0=GMRGSTAT,GMRGST=GMRGB0,GMRGST(1)=GMRGPDA,GMRGST(2)=GMRGPDT D STAT^GMRGRUT0
I GMRGB0>0 S GMRGE0=$S($P(GMRGSTAT,"^",3)=1:"",$P(GMRGSTAT,"^")=$P(GMRGF0,"^"):$P(^GMR(124.3,GMRGPDA,1,GMRGB0,0),"^",2),1:$P(^GMR(124.3,GMRGPDA,1,GMRGB0,2,$P(GMRGSTAT,"^"),0),"^",4))
S GMRGE0(0)=$S($D(^GMRD(124.2,GMRGH0,0)):^(0),1:"")
S GMRGNAR=GMRGPAR_"^S^"_GMRGSPC_"^"_$S($O(GMRGSNT(GMRGSNT,GMRGC0)):1,GMRGJ0:2,1:3)_"^"_GMRGRM,GMRGNAR(0)=$P(GMRGE0(0),"^")_"^"_GMRGE0,GMRGNAR("LEAD")="",GMRGNAR("TRAIL")="" D STORETXT^GMRGRUT1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRGPNB2 2238 printed Dec 13, 2024@01:55:27 Page 2
GMRGPNB2 ;CISC/RM-SENTENCE BUILDER (cont.) ;2/15/91
+1 ;;3.0;Text Generator;;Jan 24, 1996
SNTP ;
+1 SET GMRGC0=+GMRGSNT(GMRGSNT)
if GMRGC0'>0
QUIT
SET GMRGE0=""
+2 SET GMRGB0=$ORDER(^GMR(124.3,GMRGPDA,1,"B",GMRGC0,0))
IF GMRGB0>0
SET GMRGST=GMRGB0
SET GMRGST(1)=GMRGPDA
SET GMRGST(2)=$SELECT(GMRGCSW=1:%,1:GMRGPDT)
DO STAT^GMRGRUT0
SET GMRGF0=GMRGSTAT
SET GMRGST=GMRGB0
SET GMRGST(1)=GMRGPDA
SET GMRGST(2)=GMRGPDT
DO STAT^GMRGRUT0
+3 IF GMRGB0>0
SET GMRGE0=$SELECT($PIECE(GMRGSTAT,"^",3)=1:"",$PIECE(GMRGSTAT,"^")=$PIECE(GMRGF0,"^"):$PIECE(^GMR(124.3,GMRGPDA,1,GMRGB0,0),"^",2),1:$PIECE(^GMR(124.3,GMRGPDA,1,GMRGB0,2,$PIECE(GMRGSTAT,"^"),0),"^",4))
+4 IF $TEST
SET GMRGADD=$SELECT($PIECE(GMRGSTAT,"^",3)=1:"",$PIECE(GMRGSTAT,"^")=...
... $PIECE(GMRGF0,"^"):$SELECT($DATA(^GMR(124.3,GMRGPDA,1,GMRGB0,"ADD")):"1;"_GMRGB0_";0",1:""),1:$SELECT($DATA(^GMR(124.3,GMRGPDA,1,GMRGB0,2,$PIECE(GMRGSTAT,"^"),"ADD")):"1;"_GMRGB0_";2;"_$PIECE(GMRGSTAT,"^"),1:""))
+5 SET GMRGE0(0)=$SELECT($DATA(^GMRD(124.2,GMRGC0,0)):^(0),1:"")
+6 SET GMRGNAR=GMRGPAR_"^S^"_GMRGSPC_"^^"_GMRGRM
SET GMRGNAR(0)=$PIECE(GMRGE0(0),"^")_"^"_GMRGE0
SET GMRGNAR("LEAD")=GMRGSNT(GMRGSNT,"LEAD")
SET GMRGNAR("TRAIL")=GMRGSNT(GMRGSNT,"TRAIL")_$SELECT($PIECE(GMRGSNT(GMRGSNT,0),"^",2)'=3:"",1:".")
DO STORETXT^GMRGRUT1
+7 SET GMRGJ0=0
FOR GMRGC0=0:0
SET GMRGC0=$ORDER(GMRGSNT(GMRGSNT,GMRGC0))
if GMRGC0'>0
QUIT
DO CHILD
SET GMRGJ0=1
+8 SET GMRGSSW=1
+9 if 'GMRGADD
QUIT
+10 SET GMRGNAR=GMRGPAR_"^T^"_GMRGSPC_"^^"_GMRGRM
SET GMRGNAR("LEAD")="Additional Text: "
SET GMRGNAR("TRAIL")=""
+11 SET GMRGNAR(0)=$SELECT('$PIECE(GMRGADD,";",3):^GMR(124.3,GMRGPDA,1,$PIECE(GMRGADD,";",2),"ADD"),1:^GMR(124.3,GMRGPDA,1,$PIECE(GMRGADD,";",2),2,$PIECE(GMRGADD,";",4),"ADD"))
DO STORETXT^GMRGRUT1
+12 QUIT
CHILD ;
+1 SET GMRGH0=+GMRGSNT(GMRGSNT,GMRGC0)
if GMRGH0'>0
QUIT
SET GMRGE0=""
+2 SET GMRGB0=$ORDER(^GMR(124.3,GMRGPDA,1,"B",GMRGH0,0))
IF GMRGB0>0
SET GMRGST=GMRGB0
SET GMRGST(1)=GMRGPDA
SET GMRGST(2)=$SELECT(GMRGCSW=1:%,1:GMRGPDT)
DO STAT^GMRGRUT0
SET GMRGF0=GMRGSTAT
SET GMRGST=GMRGB0
SET GMRGST(1)=GMRGPDA
SET GMRGST(2)=GMRGPDT
DO STAT^GMRGRUT0
+3 IF GMRGB0>0
SET GMRGE0=$SELECT($PIECE(GMRGSTAT,"^",3)=1:"",$PIECE(GMRGSTAT,"^")=$PIECE(GMRGF0,"^"):$PIECE(^GMR(124.3,GMRGPDA,1,GMRGB0,0),"^",2),1:$PIECE(^GMR(124.3,GMRGPDA,1,GMRGB0,2,$PIECE(GMRGSTAT,"^"),0),"^",4))
+4 SET GMRGE0(0)=$SELECT($DATA(^GMRD(124.2,GMRGH0,0)):^(0),1:"")
+5 SET GMRGNAR=GMRGPAR_"^S^"_GMRGSPC_"^"_$SELECT($ORDER(GMRGSNT(GMRGSNT,GMRGC0)):1,GMRGJ0:2,1:3)_"^"_GMRGRM
SET GMRGNAR(0)=$PIECE(GMRGE0(0),"^")_"^"_GMRGE0
SET GMRGNAR("LEAD")=""
SET GMRGNAR("TRAIL")=""
DO STORETXT^GMRGRUT1
+6 QUIT