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

DVBCTXML.m

Go to the documentation of this file.
DVBCTXML ;ALB/BG - CAPRI XML RPCS; FEB 6, 2023@16:20 ; 10/25/23 10:47am
 ;;2.7;AMIE;**250**;Apr 10, 1995;Build 19
 ; Per VHA Directive 6402 this routine should not be modified
 ; Reference to SUPPORTED PARAMETER TOOL ENTRY POINTS in ICR #2263
 ; Reference to $$NOW^XLFDT and $$FMTE^XLFDT in ICR #10103
 Q
 ;
FAILIST(DVBFAIL,DVBDUZ) ; rpc entry to return list of failed xml transmissions
 N DVBNCT,DVBAUTH,DVBALL,DVBLIST,DVBSTA,DVBNAME,DVBORG,DVBNOW,DVBCOMP,DVBPT,DVBIEN,DVBCT,DVBFLAG,DVBDATE,DVBPATCH
 K ^TMP("CAPRI XML LIST",$J) S DVBNCT=""
 S DVBALL=1 I '$D(DVBDUZ) S DVBALL=0
 S DVBPATCH=3231025,DVBIEN=""
 S DVBDATE=DVBPATCH F  S DVBDATE=$O(^DVB(396.17,"C",DVBDATE)) Q:DVBDATE=""  D
 .S DVBIEN="" F  S DVBIEN=$O(^DVB(396.17,"C",DVBDATE,DVBIEN)) Q:DVBIEN=""  D
 ..I '$D(^DVB(396.17,DVBIEN,14,"B")) Q
 ..S DVBAUTH=$$GET1^DIQ(396.17,DVBIEN,"2","I") I (DVBALL=1)&($G(DVBDUZ)'=DVBAUTH) Q
 ..S DVBPT=$$GET1^DIQ(396.17,DVBIEN,".01","E")
 ..S DVBCT=0 F  S DVBCT=$O(^DVB(396.17,DVBIEN,14,"B",DVBCT)) Q:DVBCT=""  D
 ...S DVBFLAG=0,DVBINN=""_DVBCT_","_DVBIEN_","_""
 ...S DVBSTA=$$GET1^DIQ(396.1726,DVBINN,".02","I")
 ...I DVBSTA="C" Q
 ...S DVBORG=$$GET1^DIQ(396.1726,DVBINN,".05","I")
 ...S DVBNAME=$$GET1^DIQ(396.1726,DVBINN,".03","E")
 ...S DVBNOW=$$NOW^XLFDT S DVBDT=$$FMDIFF^XLFDT(DVBNOW,DVBORG,3)
 ...S DVBCOMP=$P(DVBDT," ",1) I DVBCOMP>=1 S DVBFLAG=1
 ...S DVBORG=$$FMTE^XLFDT(DVBORG,1)
 ...S DVBLIST=DVBIEN_U_DVBCT_U_DVBNAME_U_DVBPT_U_DVBORG_U_DVBFLAG_";"
 ...S DVBNCT=DVBNCT+1 M ^TMP("CAPRI XML LIST",$J,DVBNCT)=DVBLIST
 ...Q
 S DVBFAIL=$NA(^TMP("CAPRI XML LIST",$J))
 Q
 ;  
FAILXML(DVBXML,DVBIEN,DVBCT) ;
 N DVBABCNT,DVBFXML,DVNCT,DVBFXML,DVBABIEN K ^TMP("DVBAXML",$J)
 I '$D(^DVB(396.17,DVBIEN)) S DVBXML="0^NO RECORD EXISTS" Q
 I '$D(^DVB(396.17,DVBIEN,14,DVBCT)) S DVBXML="0^NO RECORD EXISTS" Q
 S DVBABCNT=1,DVBABIEN=0,DVNCT=0
 S DVBRTN=$$LOCK(DVBIEN,DVBCT) I DVBRTN=0 S DVBXML="1^LOCKED RECORD" Q
 F  S DVBABIEN=$O(^DVB(396.17,DVBIEN,14,DVBCT,3,DVBABIEN)) Q:'DVBABIEN  D
 .S DVBFXML=$G(^DVB(396.17,DVBIEN,14,DVBCT,3,DVBABCNT,0))
 .I DVBABCNT=1 S DVBFXML="1"_U_DVBFXML
 .S DVBABCNT=DVBABCNT+1,DVNCT=DVNCT+1 M ^TMP("DVBAXML",$J,DVNCT)=DVBFXML
 .Q
 S DVBXML=$NA(^TMP("DVBAXML",$J))
 D UNLOCK(DVBIEN,DVBCT)
 Q
 ;
SAVEXML(DVBRTN,DVBNAME,DVBCT,DVBCNT,DVBXML,DVBSTAT,DVBRESP,DVBIEN) ;
 I $G(DVBCT)="" S DVBCT=1
 I $G(DVBCNT)="" S DVBCNT=1
 S DVBRESP="Initial Save"
 D STATUS(.DVBRTN,DVBIEN,DVBCT,DVBNAME,DVBSTAT,DVBRESP)
 D FILEIN(.DVBRTN,DVBIEN,DVBCT,DVBCNT,.DVBXML)
 K DIC,DIE,DA,DR,DLAYGO,X,Y
 S DVBRTN=DVBRTN
 Q
FILEIN(DVBRTN,DVBIEN,DVBCT,DVBCNT,DVBXML) ;
 N DVBERR
 D WP^DIE(396.1726,DVBCT_","_DVBIEN_",",.04,"K","DVBXML","DVBERR")
 I $D(DVBERR) S DVBRTN=$G(DVBERR) Q
 S DVBRTN=DVBRTN
 Q
STATUS(DVBRTN,DVBIEN,DVBCT,DVBNAME,DVBSTAT,DVBRESP) ;
 N DVBCNT,DVBDT,DVBNWIEN,DVBINN,DVBTRANS,DVBSTA
 S DVBSTA=$S(DVBSTAT=1:"C",1:"E")
 I '$D(DVBRESP)!(DVBRESP="")&(DVBSTA="C") S DVBRESP="TRANSMISSION COMPLETE"
 S DVBDT=$$NOW^XLFDT,DVBCNT=""
 S DVBCNT=$O(^DVB(396.17,DVBIEN,14,DVBCT,10,"B",DVBCNT),-1)
 S DVBCNT=$G(DVBCNT)+1
 K DIC,DIE,DA,DR,DLAYGO,X,Y
 S DA(2)=DVBIEN,DA(1)=DVBCT,X=DVBCNT
 S (DLAYGO,DIC)="^DVB(396.17,"_DA(2)_",14,"_DA(1)_",10,",DIC(0)="L"
 D ^DIC
 S (DA,DVBNWIEN)=+Y
 S DIE=DIC
 S DR=".01////"_DVBNWIEN_";.02////"_DVBDT_";.03////"_DUZ_";.04////"_DVBRESP
 D ^DIE K DIE,DIC,DA,DR,DLAYGO,X,Y
 S DVBINN=""_DVBCT_","_DVBIEN_","_""
 S DVBTRANS=$$GET1^DIQ(396.1726,DVBINN,".07","I")
 I DVBRESP'="Initial Save" S DVBTRANS=$G(DVBTRANS)+1
 S DA(1)=DVBIEN,DA=DVBCT
 S (DLAYGO,DIC)="^DVB(396.17,"_DA(1)_",14,",DIC(0)="L"
 D ^DIC
 S DIE=DIC
 S DR=".01////"_DVBCT_";.07////"_DVBTRANS_";.02////"_DVBSTA
 D ^DIE
 I DVBSTA="C" S DR=".09////"_DVBDT D ^DIE
 I $G(DVBNAME)'="" S DR=".03////"_DVBNAME D ^DIE
 I DVBRESP="Initial Save" S DR=".05////"_DVBDT D ^DIE
 S DVBRTN=1 I $D(DIERR) S DVBRTN=0
 D UNLOCK(DVBIEN,DVBCT)
 K DIC,DIE,DIERR,DA,DR,DLAYGO,X
 Q
 ;
LOCK(DVBIEN,DVBCT) ;
 L +^DVB(396.17,DVBIEN,14,DVBCT,3):30
 S DVBRTN=$T
 Q DVBRTN
 ;
UNLOCK(DVBIEN,DVBCT) ;
 L -^DVB(396.17,DVBIEN,14,DVBCT,3)
 Q
 ;
FAILCHK(DVBRTN) ;
 K DVBRTN S DVBRTN=0,DVBPATCH=3231025
 S DVBDATE=DVBPATCH F  S DVBDATE=$O(^DVB(396.17,"C",DVBDATE)) Q:(DVBDATE="")!(DVBRTN=1)  D
 .S DVBIEN="" F  S DVBIEN=$O(^DVB(396.17,"C",DVBDATE,DVBIEN)) Q:(DVBIEN="")!(DVBRTN=1)  D
 ..I $D(^DVB(396.17,DVBIEN,14,"B"))  D
 ...S DVBCT=0 F  S DVBCT=$O(^DVB(396.17,DVBIEN,14,"B",DVBCT)) Q:(DVBCT="")!(DVBRTN=1)  D
 ....S DVBINN=""_DVBCT_","_DVBIEN_","_""
 ....S DVBSTA=$$GET1^DIQ(396.1726,DVBINN,".02","I")
 ....I DVBSTA'="C" S DVBRTN=1
 Q