BPSRPC01 ;AITC/PD - ECME TAS RPC - Extract Txn IENs;7/30/2018
;;1.0;E CLAIMS MGMT ENGINE;**27,34**;JUN 2004;Build 11
;;Per VA Directive 6402, this routine should not be modified.
;
Q
;
RPC2(RESULT,ARGS) ; RPC: BPS TAS TXN IENS NEW
;
; At the TAS level, a Process Manager will be continually executing.
; The Process Manager will execute specific RPCs in each VistA. The
; purpose of this RPC is to transmit BPS Log of Transaction IENs to be
; stored in the WorkQueue on TAS. Another RPC will process the IENs
; from the WorkQueue, transmitting the data to be used by Power BI to TAS.
;
; RESULT - Output - JSON formatted array of transaction IENs
;
N BPS57,BPSCNT,BPSCOUNT,BPSFLAG,BPSTMP,BPSTMP1
;
S BPSTMP="^TMP($J,""BPSRPC2"",""IENS"")"
S BPSTMP1="^TMP($J,""BPSRPC2"")"
K @BPSTMP1
S RESULT=$NA(^TMP("JSON",$J)) K @RESULT
;
; Create log if requested
I $G(ARGS("LOG")) D LOG^BPSRPC02("ARGS")
S BPSCOUNT=$G(ARGS("COUNT"))
I BPSCOUNT="" S BPSCOUNT=2500
;
S BPSCNT=0
;
; Loop through Claims identified as needing to be transmitted to TAS
;
; Loop through BPS LOG OF TRANSACTIONS file - "C" index
; Loop through entries with flag set as 2 first to pick up entries
; that previously transmitted but didn't receive a successful writeback
; indicator.
;
F BPSFLAG=2,1 D
. S BPS57=""
. F S BPS57=$O(^BPSTL("C",BPSFLAG,BPS57),-1) Q:'BPS57!(BPSCNT>(BPSCOUNT-1)) D
. . S BPSCNT=$G(BPSCNT)+1
. . S @BPSTMP@(BPSCNT,"TxnIEN")=BPS57
. . S @BPSTMP@("B",BPS57)=""
. . ;
. . ; Update MCCF EDI TAS Progress flag to be 2
. . ; 2 = SENT
. . N BPSA,BPSFN,BPSREC
. . S BPSFN=9002313.57
. . S BPSREC=BPS57_","
. . S BPSA(BPSFN,BPSREC,20)=2
. . D FILE^DIE("","BPSA","")
;
; No Txns Found - Set ^TMP array to show nothing found before calling
; ENCODE logic.
I BPSCNT=0 S @BPSTMP@(1,"TxnIEN")=""
;
; Remove "B" index before creating JSON file
K @BPSTMP@("B")
;
; Encode ^TMP array data into JSON formatted array (RESULT)
D ENCODE^XLFJSON(BPSTMP1,RESULT)
S @RESULT@(1)="["_@RESULT@(1)
S LAST=$O(@RESULT@(""),-1)
S @RESULT@(LAST)=@RESULT@(LAST)_"]"
;
K @BPSTMP1
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSRPC01 2175 printed Nov 22, 2024@17:02:46 Page 2
BPSRPC01 ;AITC/PD - ECME TAS RPC - Extract Txn IENs;7/30/2018
+1 ;;1.0;E CLAIMS MGMT ENGINE;**27,34**;JUN 2004;Build 11
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
RPC2(RESULT,ARGS) ; RPC: BPS TAS TXN IENS NEW
+1 ;
+2 ; At the TAS level, a Process Manager will be continually executing.
+3 ; The Process Manager will execute specific RPCs in each VistA. The
+4 ; purpose of this RPC is to transmit BPS Log of Transaction IENs to be
+5 ; stored in the WorkQueue on TAS. Another RPC will process the IENs
+6 ; from the WorkQueue, transmitting the data to be used by Power BI to TAS.
+7 ;
+8 ; RESULT - Output - JSON formatted array of transaction IENs
+9 ;
+10 NEW BPS57,BPSCNT,BPSCOUNT,BPSFLAG,BPSTMP,BPSTMP1
+11 ;
+12 SET BPSTMP="^TMP($J,""BPSRPC2"",""IENS"")"
+13 SET BPSTMP1="^TMP($J,""BPSRPC2"")"
+14 KILL @BPSTMP1
+15 SET RESULT=$NAME(^TMP("JSON",$JOB))
KILL @RESULT
+16 ;
+17 ; Create log if requested
+18 IF $GET(ARGS("LOG"))
DO LOG^BPSRPC02("ARGS")
+19 SET BPSCOUNT=$GET(ARGS("COUNT"))
+20 IF BPSCOUNT=""
SET BPSCOUNT=2500
+21 ;
+22 SET BPSCNT=0
+23 ;
+24 ; Loop through Claims identified as needing to be transmitted to TAS
+25 ;
+26 ; Loop through BPS LOG OF TRANSACTIONS file - "C" index
+27 ; Loop through entries with flag set as 2 first to pick up entries
+28 ; that previously transmitted but didn't receive a successful writeback
+29 ; indicator.
+30 ;
+31 FOR BPSFLAG=2,1
Begin DoDot:1
+32 SET BPS57=""
+33 FOR
SET BPS57=$ORDER(^BPSTL("C",BPSFLAG,BPS57),-1)
if 'BPS57!(BPSCNT>(BPSCOUNT-1))
QUIT
Begin DoDot:2
+34 SET BPSCNT=$GET(BPSCNT)+1
+35 SET @BPSTMP@(BPSCNT,"TxnIEN")=BPS57
+36 SET @BPSTMP@("B",BPS57)=""
+37 ;
+38 ; Update MCCF EDI TAS Progress flag to be 2
+39 ; 2 = SENT
+40 NEW BPSA,BPSFN,BPSREC
+41 SET BPSFN=9002313.57
+42 SET BPSREC=BPS57_","
+43 SET BPSA(BPSFN,BPSREC,20)=2
+44 DO FILE^DIE("","BPSA","")
End DoDot:2
End DoDot:1
+45 ;
+46 ; No Txns Found - Set ^TMP array to show nothing found before calling
+47 ; ENCODE logic.
+48 IF BPSCNT=0
SET @BPSTMP@(1,"TxnIEN")=""
+49 ;
+50 ; Remove "B" index before creating JSON file
+51 KILL @BPSTMP@("B")
+52 ;
+53 ; Encode ^TMP array data into JSON formatted array (RESULT)
+54 DO ENCODE^XLFJSON(BPSTMP1,RESULT)
+55 SET @RESULT@(1)="["_@RESULT@(1)
+56 SET LAST=$ORDER(@RESULT@(""),-1)
+57 SET @RESULT@(LAST)=@RESULT@(LAST)_"]"
+58 ;
+59 KILL @BPSTMP1
+60 ;
+61 QUIT