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

HLTF2.m

Go to the documentation of this file.
  1. HLTF2 ;AISC/SAW/MTC-Process Message Text File Entries (Cont'd) ;02/24/97 13:56
  1. ;;1.6;HEALTH LEVEL SEVEN;**1**;APR 04, 1997
  1. ;;1.6;HEALTH LEVEL SEVEN;**25**;Oct 13, 1995
  1. MERGEIN(LLD0,LLD1,MTIEN,HDR,MSA) ;Merge Data From Communication Server
  1. ;Module Logical Link File into Message Text File
  1. ;
  1. ;This is a subroutine call with parameter passing. The output
  1. ;parameters HDR (and optionally) MSA are returned by this call.
  1. ;
  1. ;Required input parameters
  1. ; LLD0 = Internal entry number where message is stored in Logical Link
  1. ; file or XM if message is stored in MailMan
  1. ; LLD1 = Internal entry number of IN QUEUE multiple entry in Logical
  1. ; Link file (Only required for messages stored in Logical
  1. ; Link file)
  1. ; MTIEN = Internal entry number where message is to be copied to in
  1. ; Message Text file
  1. ; HDR = The variable in which the message header segment will
  1. ; be returned
  1. ; MSA = The variable in which the message acknowledgement segment
  1. ; will be returned, if one exists for this message
  1. ;
  1. ;Check for required parameters
  1. I $G(LLD0)']""!('$G(MTIEN)) Q
  1. I LLD0'="XM",'$G(LLD1) Q
  1. N FLG,HLCHAR,HLEVN,HLFS,I,X,X1,HLDONE
  1. S (FLG,HLCHAR,HLEVN,X)=0
  1. ;
  1. ;Move data from Logical Link file to Message Text file
  1. I LLD0'="XM" D
  1. .S I=0 F S X=$O(^HLCS(870,LLD0,1,LLD1,1,X)) Q:X'>0 S X1=$G(^(X,0)) S:"FHS,BHS,MSH"[$E(X1,1,3) FLG=1 I FLG S HLCHAR=HLCHAR+$L(X1) D
  1. ..;If header segment, process it and set HDR equal to it
  1. ..I X1'="","FHS,BHS,MSH"[$E(X1,1,3) D
  1. ...I '$D(HDR) S HDR=X1,HLFS=$E(X1,4) I $E(HDR,1,3)="BHS" S MSA="MSA"_HLFS_$P($P(HDR,HLFS,10),$E(HDR,5),1)_HLFS_$P(HDR,HLFS,12)_HLFS_$P($P(HDR,HLFS,10),$E(HDR,5),2)
  1. ...S $P(X1,HLFS,8)=""
  1. ...S:$E(X1,1,3)="MSH" HLEVN=HLEVN+1
  1. ..;If acknowledgement segment, set MSA equal to it
  1. ..I $E(X1,1,3)="MSA",'$D(MSA),$E($G(HDR),1,3)="MSH" S MSA=X1
  1. ..S I=I+1,^HL(772,MTIEN,"IN",I,0)=X1
  1. ;
  1. ;Move data from MailMan Message file to Message Text file
  1. I LLD0="XM" D
  1. .S I=0 F X XMREC Q:XMER<0 S:"FHS,BHS,MSH"[$E(XMRG,1,3) FLG=1 I FLG S HLCHAR=HLCHAR+$L(XMRG) D Q:XMER<0
  1. ..;If header segment, process it and set HDR equal to it
  1. ..I XMRG'="","FHS,BHS,MSH"[$E(XMRG,1,3) D
  1. ...I '$D(HDR) S HDR=XMRG,HLFS=$E(XMRG,4) I $E(HDR,1,3)="BHS" S MSA="MSA"_HLFS_$P($P(HDR,HLFS,10),$E(HDR,5),1)_HLFS_$P(HDR,HLFS,12)_HLFS_$P($P(HDR,HLFS,10),$E(HDR,5),2)
  1. ...S $P(XMRG,HLFS,8)=""
  1. ...S:$E(XMRG,1,3)="MSH" HLEVN=HLEVN+1
  1. ..;If acknowledgement segment, set MSA equal to it
  1. ..I $E(XMRG,1,3)="MSA",'$D(MSA),$E($G(HDR),1,3)="MSH" S MSA=XMRG
  1. ..S I=I+1,^HL(772,MTIEN,"IN",I,0)=XMRG
  1. S ^HL(772,MTIEN,"IN",0)="^^"_I_"^"_I_"^"_$$DT^XLFDT_"^"
  1. ;Update statistics in Message Text file for this entry
  1. D STATS^HLTF0(MTIEN,HLCHAR,HLEVN)
  1. Q
  1. MERGEOUT(MTIEN,LLD0,LLD1,HDR) ;Merge Text in Message Text File into
  1. ;Communication Server Module Logical Link File
  1. ;
  1. ;This is a routine call with parameter passing. There are no output
  1. ;parameters returned by this call.
  1. ;
  1. ;Required input parameters
  1. ; MTIEN = Internal entry number where message is stored in Message
  1. ; Text file
  1. ; LLD0 = Internal entry number where message is to be copied to in
  1. ; Logical Link file
  1. ; LLD1 = Internal entry number of IN QUEUE multiple entry in Logical
  1. ; Link file
  1. ; HDR = Name of the array that contains HL7 Header segment
  1. ; format: HLHDR - Used with indirection to build message in out
  1. ; queue
  1. ; This routine will first take the header information in the array
  1. ; specified by HDR and merge into the Message Text field of file 870.
  1. ; Then it will move the message contained in 772 (MTIEN) into 870.
  1. ;
  1. ;Check for required parameters
  1. I '$G(MTIEN)!('$G(LLD0))!('$G(LLD1))!(HDR="") Q
  1. ;
  1. ;-- initilize
  1. N I,X
  1. S I=0
  1. ;
  1. ;-- move header into 870 from HDR array
  1. S X="" F S X=$O(@HDR@(X)) Q:'X D
  1. . S I=I+1,^HLCS(870,LLD0,2,LLD1,1,I,0)=@HDR@(X)
  1. S I=I+1,^HLCS(870,LLD0,2,LLD1,1,I,0)=""
  1. ;
  1. ;Move data from Message Text file to Logical Link file
  1. S X=0 F S X=$O(^HL(772,MTIEN,"IN",X)) Q:X="" D
  1. . S I=I+1,^HLCS(870,LLD0,2,LLD1,1,I,0)=$G(^HL(772,MTIEN,"IN",X,0))
  1. ;
  1. ;-- update 0 node of message and format arrays
  1. S ^HLCS(870,LLD0,2,LLD1,1,0)="^^"_I_"^"_I_"^"_$$DT^XLFDT_"^"
  1. ;
  1. Q