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

BLRPCCST.m

Go to the documentation of this file.
BLRPCCST ;IHS/OIT/MKK - Lab To PCC Linker Status Check ;JUL 06, 2010 3:14 PM
 ;;5.2;IHS LABORATORY;**1030**;NOV 01, 1997
 ;
 ; Based upon the BLRPST routine
 ;
EP  ; EP - 
 NEW BLR,BLRCNT,BLRDTM,BLRED,BLREDH,BLRF,BLRHDR,BLRLEA,BLRLEDH
 NEW BLRLEP,BLRLN,BLRLOG,BLRLPDH,BLRLSQA,BLRLSQP,BLRLTA,BLRLTP
 NEW BLRNPMT,BLRNSQP,BLRPCC,BLRPD,BLRPDH,BLRSITE,BLRSTOP,BLRTA
 NEW BLRTP,BLRX,IOBOFF,IOBON
 NEW MAILSTR,MAILLINE,RM
 ;
 D INIT
 D DSP
 D KILL
 Q
 ;
DSP ; EP
 S BLRX=$G(^BLRSITE(BLRSITE,0))  ; 0 NODE
 S BLRSTOP=+$P(BLRX,U,9)         ; 'STOP PROCESSOR'
 Q:'BLRSTOP                      ; If processor not stopped, quit
 ;
 S BLRPDH=$P(BLRX,U,6)           ; 'START PROCESSING DATE'
 S BLREDH=$P(BLRX,U,7)           ; 'START EVENT DATE'
 S BLRLOG=$P(BLRX,U,2)           ; 'LAB LOG TRANSACTION'
 S BLRPCC=$P(BLRX,U,3)           ; 'LAB LOG TO PCC'
 S:'BLRPDH BLRPDH=+$H            ; IF NULL WE'RE STARTING TODAY
 S:'BLREDH BLREDH=+$H            ; IF NULL WE'RE STARTING TODAY
 ;
 ; 'PROCESSING DATE' INFORMATION
 S BLRX=$G(^BLRSITE(BLRSITE,21,BLRPDH,0))
 S BLRLTA=+$P(BLRX,U,2)          ;'LAST TRANSACTION SEQ ASSIGNED'
 S BLRLTP=+$P(BLRX,U,3)          ;'LAST TRANSACTION SEQ PROCESSED'
 ;
 ; LAST TRANSACTION # ASSIGNED
 S BLRLSQA=+$G(^BLRSITE(BLRSITE,21,BLRPDH,BLRLTA))
 ;
 ; LAST TRANSACTION # PROCESSED
 S BLRLSQP=+$G(^BLRSITE(BLRSITE,21,BLRPDH,BLRLTP))
 ;
 ; GET THE 'EVENT DATE' INFO
 S BLRX=$G(^BLRSITE(BLRSITE,20,BLREDH,0))
 ;
 S BLRLEA=+$P(BLRX,U,2) ;LAST EVENT ASSIGNED
 S BLRLEP=+$P(BLRX,U,3) ;LAST EVENT PROCESSED
 ;
 S:BLRLTA-BLRLTP>1 BLRNSQP=+$G(^BLRSITE(BLRSITE,21,BLRPDH,BLRLTP+1))
 ;
 S:'BLRLTA BLRLSQA=0
 S:'BLRLTP BLRLSQP=0
 ;
 I BLREDH'=BLRLEDH!(BLRPDH'=BLRLPDH) D
 . S %H=BLREDH
 . D YX^%DTC
 . S BLRED=Y
 . S %H=BLRPDH
 . D YX^%DTC
 . S BLRPD=Y,BLRLEDH=BLREDH,BLRLPDH=BLRPDH
 ;
 I BLREDH=BLRPDH S BLRHDR="Currently processing day "_BLRPD
 I BLREDH'=BLRPDH S BLRHDR="Currently Processing "_BLRED_"  "_BLRPD
 ;
 D HDR
 D ADDIT(" ")
 K STR
 S STR="Last Entry Assigned"
 S $E(STR,23)=$J($FN(BLRLEA,","),10)  ;'LAST EVENT ASSIGNED'
 S $E(STR,41)=$J($FN(BLRLTA,","),10)  ;'LAST TRANSACTION SEQ ASSIGNED'
 S $E(STR,64)=$J($FN(BLRLSQA,","),10) ;LAST TRANSACTION # ASSIGNED
 D ADDIT(STR)
 ;
 D ADDIT(" ")
 K STR
 S STR="Last Entry Processed"
 S $E(STR,23)=$J($FN(BLRLEP,","),10)  ;'LAST EVENT PROCESSED'
 S $E(STR,41)=$J($FN(BLRLTP,","),10)  ;'LAST TRANSACTION SEQ ASSIGNED'
 S $E(STR,64)=$J($FN(BLRLSQP,","),10) ;LAST TRANSACTION SEQ ASSIGNED'
 D ADDIT(STR)
 ;
 I BLRLEA-BLRLEP>1!(BLRLTA-BLRLTP>1) D
 . D ADDIT(" ")
 . K STR
 . S STR="Now Processing Entry"
 . S:BLRLEA-BLRLEP>1 $E(STR,23)=$J($FN(BLRLEP+1,","),10)  ;
 . S:BLRLTA-BLRLTP>1 $E(STR,41)=$J($FN(BLRLTP+1,","),10),$E(STR,64)=$J($FN(BLRNSQP,","),10)
 . D ADDIT(STR)
 ;
 D SENDMAIL^BLRUTIL3("IHS Lab to PCC Link Process is Stopped",.MAILSTR,"BLRPCCST")
 ;
 Q
 ;
