LRCAP1 ;SLC/CJS- STUFF AMIS DATA INTO LAM GLOBAL ;7/26/89 16:25 ;
;;V~5.0~;LAB;;02/27/90 17:09
STUFF ;from LRNIGHT
S LRSTAT=$S(S7=1:1,1:0),LRDAT=$P(D,".",1) K LRINPAT S:S15 LRINPAT=1
I LRDPF=62.3 S LRQC=1
I LRDPF'=2,LRDPF'=62.3 S LREF=1
S LRSITE=$S($D(DUZ(2)):DUZ(2),$D(^DD("SITE",1)):+^DD("SITE",1),1:0) Q:'LRSITE
F LRI=0:0 S LRI=$N(^LRO(68,LRAA,1,LRAD,1,LRAN,4,S3,1,LRI)) Q:LRI<1 S LRLN=+^(LRI,0) Q:'$D(^LAM(LRLN,0)) D COUNT
K LREF,LRSTAT,LRDAT,LRINPAT,LRQC,LRI,LRLN,LRSITE,N Q
CHECK I $D(^LAM(LRLN,1,LRSITE,1,LRDAT,1,N,0)) S N=N+1 G CHECK
S S4=$S($L(S11):S11,1:S4),^LAM(LRLN,1,LRSITE,1,LRDAT,1,N,0)=S4,^LAM(LRLN,1,LRSITE,1,LRDAT,1,"B",S4,N)="",^LAM(LRLN,1,LRSITE,1,LRDAT,1,0)="^64.03A^"_N_U_N
Q
COUNT D CAP^LRNIGHT
I '$D(^LAM(LRLN,1,0)) S ^LAM(LRLN,1,0)="^64.01P^1^1"
I '$D(^LAM(LRLN,1,LRSITE,0)) S ^(0)=LRSITE
I '$D(^LAM(LRLN,1,LRSITE,1,0)) S ^LAM(LRLN,1,LRSITE,1,0)=""
S:'$D(^LAM(LRLN,1,LRSITE,1,LRDAT,0)) ^(0)=LRDAT
S ^(5)=$S($D(^LAM(LRLN,1,LRSITE,1,LRDAT,5)):1+^(5),1:1) S:$D(LRQC) ^(2)=$S($D(^(2)):^(2)+1,1:1) S:$D(LRINPAT) ^(4)=$S($D(^(4)):^(4)+1,1:1) S:LRSTAT&(LRDPF=2) ^(7)=$S($D(^(7)):^(7)+1,1:1) S:$D(LRINPAT)&LRSTAT ^(8)=$S($D(^(8)):^(8)+1,1:1)
I '$D(LRINPAT),LRDPF=2 S ^(10)=$S($D(^LAM(LRLN,1,LRSITE,1,LRDAT,10)):1+^(10),1:1)
S:$D(LREF) ^(9)=$S($D(^LAM(LRLN,1,LRSITE,1,LRDAT,9)):1+^(9),1:1) S N=$P(^LAM(LRLN,1,LRSITE,1,0),U,4),^(0)="^64.02DA^"_LRDAT_U_(N+1)
I '$D(^LAM(LRLN,1,LRSITE,1,LRDAT,1,0)) S ^LAM(LRLN,1,LRSITE,1,LRDAT,1,0)="^64.03A^"
I $L(S11) S N=$N(^LAM(LRLN,1,LRSITE,1,LRDAT,1,"B",S11,0)) I N<1 S N=1+$P(^LAM(LRLN,1,LRSITE,1,LRDAT,1,0),U,4) D CHECK
I '$L(S11) S N=$N(^LAM(LRLN,1,LRSITE,1,LRDAT,1,"B",S4,0)) I N<1 S N=1+$P(^LAM(LRLN,1,LRSITE,1,LRDAT,1,0),U,4) D CHECK
S $P(^(1),U,1)=$S($D(^LAM(LRLN,1,LRSITE,1,LRDAT,1,N,1)):^(1)+1,1:1) S:LRSTAT $P(^(3),U,1)=$S($D(^(3)):^(3)+1,1:1)
S ^LRO(68,LRAA,1,LRAD,1,LRAN,"AE")="",$P(^(0),U,12)=1 ;Flag accession as counted.
Q