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

IBTRHLU.m

Go to the documentation of this file.
  1. IBTRHLU ;ALB/JWS - Receive and store 278 Response message ;05-JUN-2014
  1. ;;2.0;INTEGRATED BILLING;**517**;21-MAR-94;Build 240
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;
  1. SPAR ; **Segment Parsing
  1. ;
  1. ; This tag will parse the current segment referenced by the HCT index
  1. ; and place the results in the IBSEG array.
  1. ;
  1. ; Input Variables
  1. ; HCT
  1. ;
  1. ; Output Variables
  1. ; IBSEG (ARRAY of fields in segment)
  1. ;
  1. N II,IJ,IK,IM,IS,ISBEG,ISCT,ISDATA,ISEND,ISPEC,LSDATA,NPC
  1. ;
  1. ;Reset IBSEG
  1. K IBSEG
  1. ;
  1. S ISCT="",II=-1,IS=0
  1. F S ISCT=$O(^TMP($J,"IBTRHLI",HCT,ISCT)) Q:ISCT="" D
  1. . S IS=IS+1
  1. . S ISDATA(IS)=$G(^TMP($J,"IBTRHLI",HCT,ISCT))
  1. . I $O(^TMP($J,"IBTRHLI",HCT,ISCT))="" S ISDATA(IS)=ISDATA(IS)_HLFS
  1. . S ISPEC(IS)=$L(ISDATA(IS),HLFS)
  1. . Q
  1. S IM=0,LSDATA=""
  1. LP ;**
  1. S IM=IM+1 Q:IM>IS
  1. S LSDATA=LSDATA_ISDATA(IM),NPC=ISPEC(IM)
  1. F IJ=1:1:NPC-1 D
  1. . S II=II+1,IBSEG(II)=$$CLNSTR($P(LSDATA,HLFS,IJ),$E(HL("ECH"),1,2)_$E(HL("ECH"),4),$E(HL("ECH")))
  1. . I II=0,IBSEG(0)="MSH" S II=II+1,IBSEG(1)="|"
  1. S LSDATA=$P(LSDATA,HLFS,NPC)
  1. G LP
  1. CLNSTR(STRING,CHARS,SUBSEP) ;** Remove extra trailing components and subcomponents in the HL7 seg
  1. N NUMPEC,PEC,RTSTRING
  1. S RTSTRING=$$RTRIMCH(STRING,CHARS)
  1. ; Now we have string w/o trailing chars, remove from subs
  1. S NUMPEC=$L(RTSTRING,SUBSEP)
  1. F PEC=1:1:NUMPEC S $P(RTSTRING,SUBSEP,PEC)=$$RTRIMCH($P(RTSTRING,SUBSEP,PEC),CHARS)
  1. Q RTSTRING
  1. ;
  1. RTRIMCH(STR,CHRS) ;** Remove the trailing chars from string
  1. N R,L
  1. S L=1,CHRS=$G(CHRS," ")
  1. F R=$L(STR):-1:1 Q:CHRS'[$E(STR,R)
  1. I L=R,(CHRS[$E(STR)) S STR=""
  1. Q $E(STR,L,R)
  1. ;