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

INHMGD8.m

Go to the documentation of this file.
  1. INHMGD8 ;CAR; 25 Apr 97 16:56;HL7 MESSAGING - PRINT SENSITIVITY ANALYSIS
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; MODULE NAME:
  1. ; HL7 Messaging - Print Sensitivity Analysis (INHMGD8).
  1. ;
  1. ; PURPOSE:
  1. ; Module INHMGD8 is used to print a Sensitivity Analysis
  1. ;
  1. INSPRNT(INSENS,INALL) ;Print the data
  1. ;Print from an array of requested file,field pairs or print ALL
  1. ; e.g. INSENS(2,.03)="",INSENS(2,.04)="",...INSENS(8550,.01)=""
  1. ;Inputs:
  1. ; INSENS = 1 for Sensitivity Analysis (SA), 0 for no (SA)
  1. ; INSENS(n,m) = array of requested file,field pairs
  1. ; INALL = 1 for SA for ALL, 0 for not ALL
  1. ;
  1. N IN7F,IN7M,IN7S,IND,INDATAA,INQ,INFIL,INFILT,INFLD,INFLDT
  1. N INFSO,INHDR,INIOM2,INIOM3,INJ,INMAX,INWAIT,INH
  1. ;
  1. U IO
  1. S INDATA="$C(32)"
  1. ;
  1. ;setup some text constants
  1. S INH(1)="HL7 Messaging Data Sources"
  1. S INH(2)=" Sensitivity Analysis"
  1. S INH(3)="-----Corresponding HL7: Message/Segment/Field Names"
  1. ;
  1. D ;setup Data printing format, based on page width (IOM)
  1. .;------------------------------------------------------------
  1. .I IOM<96 D Q ;set up for an 80 character line
  1. ..S IND(1)="$E("" ""_IN7M,1,60)"
  1. ..S IND(2)="$E("" ""_IN7S,1,42),?44,$E(IN7F,1,36)"
  1. ..;S IND(3)="$C(32)"
  1. .;------------------------------------------------------------
  1. .I IOM<132 D Q ;set up for a 96 character line
  1. ..S IND(1)="$E("" ""_IN7M,1,60)"
  1. ..S IND(2)="$E("" ""_IN7S,1,45),?48,$E(IN7F,1,48)"
  1. .;------------------------------------------------------------
  1. .;IOM is 132; set up for a 132 character line
  1. .S IND(1)="$E("" ""_IN7M,1,44),?46,$E(IN7S,1,42),?90,$E(IN7F,1,42)"
  1. ;
  1. ;setup header lines
  1. S INHDR(1)="INH(1),INH(2),?(IOM-30),INDT,?(IOM-10),""PAGE: "",INPAGE"
  1. S INHDR(2)="""Field#/Name"",?$S(IOM>96:IOM\3+2,IOM>80:IOM\2-3,1:IOM\2-3),""File Number/Name"""
  1. S INHDR(3)="INH(3)_$$DASH^INHMGD1(IOM-54)"
  1. S INHDR(4)="INFLD_"" "",?6,INFLDT,?$S(IOM>96:IOM\3,1:IOM\2-5),"" File: ""_$J(INFIL,7)_"" ""_INFILT"
  1. ;
  1. ;begin printing
  1. ;
  1. ;check for individual file,field SA
  1. I $O(INSENS(0)),'INALL D
  1. .S INFIL=0 F S INFIL=$O(INSENS(INFIL)) Q:'INFIL!$G(DUOUT) D
  1. ..S INFLD=0 F S INFLD=$O(INSENS(INFIL,INFLD)) Q:'INFLD!$G(DUOUT) D
  1. ...S INFILT=$P($G(^DIC(INFIL,0)),U)
  1. ...S:INFILT="" INFILT=$P($G(^DD(INFIL,0)),U)
  1. ...S INFLDT=$P($G(^DD(INFIL,INFLD,0)),U)
  1. ...D PHEADER(4,.INHDR)
  1. ...S INQ="^UTILITY(""INHMGD"","_$J_",""A"","_INFIL_","_INFLD_")"
  1. ...F S INQ=$Q(@INQ) Q:$QS(INQ,4)'=INFIL!($QS(INQ,5)'=INFLD)!$G(DUOUT) D
  1. ....S IN7F=$P($G(^INTHL7F(+$QS(INQ,6),0)),U) Q:$$INERS(3)
  1. ....S IN7S=$P($G(^INTHL7S(+$QS(INQ,7),0)),U) Q:$$INERS(4)
  1. ....S IN7M=$P($G(^INTHL7M(+$QS(INQ,8),0)),U) Q:$$INERS(5)
  1. ....S INJ=0 F S INJ=$O(IND(INJ)) Q:'INJ D
  1. .....S INDATA=IND(INJ) D INW(INJ=1)
  1. ;
  1. ;check for SA on ALL file,field pairs
  1. I INALL D
  1. .S INFSO=0 ;store the old sum (should change with new INFIL or INFLD)
  1. .S INQ="^UTILITY(""INHMGD"","_$J_",""A"")"
  1. .F S INQ=$Q(@INQ) Q:$QS(INQ,3)'["A"!$G(DUOUT) D
  1. ..S INFIL=$QS(INQ,4) Q:$$INERS(1)
  1. ..S INFLD=$QS(INQ,5) Q:$$INERS(2)
  1. ..I INFIL+INFLD'=INFSO D
  1. ...S INFILT=$P($G(^DIC(INFIL,0)),U)
  1. ...S:INFILT="" INFILT=$P($G(^DD(INFIL,0)),U)
  1. ...S INFLDT=$P($G(^DD(INFIL,INFLD,0)),U)
  1. ...D PHEADER(4,.INHDR)
  1. ..S INFSO=INFIL+INFLD
  1. ..S IN7F=$P($G(^INTHL7F(+$QS(INQ,6),0)),U) Q:$$INERS(3)
  1. ..S IN7S=$P($G(^INTHL7S(+$QS(INQ,7),0)),U) Q:$$INERS(4)
  1. ..S IN7M=$P($G(^INTHL7M(+$QS(INQ,8),0)),U) Q:$$INERS(5)
  1. ..S INJ=0 F S INJ=$O(IND(INJ)) Q:'INJ D
  1. ...S INDATA=IND(INJ) D INW(INJ=1)
  1. K INSENS
  1. Q
  1. ;
  1. INERS(J) ;check for error, and if in error, log it.
  1. ; Input:
  1. ; INN = error to check for
  1. ; Output:
  1. ; Integer: 1=error found, 0=no error found
  1. ; Purpose: check for specific errors. e.g. J=2:check that INFLD has
  1. ; a numeric value, J=4:see if IN7S is nil.
  1. ;
  1. N INQ
  1. S INQ=$S(J=0:0,J=1:'INFIL,J=2:'INFLD,J=3:IN7F="",J=4:IN7S="",J=5:IN7M="",1:1),INERN=INERN+.001
  1. S:INQ ^UTILITY("INHMGD",$J,"E",+IN7M,+IN7S,+IN7F)=+INFIL_U_+INFLD
  1. Q INQ
  1. ;
  1. INW(INTOP) ;Write the Data
  1. ; Inputs:
  1. ; INTOP = flag, 1 = check if new page needed
  1. ; INDATA = input print data
  1. ; Outputs:
  1. ; DUOUT = returns an exit request when user "^" out
  1. ; INDATA = reset to """ """
  1. ;
  1. Q:$G(DUOUT)
  1. S INTOP=$G(INTOP)
  1. ;
  1. ;check for room left on this page
  1. I INTOP,(IOSL-$Y)<4 D PHEADER(1,.INHDR)
  1. ;
  1. W !,?ING,@INDATA S INDATA="$C(32)"
  1. Q
  1. ;
  1. PHEADER(INLN,INHDR) ;print the header
  1. ; Inputs:
  1. ; INLN = where to start printing the header array
  1. ; skips printing date & page# if you start at 2
  1. ; INHDR = header array
  1. ; INFLD = used in INHDR(4) - Field Number
  1. ; INFLDT = used in INHDR(4) - Field Name
  1. ; INFIL = used in INHDR(4) - File Number
  1. ; INFILT = used in INHDR(4) - File Name
  1. ; INPAGE = page number of last previous page
  1. ; Outputs:
  1. ; INPAGE = page number used on this page
  1. ;
  1. N INK
  1. I '$D(INHDR) D
  1. .F INK=1:1:4 S INHDR(INK)=$G(INHDR(INK))
  1. .S INHDR(10)="$$DASH^INHMGD1(IOM-3)"
  1. ;
  1. ;1st page need line 1 of the header
  1. I 'INPAGE S INLN=1
  1. ;
  1. ;make sure there is room left on this page
  1. I (IOSL-$Y)<(6-INLN) S INLN=1
  1. ;
  1. ;if we are printing line 1 of the header, it means we need a new page
  1. ;also, if we are interactive, wait at the end of the page
  1. I INLN=1 S INPAGE=INPAGE+1 I INPAGE>1,$E(IOST)="C",'$D(IO("Q")) D
  1. .I IO=IO(0) S DUOUT=$$CR^UTSRD
  1. ;
  1. ;need new page with new header?
  1. I INLN=1 W @IOF N INK S INK=0 F S INK=$O(INHDR(INK)) Q:INK>10!'INK D
  1. .W !,?ING,@INHDR(INK)
  1. ;
  1. ;just the header
  1. I INLN'=1 N INK S INK=3 W ! F S INK=$O(INHDR(INK)) Q:INK>9!'INK D
  1. .W !,?ING,@INHDR(INK)
  1. Q
  1. ;