Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LRIGCOPY

LRIGCOPY.m

Go to the documentation of this file.
LRIGCOPY ;COPIES DD(63.04) TO TEMP AND BACK 
 ;;5.2;LR;;NOV 01, 1997
 ; 
 S S1="`",S2="~",S3="!",S4="|",CM=",",QT=""""
 F Q=0:0 D CTL Q:GLO=""
 K SUBS,SUBS1,NN,GLO,OGLO
 Q
 ;
CTL ;
 R !,"COPY GLOBAL ",GLO Q:GLO=""
 R !,"  TO GLOBAL ",GLO1 Q:GLO1=""
 W !,"COPYING GLOBAL ",GLO," TO ",GLO1,!
ENT S OGLO=GLO S:$E(OGLO)'="^" OGLO="^"_OGLO S OGLO=$P(OGLO,"(")_"("
 S SUBS1="",SUBS=$P($P(GLO,"(",2),")") S:$E(SUBS,$L(SUBS))=CM SUBS=$E(SUBS,1,$L(SUBS)-1)
 S MXL=0,NSUBS=$L(SUBS,CM)+1,SUBS1="N1" S:SUBS="" NSUBS=1 I NSUBS>1 S SUBS1="" F N=1:1:NSUBS S @("N"_N)=$TR($P(SUBS,CM,N),"""","") S:N>1 SUBS1=SUBS1_CM S SUBS1=SUBS1_"N"_N
 S LEV=NSUBS,MXL=LEV,@("N"_LEV)=""
 S NGLO=GLO1 S:$E(NGLO)'="^" NGLO="^"_NGLO S NGLO=$P(NGLO,"(")_"("
 S SUBS2="",SUBS=$P($P(GLO1,"(",2),")") S:$E(SUBS,$L(SUBS))=CM SUBS=$E(SUBS,1,$L(SUBS)-1)
 S MXL1=0,NSUBS1=$L(SUBS,CM)+1,SUBS2="SS1" S:SUBS="" NSUBS1=1 I NSUBS1>1 S SUBS2="" F N=1:1:NSUBS1 S @("SS"_N)=$TR($P(SUBS,CM,N),"""","") S:N>1 SUBS2=SUBS2_CM S SUBS2=SUBS2_"SS"_N
 S LEV1=NSUBS1,MXL1=LEV1,@("SS"_LEV1)=""
 S DCK=0,X=$G(@$S(LEV=1:$P(OGLO,"("),1:OGLO_$P(SUBS1,CM,1,LEV-1)_")"))
 S:X="" DCK=$D(@$S(LEV=1:$P(OGLO,"("),1:OGLO_$P(SUBS1,CM,1,LEV-1)_")"))
 I X'=""!(DCK#10) S @$S(LEV1=1:$P(NGLO,"("),1:NGLO_$P(SUBS2,CM,1,LEV1-1)_")")=X
 D SRH K @SUBS1,@SUBS2
 Q
 ;
SRH ;
 S:MXL<LEV MXL=LEV,SUBS1=SUBS1_CM_"N"_LEV,SUBS2=SUBS2_CM_"SS"_LEV1
 S NN="N"_LEV,SS="SS"_LEV1,GLO=OGLO,@NN=$O(@(GLO_$P(SUBS1,CM,1,LEV)_")")),@SS=@NN
 I @NN="" Q:LEV=NSUBS  S LEV=LEV-1,LEV1=LEV1-1 G SRH
 S DCK=0,X=$G(^(@NN)) S:X="" DCK=$D(^(@NN)) I X'=""!(DCK#10) S @(NGLO_$P(SUBS2,CM,1,LEV1)_")")=X
 S LEV=LEV+1,LEV1=LEV1+1,@("N"_LEV)=""
 G SRH
 ;
DSP ;
 S P=0,LX=$L(X) F Q=0:0 S P=$F(X,STR,P) Q:'P  W !,$ZR,!,ATOFF,$E(X,1,P-LNG-1),RV,$E(X,P-LNG,P-1),ATOFF,$E(X,P,999),ATOFF W:LX#80 $J("",LX\80+1*80-LX) R !,R Q:R="*"
 Q