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

PSUUD4.m

Go to the documentation of this file.
  1. PSUUD4 ;BIR/TJH - PBM UNIT DOSE EMAIL GENERATOR ;10 JUL 1999
  1. ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
  1. ;DBIA(s)
  1. ; Reference to file #4.3 supported by DBIA 2496,2596
  1. ; Reference to file #40.8 supported by DBIA 2438
  1. ;
  1. ;PSULC = Line processing in ^tmp
  1. ;PSUTLC = Total Line count
  1. ;PSUMC = Message counter
  1. ;PSUMLC = Message Line Counter
  1. ; RETURNS
  1. ;PSUMSG("M") = # Messages
  1. ;PSUMSG("L") = # Lines
  1. ;
  1. EN(PSUMSGT) ;Scan and process for Division(s)
  1. ; PSUMSGT ("M")= # MESSAGES ("L")= # LINES
  1. ;
  1. S PSUDIV=0,Z=0,PSUUDSUB="PSUUD_"_PSUJOB
  1. F S PSUDIV=$O(^XTMP(PSUUDSUB,"RECORDS",PSUDIV)) Q:PSUDIV="" D
  1. . D XMD^PSUUD4(.Z) ; ==> process one division
  1. . S PSUMSGT(PSUDIV,PSUOPTN,"M")=$G(PSUMSGT(PSUDIV,PSUOPTN,"M"))+Z("M")
  1. . S PSUMSGT(PSUDIV,PSUOPTN,"L")=$G(PSUMSGT(PSUDIV,PSUOPTN,"L"))+Z("L")
  1. Q
  1. XMD(PSUMSG) ;EP returns PSUMSG("M")= # MESSAGES ("L")= # LINES
  1. NEW PSUMAX,PSULC,PSUTMC,PSUTLC,PSUMC
  1. ; Scan TMP, split lines, transmit per MAX lines in Netmail
  1. S PSUMAX=$$VAL^PSUTL(4.3,1,8.3)
  1. S PSUMAX=$S(PSUMAX="":10000,PSUMAX>10000:10000,1:PSUMAX)
  1. ;
  1. ; Split and store into ^XTMP(PSUUDSUB,"XMD",PSUMC,PSUMLC)
  1. K ^XTMP(PSUUDSUB,"XMD")
  1. S PSUMC=1,PSUMLC=0
  1. F PSULC=1:1 S X=$G(^XTMP(PSUUDSUB,"RECORDS",PSUDIV,PSULC)) Q:X="" D
  1. . S PSUMLC=PSUMLC+1
  1. . I PSUMLC>PSUMAX S PSUMC=PSUMC+1,PSUMLC=0,PSULC=PSULC-1 Q ; + message
  1. . I $L(X)<235 S ^XTMP(PSUUDSUB,"XMD",PSUMC,PSUMLC)=X Q
  1. . F I=235:-1:1 S Z=$E(X,I) Q:Z="^"
  1. . S ^XTMP(PSUUDSUB,"XMD",PSUMC,PSUMLC)=$E(X,1,I)
  1. . S PSUMLC=PSUMLC+1
  1. . S ^XTMP(PSUUDSUB,"XMD",PSUMC,PSUMLC)="*"_$E(X,I+1,999)
  1. ; Count Lines sent
  1. S PSUTLC=0
  1. F PSUM=1:1:PSUMC S X=$O(^XTMP(PSUUDSUB,"XMD",PSUM,""),-1),PSUTLC=PSUTLC+X
  1. ; Transmit Messages
  1. VARS ; Setup variables for contents
  1. ;
  1. F PSUM=1:1:PSUMC D
  1. . S X=PSUDIV,DIC=40.8,DIC(0)="X",D="C" D IX^DIC ;**1
  1. . S X=+Y S PSUDIVNM=$$VAL^PSUTL(40.8,X,.01)
  1. . S ^XTMP("PSU_"_PSUJOB,"DIV",PSUDIV)=PSUDIVNM
  1. . I '$D(PSUUDFLG) S XMSUB="V. 4.0 PBMUD "_PSUMON_" "_PSUM_"/"_PSUMC_" "_PSUDIV_" "_PSUDIVNM
  1. . I $D(PSUUDFLG) S XMSUB="V. 4.0 PBMUD "_PSUMON_" "_PSUDIV_" "_PSUDIVNM
  1. . S XMTEXT="^XTMP(PSUUDSUB,""XMD"",PSUM,"
  1. . S XMDUZ=DUZ
  1. . M XMY=PSUXMY
  1. . S XMCHAN=1
  1. . M XMY=PSUXMY
  1. . I PSUMASF!PSUDUZ!PSUPBMG D ^XMD
  1. ;
  1. S PSUMSG("M")=PSUMC
  1. S PSUMSG("L")=PSUTLC
  1. Q
  1. ;