GMRGPNB1 ;HIRMFO/RM-SENTENCE BUILDER ;1/23/96
;;3.0;Text Generator;;Jan 24, 1996
SNT ;
S GMRGSNT(1)=GMRGA0,(GMRGSPTR("C"),GMRGSPTR)=1,GMRGSPTR("P",1)=0
S GMRGSNT(1,"LEAD")=$S($D(^GMRD(124.2,GMRGA0,4)):^(4),1:""),GMRGSNT(1,"TRAIL")=$S($D(^GMRD(124.2,GMRGA0,5)):^(5),1:""),GMRGSNT(1,"SUB")=0,GMRGSNT(1,0)=$S($D(^GMRD(124.2,GMRGA0,0)):^(0),1:"")
S GMRGF0(0)=GMRGA0
F GMRGF0=0:0 S GMRGF0=$O(^GMRD(124.2,GMRGA0,1,"B",GMRGF0)) Q:GMRGF0'>0 I $S(GMRGCSW&'$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$D(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$D(^GMR(124.3,GMRGPDA,1,"B",GMRGF0))) D SNT1
F GMRGSNT=0:0 S GMRGSNT=$O(GMRGSNT(GMRGSNT)) Q:GMRGSNT'>0 I $O(GMRGSNT(GMRGSNT,0))!($P(GMRGSNT(GMRGSNT,0),"^",2)=3) D SNTP^GMRGPNB2
S GMRGSSW=0
Q
SNT1 ;
I GMRGF0(0) Q:'$D(^GMRD(124.2,"AKID",GMRGF0,GMRGF0(0)))
S GMRGC0=GMRGF0 N GMRGF0 S GMRGF0(0)=GMRGC0
S GMRGE0(4)=$S($D(^GMRD(124.2,GMRGC0,4)):^(4),1:""),GMRGE0(5)=$S($D(^GMRD(124.2,GMRGC0,5)):^(5),1:""),GMRGE0(0)=$S($D(^GMRD(124.2,GMRGC0,0)):^(0),1:"")
I (GMRGE0(4)=""&(GMRGE0(5)="")) D INSERT Q
S GMRGSPTR=GMRGSPTR+1,GMRGSPTR("P",GMRGSPTR)=GMRGSPTR("C"),GMRGSPTR("C")=GMRGSPTR,GMRGSNT(GMRGSPTR("C"))=GMRGF0(0),GMRGSNT(GMRGSPTR("C"),"LEAD")=GMRGE0(4),GMRGSNT(GMRGSPTR("C"),"TRAIL")=GMRGE0(5),GMRGSNT(GMRGSPTR("C"),"SUB")=0
S GMRGSNT(GMRGSPTR("C"),0)=GMRGE0(0)
F GMRGF0=0:0 S GMRGF0=$O(^GMRD(124.2,GMRGF0(0),1,"B",GMRGF0)) Q:GMRGF0'>0 D
. Q:'$$ALIST^GMRGRUT0(GMRGPDA,GMRGF0(0),GMRGF0)
. I $S(GMRGCSW&'$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$D(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$D(^GMR(124.3,GMRGPDA,1,"B",GMRGF0))) D SNT1
. Q
S GMRGSPTR("C")=GMRGSPTR("P",GMRGSPTR("C"))
Q
INSERT ;
S GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")=0
S GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE")=$S($D(GMRGSNT(GMRGSPTR("C"),"INS"))#2:GMRGSNT(GMRGSPTR("C"),"INS"),1:0),GMRGSNT(GMRGSPTR("C"),"INS")=GMRGF0(0)
F GMRGF0=0:0 S GMRGF0=$O(^GMRD(124.2,GMRGF0(0),1,"B",GMRGF0)) Q:GMRGF0'>0 I $S(GMRGCSW&'$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$D(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$D(^GMR(124.3,GMRGPDA,1,"B",GMRGF0))) D INS1
I 'GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE") D INSTRM
I 'GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE") K GMRGSNT(GMRGSPTR("C"),"INS")
E S GMRGSNT(GMRGSPTR("C"),"INS")=GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE") K GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0))
Q
INS1 ;
Q:'$D(^GMRD(124.2,"AKID",GMRGF0,GMRGF0(0))) S GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")=GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")+1
D SNT1
Q
INSTRM ;
S GMRGSNT(GMRGSPTR("C"),"SUB")=GMRGSNT(GMRGSPTR("C"),"SUB")+1,GMRGSNT(GMRGSPTR("C"),GMRGSNT(GMRGSPTR("C"),"SUB"))=GMRGF0(0)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRGPNB1 2683 printed Oct 16, 2024@17:56:08 Page 2
GMRGPNB1 ;HIRMFO/RM-SENTENCE BUILDER ;1/23/96
+1 ;;3.0;Text Generator;;Jan 24, 1996
SNT ;
+1 SET GMRGSNT(1)=GMRGA0
SET (GMRGSPTR("C"),GMRGSPTR)=1
SET GMRGSPTR("P",1)=0
+2 SET GMRGSNT(1,"LEAD")=$SELECT($DATA(^GMRD(124.2,GMRGA0,4)):^(4),1:"")
SET GMRGSNT(1,"TRAIL")=$SELECT($DATA(^GMRD(124.2,GMRGA0,5)):^(5),1:"")
SET GMRGSNT(1,"SUB")=0
SET GMRGSNT(1,0)=$SELECT($DATA(^GMRD(124.2,GMRGA0,0)):^(0),1:"")
+3 SET GMRGF0(0)=GMRGA0
+4 FOR GMRGF0=0:0
SET GMRGF0=$ORDER(^GMRD(124.2,GMRGA0,1,"B",GMRGF0))
if GMRGF0'>0
QUIT
IF $SELECT(GMRGCSW&'$DATA(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$DATA(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$DATA(^GMR(124.3,GMRGPDA,1,"B",GMRGF0)))
DO SNT1
+5 FOR GMRGSNT=0:0
SET GMRGSNT=$ORDER(GMRGSNT(GMRGSNT))
if GMRGSNT'>0
QUIT
IF $ORDER(GMRGSNT(GMRGSNT,0))!($PIECE(GMRGSNT(GMRGSNT,0),"^",2)=3)
DO SNTP^GMRGPNB2
+6 SET GMRGSSW=0
+7 QUIT
SNT1 ;
+1 IF GMRGF0(0)
if '$DATA(^GMRD(124.2,"AKID",GMRGF0,GMRGF0(0)))
QUIT
+2 SET GMRGC0=GMRGF0
NEW GMRGF0
SET GMRGF0(0)=GMRGC0
+3 SET GMRGE0(4)=$SELECT($DATA(^GMRD(124.2,GMRGC0,4)):^(4),1:"")
SET GMRGE0(5)=$SELECT($DATA(^GMRD(124.2,GMRGC0,5)):^(5),1:"")
SET GMRGE0(0)=$SELECT($DATA(^GMRD(124.2,GMRGC0,0)):^(0),1:"")
+4 IF (GMRGE0(4)=""&(GMRGE0(5)=""))
DO INSERT
QUIT
+5 SET GMRGSPTR=GMRGSPTR+1
SET GMRGSPTR("P",GMRGSPTR)=GMRGSPTR("C")
SET GMRGSPTR("C")=GMRGSPTR
SET GMRGSNT(GMRGSPTR("C"))=GMRGF0(0)
SET GMRGSNT(GMRGSPTR("C"),"LEAD")=GMRGE0(4)
SET GMRGSNT(GMRGSPTR("C"),"TRAIL")=GMRGE0(5)
SET GMRGSNT(GMRGSPTR("C"),"SUB")=0
+6 SET GMRGSNT(GMRGSPTR("C"),0)=GMRGE0(0)
+7 FOR GMRGF0=0:0
SET GMRGF0=$ORDER(^GMRD(124.2,GMRGF0(0),1,"B",GMRGF0))
if GMRGF0'>0
QUIT
Begin DoDot:1
+8 if '$$ALIST^GMRGRUT0(GMRGPDA,GMRGF0(0),GMRGF0)
QUIT
+9 IF $SELECT(GMRGCSW&'$DATA(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$DATA(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$DATA(^GMR(124.3,GMRGPDA,1,"B",GMRGF0)))
DO SNT1
+10 QUIT
End DoDot:1
+11 SET GMRGSPTR("C")=GMRGSPTR("P",GMRGSPTR("C"))
+12 QUIT
INSERT ;
+1 SET GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")=0
+2 SET GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE")=$SELECT($DATA(GMRGSNT(GMRGSPTR("C"),"INS"))#2:GMRGSNT(GMRGSPTR("C"),"INS"),1:0)
SET GMRGSNT(GMRGSPTR("C"),"INS")=GMRGF0(0)
+3 FOR GMRGF0=0:0
SET GMRGF0=$ORDER(^GMRD(124.2,GMRGF0(0),1,"B",GMRGF0))
if GMRGF0'>0
QUIT
IF $SELECT(GMRGCSW&'$DATA(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$DATA(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$DATA(^GMR(124.3,GMRGPDA,1,"B",GMRGF0)))
DO INS1
+4 IF 'GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")
DO INSTRM
+5 IF 'GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE")
KILL GMRGSNT(GMRGSPTR("C"),"INS")
+6 IF '$TEST
SET GMRGSNT(GMRGSPTR("C"),"INS")=GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE")
KILL GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0))
+7 QUIT
INS1 ;
+1 if '$DATA(^GMRD(124.2,"AKID",GMRGF0,GMRGF0(0)))
QUIT
SET GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")=GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")+1
+2 DO SNT1
+3 QUIT
INSTRM ;
+1 SET GMRGSNT(GMRGSPTR("C"),"SUB")=GMRGSNT(GMRGSPTR("C"),"SUB")+1
SET GMRGSNT(GMRGSPTR("C"),GMRGSNT(GMRGSPTR("C"),"SUB"))=GMRGF0(0)
+2 QUIT