%AUCNODE ; COUNT ENTRIES IN GLOBAL NODE [ 02/20/87 9:17 AM ]
;
W !!,"This program counts unique values in a global node.",!
LOOP ;
R !,"Enter global reference like '^DPT(""B"",' ",GBL Q:GBL=""
S:$E(GBL,$L(GBL))=")" GBL=$E(GBL,1,$L(GBL)-1)
S:$E(GBL)'="^" GBL="^"_GBL
S:$F(GBL,"(")<1 GBL=GBL_"("
I $E(GBL,$L(GBL))'=",",$E(GBL,$L(GBL)-1)'="(",$E(GBL,$L(GBL))'="(" S GBL=GBL_","
S %CC=0,NXT="" F L=0:0 X "S NXT=$O("_GBL_"NXT))" Q:NXT="" S %CC=%CC+1 W "."
W !!,"Count for ",GBL," is ",%CC,!
G LOOP
%AUCNODE ; COUNT ENTRIES IN GLOBAL NODE [ 02/20/87 9:17 AM ]
+1 ;
+2 WRITE !!,"This program counts unique values in a global node.",!
LOOP ;
+1 READ !,"Enter global reference like '^DPT(""B"",' ",GBL
IF GBL=""
QUIT
+2 IF $EXTRACT(GBL,$LENGTH(GBL))=")"
SET GBL=$EXTRACT(GBL,1,$LENGTH(GBL)-1)
+3 IF $EXTRACT(GBL)'="^"
SET GBL="^"_GBL
+4 IF $FIND(GBL,"(")<1
SET GBL=GBL_"("
+5 IF $EXTRACT(GBL,$LENGTH(GBL))'=","
IF $EXTRACT(GBL,$LENGTH(GBL)-1)'="("
IF $EXTRACT(GBL,$LENGTH(GBL))'="("
SET GBL=GBL_","
+6 SET %CC=0
SET NXT=""
FOR L=0:0
XECUTE "S NXT=$O("_GBL_"NXT))"
IF NXT=""
QUIT
SET %CC=%CC+1
WRITE "."
+7 WRITE !!,"Count for ",GBL," is ",%CC,!
+8 GOTO LOOP