XBCNODE ; IHS/ADC/GTH - COUNT ENTRIES IN GLOBAL NODE ; [ 02/07/97 3:02 PM ]
;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
;
; This program counts unique values in a selected global
; node.
;
START ;
NEW GBL,CC,NXT,L
W !!,"This program counts unique values in a global node.",!
LOOP ;
R !,"Enter global reference like '^DPT(""B"",' ",GBL:$G(DTIME,300)
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:'(CC#50) "."
W !!,"Count for ",GBL," is ",CC,!
G LOOP
;
XBCNODE ; IHS/ADC/GTH - COUNT ENTRIES IN GLOBAL NODE ; [ 02/07/97 3:02 PM ]
+1 ;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
+2 ;
+3 ; This program counts unique values in a selected global
+4 ; node.
+5 ;
START ;
+1 NEW GBL,CC,NXT,L
+2 WRITE !!,"This program counts unique values in a global node.",!
LOOP ;
+1 READ !,"Enter global reference like '^DPT(""B"",' ",GBL:$GET(DTIME,300)
+2 IF GBL=""
QUIT
+3 IF $EXTRACT(GBL,$LENGTH(GBL))=")"
SET GBL=$EXTRACT(GBL,1,$LENGTH(GBL)-1)
+4 IF $EXTRACT(GBL)'="^"
SET GBL="^"_GBL
+5 IF $FIND(GBL,"(")<1
SET GBL=GBL_"("
+6 IF $EXTRACT(GBL,$LENGTH(GBL))'=","
IF $EXTRACT(GBL,$LENGTH(GBL)-1)'="("
IF $EXTRACT(GBL,$LENGTH(GBL))'="("
SET GBL=GBL_","
+7 SET CC=0
SET NXT=""
+8 FOR L=0:0
XECUTE "S NXT=$O("_GBL_"NXT))"
IF NXT=""
QUIT
SET CC=CC+1
IF '(CC#50)
WRITE "."
+9 WRITE !!,"Count for ",GBL," is ",CC,!
+10 GOTO LOOP
+11 ;