VAFHBGJ ;ALB/CM BACKGROUND JOB FOR UPDATE MESSAGES ;05/23/95
;;5.3;Registration;**91,415**;Jun 06, 1996
;
;This routine will loop through the pivot file, getting the entries
;that have the TRANSMITTED-NEED TO TRANSMIT field populated and
; generating an A08 message for the update.
;
;
EN ;check to see if sending is on or off
I '$$SEND^VAFHUTL() Q
;make sure only one job will run
ENT L +^XTMP("ADT/HL7 VAFH BATCH UPDATE"):3 E Q
;
D MAIN
K HLA D KILL^HLTRANS
L -^XTMP("ADT/HL7 VAFH BATCH UPDATE")
Q
;
MAIN N LSTR,LOOP,NODE,DFN,RECENT,EVTY,EVDT,PIVOT,VPTR,GBL,COUNT,UP,ERR,CLEAN
I '$O(^VAT(391.71,"AC",1,"")) Q
S LOOP="",GBL="HLA(""HLS"")"
K HLA
;
F S COUNT=1,LOOP=$O(^VAT(391.71,"AC",1,LOOP)) Q:LOOP="" D Q:$D(HL)=1
.; bad x-ref, delete it and quit
.I '$D(^VAT(391.71,LOOP)) K ^VAT(391.71,"AC",1,LOOP) Q
.S NODE=$G(^VAT(391.71,LOOP,0)) Q:'NODE
.K HL D INIT^HLFNC2("VAFH A08",.HL)
.I $D(HL)=1 Q
.I LOOP#10=0,+$$S^%ZTLOAD K HL S HL="TaskMan User Stop " Q
.S DFN=$P(NODE,"^",3),PIVOT=$P(NODE,"^",2) Q:'DFN
.; need to check if anything but registration
.S LSTR=$P($$LTD^VAFHUTL(DFN),"^",2)
.I LSTR'="R",LSTR'["No l" S LSTR=",2,50"
.E S LSTR=50
.;
.; generate the a08 message
.S ERR=$$UP^VAFHCA08(DFN,PIVOT,NODE,COUNT,GBL,"2,3,4,5,6,7,8,9,10B,11,12,13,14,16,19,22B","2,3,4,5,6,7,8,9,10,11,12,13,14,15",LSTR)
.I +ERR=0 DO
. .S CLEAN=$$CLNTRAN^VAFHPIV2(PIVOT),COUNT=$P(ERR,"^",2)+1
.E Q
.;;;I COUNT<2&($D(CLEAN)) D
.I +CLEAN=-1 D ERROR^VAFHCCAP(CLEAN,DFN) Q
.D GENERATE^HLMA("VAFH A08","LM",1,.HLRESLT)
.K HLA
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFHBGJ 1600 printed Dec 13, 2024@03:02:45 Page 2
VAFHBGJ ;ALB/CM BACKGROUND JOB FOR UPDATE MESSAGES ;05/23/95
+1 ;;5.3;Registration;**91,415**;Jun 06, 1996
+2 ;
+3 ;This routine will loop through the pivot file, getting the entries
+4 ;that have the TRANSMITTED-NEED TO TRANSMIT field populated and
+5 ; generating an A08 message for the update.
+6 ;
+7 ;
EN ;check to see if sending is on or off
+1 IF '$$SEND^VAFHUTL()
QUIT
+2 ;make sure only one job will run
ENT LOCK +^XTMP("ADT/HL7 VAFH BATCH UPDATE"):3
IF '$TEST
QUIT
+1 ;
+2 DO MAIN
+3 KILL HLA
DO KILL^HLTRANS
+4 LOCK -^XTMP("ADT/HL7 VAFH BATCH UPDATE")
+5 QUIT
+6 ;
MAIN NEW LSTR,LOOP,NODE,DFN,RECENT,EVTY,EVDT,PIVOT,VPTR,GBL,COUNT,UP,ERR,CLEAN
+1 IF '$ORDER(^VAT(391.71,"AC",1,""))
QUIT
+2 SET LOOP=""
SET GBL="HLA(""HLS"")"
+3 KILL HLA
+4 ;
+5 FOR
SET COUNT=1
SET LOOP=$ORDER(^VAT(391.71,"AC",1,LOOP))
if LOOP=""
QUIT
Begin DoDot:1
+6 ; bad x-ref, delete it and quit
+7 IF '$DATA(^VAT(391.71,LOOP))
KILL ^VAT(391.71,"AC",1,LOOP)
QUIT
+8 SET NODE=$GET(^VAT(391.71,LOOP,0))
if 'NODE
QUIT
+9 KILL HL
DO INIT^HLFNC2("VAFH A08",.HL)
+10 IF $DATA(HL)=1
QUIT
+11 IF LOOP#10=0
IF +$$S^%ZTLOAD
KILL HL
SET HL="TaskMan User Stop "
QUIT
+12 SET DFN=$PIECE(NODE,"^",3)
SET PIVOT=$PIECE(NODE,"^",2)
if 'DFN
QUIT
+13 ; need to check if anything but registration
+14 SET LSTR=$PIECE($$LTD^VAFHUTL(DFN),"^",2)
+15 IF LSTR'="R"
IF LSTR'["No l"
SET LSTR=",2,50"
+16 IF '$TEST
SET LSTR=50
+17 ;
+18 ; generate the a08 message
+19 SET ERR=$$UP^VAFHCA08(DFN,PIVOT,NODE,COUNT,GBL,"2,3,4,5,6,7,8,9,10B,11,12,13,14,16,19,22B","2,3,4,5,6,7,8,9,10,11,12,13,14,15",LSTR)
+20 IF +ERR=0
Begin DoDot:2
+21 SET CLEAN=$$CLNTRAN^VAFHPIV2(PIVOT)
SET COUNT=$PIECE(ERR,"^",2)+1
End DoDot:2
+22 IF '$TEST
QUIT
+23 ;;;I COUNT<2&($D(CLEAN)) D
+24 IF +CLEAN=-1
DO ERROR^VAFHCCAP(CLEAN,DFN)
QUIT
+25 DO GENERATE^HLMA("VAFH A08","LM",1,.HLRESLT)
+26 KILL HLA
End DoDot:1
if $DATA(HL)=1
QUIT
+27 QUIT