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

VAFHLA04.m

Go to the documentation of this file.
VAFHLA04 ;ALB/JLU;CREATES THE REGISTRATION MESSAGE;
 ;;5.3;Registration;**91,179**;Jun 06, 1996
 ;hl7v1.6
EN(VAFHDFN,VAFHDT) ;THE MAIN ENTRY POINT FOR THE A04 MESSAGE TYPE
 ;
 S ERR="^TMP(""VAFHERR"",$J)" K ^TMP("VAFHERR",$J)
 I '$D(VAFHDFN)!('$D(VAFHDT)) S @ERR@(1)="-1^Can not build the A04 message.  Parameters not defined correctly." D EBULL^VAFHUTL2("","","",ERR) G EX
 I VAFHDFN=""!(VAFHDT="") S @ERR@(1)="-1^Can not build the A04 message.  Parameters are null." D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,"",ERR) G EX
 ;
 S VAFHPID="1,2,4,6,7,8,11,12,13,14,16,19"
 S VAFHZPD="2,3,4,5,6,7,8,9,10,11,12,13,14,15"
 K HLERR
 S CTR=1,HLSDT="VAFHREG"
 K HL D INIT^HLFNC2("VAFH A04",.HL)
 I $D(HL)#2 G EX
 ;. S @ERR@(1)="-1^Can not build the A04 message.  Failed during HLFNC2"
 ;. S @ERR@(2)=HL
 ;. D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,"",ERR)
 S HLMTN="ADT"_$E(HL("ECH"))_"A04"
 S VAFHGBL="^TMP(""HLS"",$J)" K ^TMP("HLS",$J)
 S SING="" ;SINGLE MESSAGES (NOT BATCH)
 ;
BAT ;THIS ENTRY POINT IS TO BE CONSIDERED IF A BATCH PROCESS IS NEEDED.
 ;
 S VAFHPTR=VAFHDFN_";DPT("
 S VAFHPIV=$$PIVNW^VAFHPIVT(VAFHDFN,VAFHDT,3,VAFHPTR)
 I VAFHPIV<0 S @ERR@(1)="-1^Can not build the A04 message.  Failed to get a PIVOT entry." D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,"",ERR) G EX
 S EVN=$$EVN^VAFHLEVN("A04","05") I +EVN=-1 S @ERR@(1)=EVN D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,+VAFHPIV,ERR) G EX
 S @VAFHGBL@(CTR)=EVN
 S CTR=CTR+1,@VAFHGBL@(CTR)=$$EN^VAFHLPID(VAFHDFN,VAFHPID)
 S CTR=CTR+1,@VAFHGBL@(CTR)=$$EN^VAFHLZPD(VAFHDFN,VAFHZPD)
 S PV1=$$OPV1^VAFHCPV(VAFHDFN,+VAFHPIV,VAFHDT,VAFHPTR,50) I +PV1=-1 S @ERR@(1)=PV1 D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,+VAFHPIV,ERR) G EX
 ;;;I $P(PV1,HLFS,3)'="O" S $P(PV1,HLFS,3)="T"
 ;;;I $P(PV1,HLFS,3)]"",$P(PV1,HLFS,3)'="O" S $P(PV1,HLFS,3)="T"
 S $P(PV1,HLFS,3)="T"
 S CTR=CTR+1,@VAFHGBL@(CTR)=PV1
 I $D(SING) DO
 .D GENERATE^HLMA("VAFH A04","GM",1,.HLRST)
 ;
EX ;
 D KILL^HLTRANS
 K VAFHGBL,VAFHDT,VAFHPTR,VAFHPID,VAFHZPD,PV1,EVN,CTR,SING,ERR
 K ^TMP("HLS",$J),^TMP("VAFHERR",$J)
 Q