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

INHMGD1.m

Go to the documentation of this file.
  1. INHMGD1 ;CAR; 15 May 97 12:22;HL7 MESSAGING - MANAGEMENT OF DATA SOURCES
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; MODULE NAME:
  1. ; HL7 Messaging - Data Source Display and Validation
  1. ; Handle Field (INHMGD1).
  1. ;
  1. ; PURPOSE:
  1. ; Module INHMGD1 is used to extract information describing the
  1. ; source file and field for HL7 Messaging segment fields.
  1. ;
  1. IN(INDA,INP) ;Entere here with INDA= ien of message to process one message.
  1. ; Input:
  1. ; INDA = Internal Entry Number (IEN) of message
  1. ; INP = Flag, +INP>0 means create tab-delimited output,
  1. ; for exporting to desk-top applications, like MS-Access.
  1. ; Also, $E(INP,2,999) contains tab delimited Message and
  1. ; Segment information. Will be copied to INPDATA for printing.
  1. ;
  1. Q:'INDA
  1. N INMSG S INMSG=INDA
  1. ;Get message zero node, root#, and the root# & global name
  1. S INMSG(0)=$G(^INTHL7M(INMSG,0)) Q:INMSG(0)=""
  1. ;Quit on Inactive Message, if called from INALL
  1. I INALL=1 Q:$P(INMSG(0),U,8)
  1. ;
  1. N FIELD,FILE,FLVL,INHF2,IDENT,INAUDIT
  1. N INDB,INDTY,INEX,INDATA,INS,INSEQ,INSEG,INSG,INSYS
  1. N INX,INREPEAT,INREQ
  1. N INSVAR,TAB
  1. ;
  1. ;Initializations: NOTE: many of the following lines were copied
  1. ;from the input script generator routine, INHSGZ2.
  1. S (FLVL,IDENT,INREPEAT)=0
  1. ; FILE = Root file number from piece 5 of INMSG(0)
  1. ; FILE(0) = (Root file number)^^(Global Name)
  1. S FILE=+$P(INMSG(0),U,5) Q:'FILE
  1. Q:'$D(^DIC(+FILE,0,"GL")) S FILE(0)=FILE_U_^("GL")
  1. ;
  1. ;initialize abbreviated data listing
  1. S TAB=$C(9)
  1. S INP=$G(INP,0) I INP S INP="1"_$P(INMSG(0),U) ;$P 1
  1. ;
  1. ;You don't really need INSYS and INAUDIT, but it can't hurt.
  1. S INSYS=$$SC^INHUTIL1,INAUDIT=0
  1. S INEXIT=0
  1. ;
  1. ;BEGIN OUTPUT:
  1. ;Display header page(s) for this message
  1. D HSET ;setup 3 line header
  1. D PAGE1^INHMGD11(INMSG,INMSG(0),.INHDR)
  1. ;
  1. S INTRP=$G(^INTHL7M(INMSG,"S")) ;get script pointers
  1. S INMODE=$S($P(INTRP,U,2):1,1:0) ;incoming (0) or outgoing (1) message
  1. S INPARS=$S($P(INMSG(0),U,7)="P":1,1:0) ;is parse only set
  1. S INAM=$P(INMSG(0),U) ;the name of this message
  1. ;
  1. ;Order through the segments for this message using the "AS" x-ref.
  1. S INSEQ=""
  1. F S INSEQ=$O(^INTHL7M(INMSG,1,"AS",INSEQ)) Q:'INSEQ!INEXIT D
  1. .S INX=0
  1. .F S INX=$O(^INTHL7M(INMSG,1,"AS",INSEQ,INX)) Q:'INX!INEXIT D
  1. ..S INSEG(1)=^INTHL7M(INMSG,1,INX,0)
  1. ..;skip parent segments, they will be called recursively from SEG^
  1. ..I '$P(INSEG(1),U,11) D SEG^INHMGD2(INX,.FLVL,.FILE,.INP,.INERN)
  1. Q
  1. ;
  1. DASH(QTY,CH) ;Extrensic. Creates QTY copies of CH
  1. ; Inputs:
  1. ; QTY = numeric integer, how many copies of CH do you want in the
  1. ; output string.
  1. ; CH = character you want repeated. defaults to "-", hence the
  1. ; name DASH, but " " or anything else is ok.
  1. ; Output:
  1. ;
  1. N DASH S CH=$G(CH,"-"),$P(DASH,CH,QTY+1)=""
  1. Q DASH
  1. ;
  1. HSET ;set up header
  1. ; No Parameters.
  1. ; Description: The function HSET is used to set up the header with
  1. ; the current page and current date/time.
  1. ; Return:
  1. ; globally creates the INHDR array, containing quoted DATA strings
  1. ; for use by WRITE^INHMGD1.
  1. ;
  1. ; Code Begins:
  1. S INHDR(1)="""HL7 Messaging Data Source"",?(IOM-30+ING),INDT,?(IOM-10+ING),""Page: "",INPAGE"
  1. S INHDR(2)="""Message: "",INAM"
  1. S INHDR(3)=""""_$$DASH(78+INOFF)_""""
  1. Q
  1. ;
  1. ; No Parameters.
  1. ; Description: The function HEADER is used to display the header
  1. ; when reaching the end of the page/screen, and give
  1. ; the user the option to continue or to abort.
  1. ;
  1. N INA,X
  1. Q:$L($G(INP))>1
  1. Q:INEXIT
  1. ; Check for end of page/screen and give option to continue or quit
  1. I $E(IOST)="C",'$D(IO("Q")),IO=IO(0),INPAGE D
  1. .;
  1. .I $Y+2<IOSL F X=$S(IOSL>24:1,1:$Y):1:$S(IOSL>24:4,1:21) W !
  1. .Q:$Y+9<IOSL
  1. .S INEXIT=$$CR^UTSRD
  1. I INEXIT W @IOF Q
  1. ;Display new page and header
  1. S INPAGE=INPAGE+1 W @IOF
  1. S INA=0 F S INA=$O(INHDR(INA)) Q:'INA W !,?ING,@INHDR(INA)
  1. S INHF2=$G(INHF2)
  1. S:INHF2=-1 INHF2=0
  1. D:INHF2 HDR2
  1. Q
  1. ;
  1. HDR2 ;Header 2
  1. ; No Parameters.
  1. ; Output:
  1. ; generates a DATA line for writing by WRITE^INHMGD1, with the
  1. ; segment column labels. Used after the segment header and on each
  1. ; page after the page header.
  1. ; 12,"-" CHCS 11,"-"
  1. N DATA,X,X1
  1. ;
  1. S X=$S(INOFF:INOFF-11,1:0)
  1. S DATA="?0,"" R R L X"""
  1. S DATA=DATA_",?INS2-1,""------------ CHCS "",$$DASH((X)+14)"
  1. D WRITE
  1. S DATA="?0,""Seq# Len DT q p k f GIS Field Name"""
  1. S DATA=DATA_",?INS2-1,""Field#:File """
  1. I IOM<96 S DATA=DATA_",""(Field Name)"""
  1. I IOM'<96 S DATA=DATA_","" (Field Name)"""
  1. D WRITE
  1. S DATA=""""_$$DASH(78+INOFF)_"""" D WRITE
  1. S INHF2=0 ;means don't rewrite header
  1. Q
  1. ;
  1. WRITE ;output a line
  1. ; Input:
  1. ; DATA = passed globally, is a quoted line for use with W @DATA
  1. ;
  1. Q:INEXIT
  1. Q:INP
  1. I $Y>(IOSL-3) D HEADER
  1. W !,?ING,@DATA S DATA=""
  1. Q
  1. ;
  1. YN(INV,INN) ;Extrensic. Converts "" and 0 to NO and 1 to YES
  1. ; Inputs:
  1. ; INV = the value ["",0,1] to be converted to YES/NO or Y/N
  1. ; INN = control: 1 for "YES"/"NO", 0 for "Y"/"N"
  1. ;
  1. Q $E($S(INV="1":"YES",INV="0":"NO",1:INV),1,$S($G(INN):3,1:1))
  1. ;
  1. LKPRM(INX) ;Extrensic. Converts lookup parameter F,L,N,O & P to long form
  1. Q $S(INX="F":"FORCED LAYGO",INX="L":"LAYGO ALLOWED",INX="N":"NO LAYGO",INX="O":"LOOKUP ONLY",INX="P":"PARSE ONLY",1:INX)
  1. ;