AUGLDFN ; GET LAST DFN [ 06/17/85 8:01 AM ]
R !,"Global: ",GBL
Q:GBL=""
I $E(GBL)="?"!(GBL'?1"^"1U.U.E) W !,"Enter global reference (e.g. ""^APAT("")." G AUGLDFN
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 AUGLDFN
R !,"Start after DFN: 0// ",STRT
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
AUGLDFN ; GET LAST DFN [ 06/17/85 8:01 AM ]
+1 READ !,"Global: ",GBL
+2 IF GBL=""
QUIT
+3 IF $EXTRACT(GBL)="?"!(GBL'?1"^"1U.U.E)
WRITE !,"Enter global reference (e.g. ""^APAT("")."
GOTO AUGLDFN
+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 AUGLDFN
+6 READ !,"Start after DFN: 0// ",STRT
+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