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

BPC7OGMU.m

Go to the documentation of this file.
BPC7OGMU ; IHS/OIT/MJL - Interim report rpc memo utility 6/6/97 16:15 ;
 ;;1.5;BPC;;MAY 26, 2005
 ;;
 ;;5.2;LAB SERVICE;**187**;Sep 27, 1994
 ;
NEWOLD(Y,DFN) ; from ORWLRR
 N LRDFN
 D DEMO^BPC7OGU(DFN,.LRDFN)
 S Y=$$NEWEST(LRDFN)_U_$$OLDEST(LRDFN)
 Q
 ;
NEWEST(LRDFN) ;
 N IDT,FIRSTCH,FIRSTMI
 S (FIRSTCH,FIRSTMI)=""
 S IDT=0 F  S IDT=$O(^LR(LRDFN,"CH",IDT)) Q:IDT<1  I $P($G(^(IDT,0)),U,3) S FIRSTCH=9999999-IDT Q
 S IDT=0 F  S IDT=$O(^LR(LRDFN,"MI",IDT)) Q:IDT<1  I $P($G(^(IDT,0)),U,1) S FIRSTMI=9999999-IDT Q
 I FIRSTCH>FIRSTMI Q FIRSTCH
 I FIRSTCH'>FIRSTMI Q FIRSTMI
 Q ""
 ;
OLDEST(LRDFN) ;
 N IDT,FIRSTCH,FIRSTMI
 S (FIRSTCH,FIRSTMI)=""
 S IDT="" F  S IDT=$O(^LR(LRDFN,"CH",IDT),-1) Q:IDT=""  I $P($G(^(IDT,0)),U,3) S FIRSTCH=9999999-IDT Q
 S IDT="" F  S IDT=$O(^LR(LRDFN,"MI",IDT),-1) Q:IDT=""  I $P($G(^(IDT,0)),U,1) S FIRSTMI=9999999-IDT Q
 I FIRSTMI="" Q FIRSTCH
 I FIRSTCH="" Q FIRSTMI
 I FIRSTCH<FIRSTMI Q FIRSTCH
 I FIRSTCH'<FIRSTMI Q FIRSTMI
 Q ""