XBGLDFN ; IHS/ADC/GTH - GET LAST DFN ; [ 02/07/97 3:02 PM ]
;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
;
START ;
NEW GBL,LDFN,NDFN,STRT,TGBL
LOOP ;
R !,"Enter global reference like '^DPT(""B"",' ",GBL:$G(DTIME,999)
Q:GBL=""
I $E(GBL)="?"!(GBL'?1"^"1U.U.E) W !,"Enter global reference (e.g. ""^AUPNPAT("")." G LOOP
S TGBL=$S($E(GBL,$L(GBL))="(":$P(GBL,"(",1),$E(GBL,$L(GBL))=",":$E(GBL,1,$L(GBL)-1)_")",$E(GBL,$L(GBL))'=")":GBL_")",1:GBL)
I '$D(@(TGBL)) W !!,"Global ",GBL," does not exist!" G XBGLDFN
R !,"Start after DFN: 0// ",STRT:$G(DTIME,999)
S:STRT="" STRT=0
S LDFN="Started after high DFN"
S NDFN=$D(@(GBL_STRT_")")),NDFN=STRT F L=0:0 S NDFN=$O(^(NDFN)) Q:NDFN=""!(NDFN'?1N.N) S LDFN=NDFN
W !!,"Last DFN is ",LDFN
Q
;
XBGLDFN ; IHS/ADC/GTH - GET LAST DFN ; [ 02/07/97 3:02 PM ]
+1 ;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
+2 ;
START ;
+1 NEW GBL,LDFN,NDFN,STRT,TGBL
LOOP ;
+1 READ !,"Enter global reference like '^DPT(""B"",' ",GBL:$GET(DTIME,999)
+2 IF GBL=""
QUIT
+3 IF $EXTRACT(GBL)="?"!(GBL'?1"^"1U.U.E)
WRITE !,"Enter global reference (e.g. ""^AUPNPAT("")."
GOTO LOOP
+4 SET TGBL=$SELECT($EXTRACT(GBL,$LENGTH(GBL))="(":$PIECE(GBL,"(",1),$EXTRACT(GBL,$LENGTH(GBL))=",":$EXTRACT(GBL,1,$LENGTH(GBL)-1)_")",$EXTRACT(GBL,$LENGTH(GBL))'=")":GBL_")",1:GBL)
+5 IF '$DATA(@(TGBL))
WRITE !!,"Global ",GBL," does not exist!"
GOTO XBGLDFN
+6 READ !,"Start after DFN: 0// ",STRT:$GET(DTIME,999)
+7 IF STRT=""
SET STRT=0
+8 SET LDFN="Started after high DFN"
+9 SET NDFN=$DATA(@(GBL_STRT_")"))
SET NDFN=STRT
FOR L=0:0
SET NDFN=$ORDER(^(NDFN))
IF NDFN=""!(NDFN'?1N.N)
QUIT
SET LDFN=NDFN
+10 WRITE !!,"Last DFN is ",LDFN
+11 QUIT
+12 ;