INIT ;
 S RM=78
 S U="^",BLRF=0,BLRLN="",$P(BLRLN,"-",RM)="",BLRCNT=0
 S BLRSITE=$P($G(^AUTTSITE(1,0)),U),(BLRLEDH,BLRLPDH)=""
 I '$D(IOF) S IOP="HOME" D ^%ZIS K IOP
 S MAILLINE=0
 Q
 ;
HDR ;
 D NOW^%DTC S Y=%,%DT="S" D DD^%DT S BLRDTM=Y
 D ADDIT($$CJ^XLFSTR($$LOC^XBFUNC,RM))     ; Location
 D ADDIT($$CJ^XLFSTR("Processor Status",RM))
 D ADDIT($$CJ^XLFSTR($$UP^XLFSTR($$HTE^XLFDT($H)),RM))
 D ADDIT($$CJ^XLFSTR(BLRHDR,RM))
 D ADDIT(" ")
 K STR
 S $E(STR,40)="Entry Position"
 S $E(STR,59)="IHS Lab Transaction"
 D ADDIT(STR)
 K STR
 S $E(STR,28)="Event"
 S $E(STR,43)="in Queue"
 S $E(STR,61)="Sequence Number"
 D ADDIT(STR)
 D ADDIT(BLRLN)
 Q
 ;
ADDIT(LINER) ; EP - Add line to MAILSTR array
 S MAILLINE=MAILLINE+1
 S MAILSTR(MAILLINE)=LINER
 Q
 ;
ALERT ;
 S X="IORVON;IORVOFF;IOBON;IOBOFF"
 D ENDR^%ZISS
 W !,IORVON,"THERE IS SOMETHNG WRONG WITH THE PCC LINK!"
 W !,"TOO MANY ERRORS HAVE BEEN FOUND IN THE ERROR LOG!"
 W !,IOBON,"THE PCC LINK IS BEING TURNED OFF!!",IOBOFF
 W !,IORVON,"CALL YOUR SITE MANAGER IMMEDIATELY!",IORVOFF
 Q
 ;
KILL ;
 K %,%DT,%H,%I,X,Y
 Q
 ;
ENT ;
 D INIT,DSP,KILL
 Q