IS00012(INTT,INDA,INA,INDEST,INQUE,INORDUZ,INORDIV) ;Compiled from script 'Generated: HL IHS IZV04 BATCH HEADER-O' on AUG 15, 2018
;Part 1
;Copyright 2018 SAIC
EN S X="ERROR^IS00012",@^%ZOSF("TRAP")
G START
ERROR ;
S X="",@^%ZOSF("TRAP") X ^INTHOS(1,3) D ERROR^INHS($$GETERR^%ZTOS)
Q 2
START ;Initialize variables
K ^UTILITY("INH",$J) S (MESSID,INA("MESSID"))=$$MESSID^INHD
K INUIF6 M INUIF6=INDA
K INREQERR,INHERR,INHERCNT,INV D SETDT^UTDT S DUZ(0)="@",DUZ("AG")="^1",DTIME=1 S (LCT,GERR)=0,INMODE="O",INVS=$P(^INRHSITE(1,0),U,12),INV=$S(INVS<2:"INV",1:"^UTILITY(""INV"",$J)"),(MULT,INSTERR)=0
S INHLDUZ=$O(^VA(200,"B","GIS,USER",0)),DUZ=$S($G(INHLDUZ):INHLDUZ,1:.5)
S BHLMIEN="12427"
I $G(^INTHL7M(BHLMIEN,4,1,0))]"" X $G(^INTHL7M(BHLMIEN,4,1,0))
K INSETID
S INSMIN=$S($P($G(^INRHSITE(1,0)),U,14):$P(^(0),U,14),1:2500)
S (DELIM,INDELIM)=$$FIELD^INHUT(),(SUBDELIM,INSUBDEL)=$$COMP^INHUT(),INSUBCOM=$$SUBCOMP^INHUT()
S INDELIMS=$$FIELD^INHUT_$$COMP^INHUT_$$REP^INHUT_$$ESC^INHUT_$$SUBCOMP^INHUT
;Entering DATA section.
S DELIM="|"
S SUBDELIM="^"
SET INSETID=0
D FHS^BYIMSEGS
;SET FHS1 = INSGX\^INTHL7FT(1,3)\\4\@ENC
S D0=INDA S X=$G(INA("ENC"))
S X1="^INTHL7FT(1,3)" X:$L($G(@X1)) $G(@X1) S X=$E(X,1,4)
S @INV@("FHS1")=X K DXS,D0
;SET FHS2 = INSGX\^INTHL7FT(1,3)\\180\@MSH3
S D0=INDA S X=$G(INA("MSH3"))
S X1="^INTHL7FT(1,3)" X:$L($G(@X1)) $G(@X1) S X=$E(X,1,180)
S @INV@("FHS2")=X K DXS,D0
;SET FHS3 = INSGX\^INTHL7FT(1,3)\\180\@MSH4
S D0=INDA S X=$G(INA("MSH4"))
S X1="^INTHL7FT(1,3)" X:$L($G(@X1)) $G(@X1) S X=$E(X,1,180)
S @INV@("FHS3")=X K DXS,D0
;SET FHS5 = INSGX\^INTHL7FT(6,3)\\26\@EVDT
S D0=INDA S X=$G(INA("EVDT"))
S X1="^INTHL7FT(6,3)" X:$L($G(@X1)) $G(@X1) S X=$E(X,1,26)
S @INV@("FHS5")=X K DXS,D0
D:'INVS MC^INHS
K LINE S LINE="",CP=0 S L1="FHS" S:$TR(L1,$G(SUBDELIM))="" L1="" D SETPIECE^INHU(.LINE,DELIM,1,L1,.CP) S L1=$G(@INV@("FHS1")) S:$TR(L1,$G(SUBDELIM))="" L1=""
D SETPIECE^INHU(.LINE,DELIM,2,L1,.CP) S L1=$G(@INV@("FHS2")) S:$TR(L1,$G(SUBDELIM))="" L1="" D SETPIECE^INHU(.LINE,DELIM,3,L1,.CP) S L1=$G(@INV@("FHS3"))
S:$TR(L1,$G(SUBDELIM))="" L1="" D SETPIECE^INHU(.LINE,DELIM,4,L1,.CP) S L1=$G(@INV@("FHS5")) S:$TR(L1,$G(SUBDELIM))="" L1="" D SETPIECE^INHU(.LINE,DELIM,6,L1,.CP)
S LCT=LCT+1,^UTILITY("INH",$J,LCT)=LINE I $D(LINE)>9 M ^UTILITY("INH",$J,LCT)=LINE
SET INSETID=0
D FHS^BYIMSEGS
;SET BHS1 = INSGX\^INTHL7FT(1,3)\\4\@ENC
S D0=INDA S X=$G(INA("ENC"))
S X1="^INTHL7FT(1,3)" X:$L($G(@X1)) $G(@X1) S X=$E(X,1,4)
S @INV@("BHS1")=X K DXS,D0
;SET BHS2 = INSGX\^INTHL7FT(1,3)\\180\@MSH3
S D0=INDA S X=$G(INA("MSH3"))
S X1="^INTHL7FT(1,3)" X:$L($G(@X1)) $G(@X1) S X=$E(X,1,180)
S @INV@("BHS2")=X K DXS,D0
;SET BHS3 = INSGX\^INTHL7FT(1,3)\\180\@MSH4
S D0=INDA S X=$G(INA("MSH4"))
S X1="^INTHL7FT(1,3)" X:$L($G(@X1)) $G(@X1) S X=$E(X,1,180)
S @INV@("BHS3")=X K DXS,D0
;SET BHS5 = INSGX\^INTHL7FT(6,3)\\26\@EVDT
S D0=INDA S X=$G(INA("EVDT"))
S X1="^INTHL7FT(6,3)" X:$L($G(@X1)) $G(@X1) S X=$E(X,1,26)
S @INV@("BHS5")=X K DXS,D0
D:'INVS MC^INHS
K LINE S LINE="",CP=0 S L1="BHS" S:$TR(L1,$G(SUBDELIM))="" L1="" D SETPIECE^INHU(.LINE,DELIM,1,L1,.CP) S L1=$G(@INV@("BHS1")) S:$TR(L1,$G(SUBDELIM))="" L1=""
D SETPIECE^INHU(.LINE,DELIM,2,L1,.CP) S L1=$G(@INV@("BHS2")) S:$TR(L1,$G(SUBDELIM))="" L1="" D SETPIECE^INHU(.LINE,DELIM,3,L1,.CP) S L1=$G(@INV@("BHS3"))
S:$TR(L1,$G(SUBDELIM))="" L1="" D SETPIECE^INHU(.LINE,DELIM,4,L1,.CP) S L1=$G(@INV@("BHS5")) S:$TR(L1,$G(SUBDELIM))="" L1="" D SETPIECE^INHU(.LINE,DELIM,6,L1,.CP)
S LCT=LCT+1,^UTILITY("INH",$J,LCT)=LINE I $D(LINE)>9 M ^UTILITY("INH",$J,LCT)=LINE
D:'INVS MC^INHS
;Entering END section.
I $G(INSTERR) Q $S($G(INREQERR)>INSTERR:INREQERR,1:INSTERR)
S UIF=$$NEWO^INHD(INDEST,"^UTILITY(""INH"",$J)",+$P($G(^INRHT(INTT,0)),U,12),INTT,MESSID,$G(INQUE),$G(INORDUZ),$G(INORDIV),.INUIF6,.INUIF7,$G(INA("INMIDGEN")))
I UIF<0 D ERROR^INHS("UIF creation failed",2) Q 2
Q 0
IS00012(INTT,INDA,INA,INDEST,INQUE,INORDUZ,INORDIV) ;Compiled from script 'Generated: HL IHS IZV04 BATCH HEADER-O' on AUG 15, 2018
+1 ;Part 1
+2 ;Copyright 2018 SAIC
EN SET X="ERROR^IS00012"
SET @^%ZOSF("TRAP")
+1 GOTO START
ERROR ;
+1 SET X=""
SET @^%ZOSF("TRAP")
XECUTE ^INTHOS(1,3)
DO ERROR^INHS($$GETERR^%ZTOS)
+2 QUIT 2
START ;Initialize variables
+1 KILL ^UTILITY("INH",$JOB)
SET (MESSID,INA("MESSID"))=$$MESSID^INHD
+2 KILL INUIF6
MERGE INUIF6=INDA
+3 KILL INREQERR,INHERR,INHERCNT,INV
DO SETDT^UTDT
SET DUZ(0)="@"
SET DUZ("AG")="^1"
SET DTIME=1
SET (LCT,GERR)=0
SET INMODE="O"
SET INVS=$PIECE(^INRHSITE(1,0),U,12)
SET INV=$SELECT(INVS<2:"INV",1:"^UTILITY(""INV"",$J)")
SET (MULT,INSTERR)=0
+4 SET INHLDUZ=$ORDER(^VA(200,"B","GIS,USER",0))
SET DUZ=$SELECT($GET(INHLDUZ):INHLDUZ,1:.5)
+5 SET BHLMIEN="12427"
+6 IF $GET(^INTHL7M(BHLMIEN,4,1,0))]""
XECUTE $GET(^INTHL7M(BHLMIEN,4,1,0))
+7 KILL INSETID
+8 SET INSMIN=$SELECT($PIECE($GET(^INRHSITE(1,0)),U,14):$PIECE(^(0),U,14),1:2500)
+9 SET (DELIM,INDELIM)=$$FIELD^INHUT()
SET (SUBDELIM,INSUBDEL)=$$COMP^INHUT()
SET INSUBCOM=$$SUBCOMP^INHUT()
+10 SET INDELIMS=$$FIELD^INHUT_$$COMP^INHUT_$$REP^INHUT_$$ESC^INHUT_$$SUBCOMP^INHUT
+11 ;Entering DATA section.
+12 SET DELIM="|"
+13 SET SUBDELIM="^"
+14 SET INSETID=0
+15 DO FHS^BYIMSEGS
+16 ;SET FHS1 = INSGX\^INTHL7FT(1,3)\\4\@ENC
+17 SET D0=INDA
SET X=$GET(INA("ENC"))
+18 SET X1="^INTHL7FT(1,3)"
IF $LENGTH($GET(@X1))
XECUTE $GET(@X1)
SET X=$EXTRACT(X,1,4)
+19 SET @INV@("FHS1")=X
KILL DXS,D0
+20 ;SET FHS2 = INSGX\^INTHL7FT(1,3)\\180\@MSH3
+21 SET D0=INDA
SET X=$GET(INA("MSH3"))
+22 SET X1="^INTHL7FT(1,3)"
IF $LENGTH($GET(@X1))
XECUTE $GET(@X1)
SET X=$EXTRACT(X,1,180)
+23 SET @INV@("FHS2")=X
KILL DXS,D0
+24 ;SET FHS3 = INSGX\^INTHL7FT(1,3)\\180\@MSH4
+25 SET D0=INDA
SET X=$GET(INA("MSH4"))
+26 SET X1="^INTHL7FT(1,3)"
IF $LENGTH($GET(@X1))
XECUTE $GET(@X1)
SET X=$EXTRACT(X,1,180)
+27 SET @INV@("FHS3")=X
KILL DXS,D0
+28 ;SET FHS5 = INSGX\^INTHL7FT(6,3)\\26\@EVDT
+29 SET D0=INDA
SET X=$GET(INA("EVDT"))
+30 SET X1="^INTHL7FT(6,3)"
IF $LENGTH($GET(@X1))
XECUTE $GET(@X1)
SET X=$EXTRACT(X,1,26)
+31 SET @INV@("FHS5")=X
KILL DXS,D0
+32 IF 'INVS
DO MC^INHS
+33 KILL LINE
SET LINE=""
SET CP=0
SET L1="FHS"
IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
DO SETPIECE^INHU(.LINE,DELIM,1,L1,.CP)
SET L1=$GET(@INV@("FHS1"))
IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
+34 DO SETPIECE^INHU(.LINE,DELIM,2,L1,.CP)
SET L1=$GET(@INV@("FHS2"))
IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
DO SETPIECE^INHU(.LINE,DELIM,3,L1,.CP)
SET L1=$GET(@INV@("FHS3"))
+35 IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
DO SETPIECE^INHU(.LINE,DELIM,4,L1,.CP)
SET L1=$GET(@INV@("FHS5"))
IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
DO SETPIECE^INHU(.LINE,DELIM,6,L1,.CP)
+36 SET LCT=LCT+1
SET ^UTILITY("INH",$JOB,LCT)=LINE
IF $DATA(LINE)>9
MERGE ^UTILITY("INH",$JOB,LCT)=LINE
+37 SET INSETID=0
+38 DO FHS^BYIMSEGS
+39 ;SET BHS1 = INSGX\^INTHL7FT(1,3)\\4\@ENC
+40 SET D0=INDA
SET X=$GET(INA("ENC"))
+41 SET X1="^INTHL7FT(1,3)"
IF $LENGTH($GET(@X1))
XECUTE $GET(@X1)
SET X=$EXTRACT(X,1,4)
+42 SET @INV@("BHS1")=X
KILL DXS,D0
+43 ;SET BHS2 = INSGX\^INTHL7FT(1,3)\\180\@MSH3
+44 SET D0=INDA
SET X=$GET(INA("MSH3"))
+45 SET X1="^INTHL7FT(1,3)"
IF $LENGTH($GET(@X1))
XECUTE $GET(@X1)
SET X=$EXTRACT(X,1,180)
+46 SET @INV@("BHS2")=X
KILL DXS,D0
+47 ;SET BHS3 = INSGX\^INTHL7FT(1,3)\\180\@MSH4
+48 SET D0=INDA
SET X=$GET(INA("MSH4"))
+49 SET X1="^INTHL7FT(1,3)"
IF $LENGTH($GET(@X1))
XECUTE $GET(@X1)
SET X=$EXTRACT(X,1,180)
+50 SET @INV@("BHS3")=X
KILL DXS,D0
+51 ;SET BHS5 = INSGX\^INTHL7FT(6,3)\\26\@EVDT
+52 SET D0=INDA
SET X=$GET(INA("EVDT"))
+53 SET X1="^INTHL7FT(6,3)"
IF $LENGTH($GET(@X1))
XECUTE $GET(@X1)
SET X=$EXTRACT(X,1,26)
+54 SET @INV@("BHS5")=X
KILL DXS,D0
+55 IF 'INVS
DO MC^INHS
+56 KILL LINE
SET LINE=""
SET CP=0
SET L1="BHS"
IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
DO SETPIECE^INHU(.LINE,DELIM,1,L1,.CP)
SET L1=$GET(@INV@("BHS1"))
IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
+57 DO SETPIECE^INHU(.LINE,DELIM,2,L1,.CP)
SET L1=$GET(@INV@("BHS2"))
IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
DO SETPIECE^INHU(.LINE,DELIM,3,L1,.CP)
SET L1=$GET(@INV@("BHS3"))
+58 IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
DO SETPIECE^INHU(.LINE,DELIM,4,L1,.CP)
SET L1=$GET(@INV@("BHS5"))
IF $TRANSLATE(L1,$GET(SUBDELIM))=""
SET L1=""
DO SETPIECE^INHU(.LINE,DELIM,6,L1,.CP)
+59 SET LCT=LCT+1
SET ^UTILITY("INH",$JOB,LCT)=LINE
IF $DATA(LINE)>9
MERGE ^UTILITY("INH",$JOB,LCT)=LINE
+60 IF 'INVS
DO MC^INHS
+61 ;Entering END section.
+62 IF $GET(INSTERR)
QUIT $SELECT($GET(INREQERR)>INSTERR:INREQERR,1:INSTERR)
+63 SET UIF=$$NEWO^INHD(INDEST,"^UTILITY(""INH"",$J)",+$PIECE($GET(^INRHT(INTT,0)),U,12),INTT,MESSID,$GET(INQUE),$GET(INORDUZ),$GET(INORDIV),.INUIF6,.INUIF7,$GET(INA("INMIDGEN")))
+64 IF UIF<0
DO ERROR^INHS("UIF creation failed",2)
QUIT 2
+65 QUIT 0