PSXPURG1 ;BIRM/WPB-CHECK PSX(552.1,"AP" FOR NOT PROCESSED BATCHES [ 04/08/97   2:06 PM ]
 ;;2.0;CMOP;;11 Apr 97
CKAP K ^TMP($J,"PSXPROC")
 D NOW^%DTC S STRT=$$FMADD^XLFDT(%,-3,0,0,0),CNT=1 K %
 F  S STRT=$O(^PSX(552.1,"AP",STRT)) Q:'STRT  S BAT="" F  S BAT=$O(^PSX(552.1,"AP",STRT,BAT)) Q:'BAT  D CKAQ
 D MSG
 K STRT,BAT,CNT
 Q
CKAQ S:$D(^PSX(552.2,"AQ",BAT)) ^TMP($J,"PSXPROC",CNT)=BAT,CNT=CNT+1
 Q
MSG Q  Q:'$D(^TMP($J,"PSXPROC"))
 S XMSUB="CMOP PROCESSED MSG",XMDUN="CMOP Manager"
 D XMZ^XMA2 G:XMZ'>0 MSG
 S FAC=$P(^PSX(553,1,0),"^")_" CMOP"
 S COM=$S($D(^TMP($J,"PSXPROC")):" has transmissions that are marked as processed that have data to go to the vendor.",1:" all transmissions processed correctly."),LCNT=1
 S ^XMB(3.9,XMZ,2,LCNT,0)=FAC_COM,LCNT=LCNT+1,^XMB(3.9,XMZ,2,LCNT,0)=" ",LCNT=LCNT+1
 I $D(^TMP($J,"PSXPROC")) D
 .S XX=0 F  S XX=$O(^TMP($J,"PSXPROC",XX)) Q:XX'>0  S ^XMB(3.9,XMZ,2,LCNT,0)=$G(^TMP($J,"PSXPROC",XX))_" marked as processed but has data to send to the vendor.",LCNT=LCNT+1
 S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_"^"_LCNT_"^"_DT,XMDUZ=.5
 K XMY D GRP^PSXNOTE D ENT1^XMD
 K XMSUB,XMDUN,XMZ,LCNT,^TMP($J,"PSXPROC"),FAC,COM,XMY,XMDUZ,XX
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSXPURG1   1186     printed  Sep 23, 2025@19:20:42                                                                                                                                                                                                    Page 2
PSXPURG1  ;BIRM/WPB-CHECK PSX(552.1,"AP" FOR NOT PROCESSED BATCHES [ 04/08/97   2:06 PM ]
 +1       ;;2.0;CMOP;;11 Apr 97
CKAP       KILL ^TMP($JOB,"PSXPROC")
 +1        DO NOW^%DTC
           SET STRT=$$FMADD^XLFDT(%,-3,0,0,0)
           SET CNT=1
           KILL %
 +2        FOR 
               SET STRT=$ORDER(^PSX(552.1,"AP",STRT))
               if 'STRT
                   QUIT 
               SET BAT=""
               FOR 
                   SET BAT=$ORDER(^PSX(552.1,"AP",STRT,BAT))
                   if 'BAT
                       QUIT 
                   DO CKAQ
 +3        DO MSG
 +4        KILL STRT,BAT,CNT
 +5        QUIT 
CKAQ       if $DATA(^PSX(552.2,"AQ",BAT))
               SET ^TMP($JOB,"PSXPROC",CNT)=BAT
               SET CNT=CNT+1
 +1        QUIT 
MSG        QUIT 
           if '$DATA(^TMP($JOB,"PSXPROC"))
               QUIT 
 +1        SET XMSUB="CMOP PROCESSED MSG"
           SET XMDUN="CMOP Manager"
 +2        DO XMZ^XMA2
           if XMZ'>0
               GOTO MSG
 +3        SET FAC=$PIECE(^PSX(553,1,0),"^")_" CMOP"
 +4        SET COM=$SELECT($DATA(^TMP($JOB,"PSXPROC")):" has transmissions that are marked as processed that have data to go to the vendor.",1:" all transmissions processed correctly.")
           SET LCNT=1
 +5        SET ^XMB(3.9,XMZ,2,LCNT,0)=FAC_COM
           SET LCNT=LCNT+1
           SET ^XMB(3.9,XMZ,2,LCNT,0)=" "
           SET LCNT=LCNT+1
 +6        IF $DATA(^TMP($JOB,"PSXPROC"))
               Begin DoDot:1
 +7                SET XX=0
                   FOR 
                       SET XX=$ORDER(^TMP($JOB,"PSXPROC",XX))
                       if XX'>0
                           QUIT 
                       SET ^XMB(3.9,XMZ,2,LCNT,0)=$GET(^TMP($JOB,"PSXPROC",XX))_" marked as processed but has data to send to the vendor."
                       SET LCNT=LCNT+1
               End DoDot:1
 +8        SET ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_"^"_LCNT_"^"_DT
           SET XMDUZ=.5
 +9        KILL XMY
           DO GRP^PSXNOTE
           DO ENT1^XMD
 +10       KILL XMSUB,XMDUN,XMZ,LCNT,^TMP($JOB,"PSXPROC"),FAC,COM,XMY,XMDUZ,XX
 +11       QUIT