DGENUPLB ;ALB/TDM,KUM - PROCESS INCOMING (Z11 EVENT TYPE) HL7 MESSAGES ;4/10/13 6:53pm
;;5.3;REGISTRATION;**625,763,842,871,952,977,1014,1082**;Aug 13,1993;Build 29
;
EP N MSGARY
D CHECK
Q
;
CHECK ;Check for Rated Disability Changes
Q:'$D(DGELG)
N RDOCC,TMPARY,RD,RDOCC1,RDOCC2,RDFLG,RDNOD
;
;Change in Rated Disabilities
I $D(OLDELG("RATEDIS")) D
.S RDOCC=0 F S RDOCC=$O(OLDELG("RATEDIS",RDOCC)) Q:RDOCC="" D
..S RD=$P(OLDELG("RATEDIS",RDOCC,"RD"),"^") Q:RD=""
..S TMPARY(RD)=RDOCC
;
I $D(DGELG("RATEDIS")) D
.S RDOCC=0 F S RDOCC=$O(DGELG("RATEDIS",RDOCC)) Q:RDOCC="" D
..S RD=$P(DGELG("RATEDIS",RDOCC,"RD"),"^") Q:RD=""
..S $P(TMPARY(RD),"^",2)=RDOCC
;
I $D(TMPARY) D
.S RD=""
.F S RD=$O(TMPARY(RD)) Q:RD="" D
..S RDOCC2=+$P(TMPARY(RD),"^",2) Q:'RDOCC2
..S RDOCC1=+$P(TMPARY(RD),"^")
..I 'RDOCC1 D STOR390 Q
..S RDFLG=0
..F RDNOD="RD","PER","RDSC","RDEXT","RDORIG","RDCURR" D Q:RDFLG
...I $G(OLDELG("RATEDIS",RDOCC1,RDNOD))'=$G(DGELG("RATEDIS",RDOCC2,RDNOD)) D STOR390
Q
;
STOR390 ;Store Data in file# 390
S RDFLG=1
N DATA,DA
S DATA(.01)=$$NOW^XLFDT
S DATA(2)=DFN
S DATA(3)=DGELG("RATEDIS",RDOCC2,"RD")
S DATA(4)=DGELG("RATEDIS",RDOCC2,"PER")
S DATA(5)=DGELG("RATEDIS",RDOCC2,"RDEXT")
S DATA(6)=DGELG("RATEDIS",RDOCC2,"RDORIG")
S DATA(7)=DGELG("RATEDIS",RDOCC2,"RDCURR")
I '$$ADD^DGENDBS(390,,.DATA) S ERROR="FILEMAN FAILED TO ADD RATED DISABILITY UPLOAD AUDIT"
Q
;
ZE2 ; Process ZE2 segment
N HL7REP,HL7SC,SUB
S HL7SC=$E(HLECH,1)
S DGPAT("PENAEFDT")=$$CONVERT^DGENUPL1($P(SEG(1),HL7SC),"DATE",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZE2 SEGMENT , SEQ 1-1",.ERRCOUNT) Q
S DGPAT("PENTRMDT")=$$CONVERT^DGENUPL1($P(SEG(1),HL7SC,2),"DATE",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZE2 SEGMENT , SEQ 1-2",.ERRCOUNT) Q
S DGPAT("PENAREAS")=$$CONVERT^DGENUPL1($P(SEG(2),HL7SC),"PENSIONCD",.ERRCOUNT)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZE2 SEGMENT , SEQ 2",.ERRCOUNT) Q
F HL7REP=1:1:4 D Q:ERROR
.Q:$P($P(SEG(3),"|",HL7REP),HL7SC)=""
.S SUB="PENTRMR"_HL7REP
.S DGPAT(SUB)=$$CONVERT^DGENUPL1($P($P(SEG(3),"|",HL7REP),HL7SC),"PENSIONCD",.ERRCOUNT)
.I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZE2 SEGMENT , SEQ 3",.ERRCOUNT)
;
; Convert to deletion indicator if null
N SUB F SUB="PENAEFDT","PENTRMDT","PENAREAS","PENTRMR1","PENTRMR2","PENTRMR3","PENTRMR4" S:$G(DGPAT(SUB))="" DGPAT(SUB)="@"
Q
;
ZHF ; DG*5.3*1082 - Process ZHF segment
S ERROR=0
S DGZHF("PPCATEGORY")=$$CONVERT^DGENUPL1(SEG(1))
I DGZHF("PPCATEGORY")'="" D CHK^DIE(33.12,.02,,DGZHF("PPCATEGORY"),.ERROR) I ERROR="^" S ERROR=1
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZHF SEGMENT , SEQ 1",.ERRCOUNT) Q
S DGZHF("PPCATCHGDT")=$$CONVERT^DGENUPL1(SEG(2),"TS",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZHF SEGMENT , SEQ 2",.ERRCOUNT) Q
Q
;
ZHP ;Process ZHP segment
N CTR
S CTR=$O(DGHBP(""),-1)+1
S $P(DGHBP(CTR),U)=$$CONVERT^DGENUPL1(SEG(2),"HBP",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZHP SEGMENT , SEQ 2",.ERRCOUNT) Q
S $P(DGHBP(CTR),U,2)=$$CONVERT^DGENUPL1(SEG(3),"TS",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZHP SEGMENT , SEQ 3",.ERRCOUNT) Q
S $P(DGHBP(CTR),U,3)=.5 ;Postmaster
S $P(DGHBP(CTR),U,4)=$$CONVERT^DGENUPL1(SEG(5),"INSTITUTION",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZHP SEGMENT , SEQ 5",.ERRCOUNT) Q
S $P(DGHBP(CTR),U,5)=$$CONVERT^DGENUPL1(SEG(4),,.ERROR)
I (($P(DGHBP(CTR),U,5)'="V")&($P(DGHBP(CTR),U,5)'="E")) S ERROR=1
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"BAD VALUE, ZHP SEGMENT , SEQ 4",.ERRCOUNT) Q
Q
;
ZTE ; process ZTE segment DG*5.3*952
N CHKFLG,CNT,EDITTS,ENTBY,FCLTY,ORIGTS,QFLG,SUBDT,TYPE
S TYPE=$$CONVERT^DGENUPL1(SEG(4),,.ERROR) I "^A^D^P^"'[(U_TYPE_U) S ERROR=1
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 4",.ERRCOUNT) Q
; fields common to all 3 request types
S SUBDT=$$CONVERT^DGENUPL1(SEG(2),"DATE",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 2",.ERRCOUNT) Q
S CHKFLG=$S(SUBDT="@":0,1:1)
S ORIGTS=$$CONVERT^DGENUPL1(SEG(3),"TS",.ERROR)
I ERROR!(ORIGTS="") D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 3",.ERRCOUNT) Q
S EDITTS=$$CONVERT^DGENUPL1(SEG(5),"TS",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 5",.ERRCOUNT) Q
S ENTBY=$$GET1^DIQ(200,".5,",.01) ; DG*5.3*977 OTH-EXT set user to POSTMASTER instead of value from ZTE.6
S FCLTY=$$CONVERT^DGENUPL1(SEG(7),"INSTITUTION",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 7",.ERRCOUNT) Q
S QFLG=0
I TYPE="P" D Q:QFLG
.I $G(DGOTH("P"))'="" S ERROR=1
.I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid ZTE segment, only one pending request is allowed.",.ERRCOUNT) S QFLG=1 Q
.S DGOTH("P")="1"_U_SUBDT_U_ENTBY_U_FCLTY_U_ORIGTS_U_EDITTS
.Q
I TYPE="D" D Q:QFLG
.S CNT=$O(DGOTH("D",""),-1)+1
.S DGOTH("D",CNT)=SUBDT
.S $P(DGOTH("D",CNT),U,2)=$$CONVERT^DGENUPL1(SEG(13),,.ERROR)
.I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 13",.ERRCOUNT) S QFLG=1 Q
.S DGOTH("D",CNT)=DGOTH("D",CNT)_U_ENTBY_U_FCLTY_U_ORIGTS_U_EDITTS
.Q
I TYPE="A" D Q:QFLG
.S CNT=$O(DGOTH("A",""),-1)+1
.S DGOTH("A",CNT)=$$CONVERT^DGENUPL1(SEG(8),,.ERROR)
.I CHKFLG,+DGOTH("A",CNT)'>0 S ERROR=1
.I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 8",.ERRCOUNT) S QFLG=1 Q
.S $P(DGOTH("A",CNT),U,2)=$$CONVERT^DGENUPL1(SEG(9),,.ERROR)
.I CHKFLG,+$P(DGOTH("A",CNT),U,2)'>0 S ERROR=1
.I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 9",.ERRCOUNT) S QFLG=1 Q
.S $P(DGOTH("A",CNT),U,3)=SUBDT
.S $P(DGOTH("A",CNT),U,4)=$$CONVERT^DGENUPL1(SEG(11),,.ERROR)
.I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 11",.ERRCOUNT) S QFLG=1 Q
.S $P(DGOTH("A",CNT),U,5)=$$CONVERT^DGENUPL1(SEG(10),"DATE",.ERROR)
.I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 10",.ERRCOUNT) S QFLG=1 Q
.S $P(DGOTH("A",CNT),U,6)=$$CONVERT^DGENUPL1(SEG(12),"DATE",.ERROR)
.I CHKFLG,$P(DGOTH("A",CNT),U,6)="" S ERROR=1
.I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZTE segment, field 12",.ERRCOUNT) S QFLG=1 Q
.S DGOTH("A",CNT)=DGOTH("A",CNT)_U_ENTBY_U_FCLTY_U_ORIGTS_U_EDITTS
.Q
Q
ZCE ; process ZCE segment DG*5.3*1014
N DGCPCD,DGEFDT,DGEDDT,DGLUTS
S DGCPCD=$$CONVERT^DGENUPL1(SEG(2),,.ERROR) I "^A^C^I^T^"'[(U_DGCPCD_U) S ERROR=1
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZCE segment, field 2",.ERRCOUNT) Q
S DGEFDT=$$CONVERT^DGENUPL1(SEG(3),"DATE",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZCE segment, field 3",.ERRCOUNT) Q
S DGEDDT=$$CONVERT^DGENUPL1(SEG(4),"DATE",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZCE segment, field 4",.ERRCOUNT) Q
S DGLUTS=$$CONVERT^DGENUPL1(SEG(5),"TS",.ERROR)
I ERROR D ADDERROR^DGENUPL(MSGID,$G(DGPAT("SSN")),"Invalid value in ZCE segment, field 5",.ERRCOUNT) Q
S DGCCPC=DGCCPC+1
S DGCCPG(DGCCPC)=DGCPCD_U_DGEFDT_U_DGEDDT_U_DGLUTS
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGENUPLB 7552 printed Dec 13, 2024@02:43:26 Page 2
DGENUPLB ;ALB/TDM,KUM - PROCESS INCOMING (Z11 EVENT TYPE) HL7 MESSAGES ;4/10/13 6:53pm
+1 ;;5.3;REGISTRATION;**625,763,842,871,952,977,1014,1082**;Aug 13,1993;Build 29
+2 ;
EP NEW MSGARY
+1 DO CHECK
+2 QUIT
+3 ;
CHECK ;Check for Rated Disability Changes
+1 if '$DATA(DGELG)
QUIT
+2 NEW RDOCC,TMPARY,RD,RDOCC1,RDOCC2,RDFLG,RDNOD
+3 ;
+4 ;Change in Rated Disabilities
+5 IF $DATA(OLDELG("RATEDIS"))
Begin DoDot:1
+6 SET RDOCC=0
FOR
SET RDOCC=$ORDER(OLDELG("RATEDIS",RDOCC))
if RDOCC=""
QUIT
Begin DoDot:2
+7 SET RD=$PIECE(OLDELG("RATEDIS",RDOCC,"RD"),"^")
if RD=""
QUIT
+8 SET TMPARY(RD)=RDOCC
End DoDot:2
End DoDot:1
+9 ;
+10 IF $DATA(DGELG("RATEDIS"))
Begin DoDot:1
+11 SET RDOCC=0
FOR
SET RDOCC=$ORDER(DGELG("RATEDIS",RDOCC))
if RDOCC=""
QUIT
Begin DoDot:2
+12 SET RD=$PIECE(DGELG("RATEDIS",RDOCC,"RD"),"^")
if RD=""
QUIT
+13 SET $PIECE(TMPARY(RD),"^",2)=RDOCC
End DoDot:2
End DoDot:1
+14 ;
+15 IF $DATA(TMPARY)
Begin DoDot:1
+16 SET RD=""
+17 FOR
SET RD=$ORDER(TMPARY(RD))
if RD=""
QUIT
Begin DoDot:2
+18 SET RDOCC2=+$PIECE(TMPARY(RD),"^",2)
if 'RDOCC2
QUIT
+19 SET RDOCC1=+$PIECE(TMPARY(RD),"^")
+20 IF 'RDOCC1
DO STOR390
QUIT
+21 SET RDFLG=0
+22 FOR RDNOD="RD","PER","RDSC","RDEXT","RDORIG","RDCURR"
Begin DoDot:3
+23 IF $GET(OLDELG("RATEDIS",RDOCC1,RDNOD))'=$GET(DGELG("RATEDIS",RDOCC2,RDNOD))
DO STOR390
End DoDot:3
if RDFLG
QUIT
End DoDot:2
End DoDot:1
+24 QUIT
+25 ;
STOR390 ;Store Data in file# 390
+1 SET RDFLG=1
+2 NEW DATA,DA
+3 SET DATA(.01)=$$NOW^XLFDT
+4 SET DATA(2)=DFN
+5 SET DATA(3)=DGELG("RATEDIS",RDOCC2,"RD")
+6 SET DATA(4)=DGELG("RATEDIS",RDOCC2,"PER")
+7 SET DATA(5)=DGELG("RATEDIS",RDOCC2,"RDEXT")
+8 SET DATA(6)=DGELG("RATEDIS",RDOCC2,"RDORIG")
+9 SET DATA(7)=DGELG("RATEDIS",RDOCC2,"RDCURR")
+10 IF '$$ADD^DGENDBS(390,,.DATA)
SET ERROR="FILEMAN FAILED TO ADD RATED DISABILITY UPLOAD AUDIT"
+11 QUIT
+12 ;
ZE2 ; Process ZE2 segment
+1 NEW HL7REP,HL7SC,SUB
+2 SET HL7SC=$EXTRACT(HLECH,1)
+3 SET DGPAT("PENAEFDT")=$$CONVERT^DGENUPL1($PIECE(SEG(1),HL7SC),"DATE",.ERROR)
+4 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZE2 SEGMENT , SEQ 1-1",.ERRCOUNT)
QUIT
+5 SET DGPAT("PENTRMDT")=$$CONVERT^DGENUPL1($PIECE(SEG(1),HL7SC,2),"DATE",.ERROR)
+6 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZE2 SEGMENT , SEQ 1-2",.ERRCOUNT)
QUIT
+7 SET DGPAT("PENAREAS")=$$CONVERT^DGENUPL1($PIECE(SEG(2),HL7SC),"PENSIONCD",.ERRCOUNT)
+8 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZE2 SEGMENT , SEQ 2",.ERRCOUNT)
QUIT
+9 FOR HL7REP=1:1:4
Begin DoDot:1
+10 if $PIECE($PIECE(SEG(3),"|",HL7REP),HL7SC)=""
QUIT
+11 SET SUB="PENTRMR"_HL7REP
+12 SET DGPAT(SUB)=$$CONVERT^DGENUPL1($PIECE($PIECE(SEG(3),"|",HL7REP),HL7SC),"PENSIONCD",.ERRCOUNT)
+13 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZE2 SEGMENT , SEQ 3",.ERRCOUNT)
End DoDot:1
if ERROR
QUIT
+14 ;
+15 ; Convert to deletion indicator if null
+16 NEW SUB
FOR SUB="PENAEFDT","PENTRMDT","PENAREAS","PENTRMR1","PENTRMR2","PENTRMR3","PENTRMR4"
if $GET(DGPAT(SUB))=""
SET DGPAT(SUB)="@"
+17 QUIT
+18 ;
ZHF ; DG*5.3*1082 - Process ZHF segment
+1 SET ERROR=0
+2 SET DGZHF("PPCATEGORY")=$$CONVERT^DGENUPL1(SEG(1))
+3 IF DGZHF("PPCATEGORY")'=""
DO CHK^DIE(33.12,.02,,DGZHF("PPCATEGORY"),.ERROR)
IF ERROR="^"
SET ERROR=1
+4 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZHF SEGMENT , SEQ 1",.ERRCOUNT)
QUIT
+5 SET DGZHF("PPCATCHGDT")=$$CONVERT^DGENUPL1(SEG(2),"TS",.ERROR)
+6 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZHF SEGMENT , SEQ 2",.ERRCOUNT)
QUIT
+7 QUIT
+8 ;
ZHP ;Process ZHP segment
+1 NEW CTR
+2 SET CTR=$ORDER(DGHBP(""),-1)+1
+3 SET $PIECE(DGHBP(CTR),U)=$$CONVERT^DGENUPL1(SEG(2),"HBP",.ERROR)
+4 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZHP SEGMENT , SEQ 2",.ERRCOUNT)
QUIT
+5 SET $PIECE(DGHBP(CTR),U,2)=$$CONVERT^DGENUPL1(SEG(3),"TS",.ERROR)
+6 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZHP SEGMENT , SEQ 3",.ERRCOUNT)
QUIT
+7 ;Postmaster
SET $PIECE(DGHBP(CTR),U,3)=.5
+8 SET $PIECE(DGHBP(CTR),U,4)=$$CONVERT^DGENUPL1(SEG(5),"INSTITUTION",.ERROR)
+9 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZHP SEGMENT , SEQ 5",.ERRCOUNT)
QUIT
+10 SET $PIECE(DGHBP(CTR),U,5)=$$CONVERT^DGENUPL1(SEG(4),,.ERROR)
+11 IF (($PIECE(DGHBP(CTR),U,5)'="V")&($PIECE(DGHBP(CTR),U,5)'="E"))
SET ERROR=1
+12 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"BAD VALUE, ZHP SEGMENT , SEQ 4",.ERRCOUNT)
QUIT
+13 QUIT
+14 ;
ZTE ; process ZTE segment DG*5.3*952
+1 NEW CHKFLG,CNT,EDITTS,ENTBY,FCLTY,ORIGTS,QFLG,SUBDT,TYPE
+2 SET TYPE=$$CONVERT^DGENUPL1(SEG(4),,.ERROR)
IF "^A^D^P^"'[(U_TYPE_U)
SET ERROR=1
+3 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 4",.ERRCOUNT)
QUIT
+4 ; fields common to all 3 request types
+5 SET SUBDT=$$CONVERT^DGENUPL1(SEG(2),"DATE",.ERROR)
+6 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 2",.ERRCOUNT)
QUIT
+7 SET CHKFLG=$SELECT(SUBDT="@":0,1:1)
+8 SET ORIGTS=$$CONVERT^DGENUPL1(SEG(3),"TS",.ERROR)
+9 IF ERROR!(ORIGTS="")
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 3",.ERRCOUNT)
QUIT
+10 SET EDITTS=$$CONVERT^DGENUPL1(SEG(5),"TS",.ERROR)
+11 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 5",.ERRCOUNT)
QUIT
+12 ; DG*5.3*977 OTH-EXT set user to POSTMASTER instead of value from ZTE.6
SET ENTBY=$$GET1^DIQ(200,".5,",.01)
+13 SET FCLTY=$$CONVERT^DGENUPL1(SEG(7),"INSTITUTION",.ERROR)
+14 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 7",.ERRCOUNT)
QUIT
+15 SET QFLG=0
+16 IF TYPE="P"
Begin DoDot:1
+17 IF $GET(DGOTH("P"))'=""
SET ERROR=1
+18 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid ZTE segment, only one pending request is allowed.",.ERRCOUNT)
SET QFLG=1
QUIT
+19 SET DGOTH("P")="1"_U_SUBDT_U_ENTBY_U_FCLTY_U_ORIGTS_U_EDITTS
+20 QUIT
End DoDot:1
if QFLG
QUIT
+21 IF TYPE="D"
Begin DoDot:1
+22 SET CNT=$ORDER(DGOTH("D",""),-1)+1
+23 SET DGOTH("D",CNT)=SUBDT
+24 SET $PIECE(DGOTH("D",CNT),U,2)=$$CONVERT^DGENUPL1(SEG(13),,.ERROR)
+25 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 13",.ERRCOUNT)
SET QFLG=1
QUIT
+26 SET DGOTH("D",CNT)=DGOTH("D",CNT)_U_ENTBY_U_FCLTY_U_ORIGTS_U_EDITTS
+27 QUIT
End DoDot:1
if QFLG
QUIT
+28 IF TYPE="A"
Begin DoDot:1
+29 SET CNT=$ORDER(DGOTH("A",""),-1)+1
+30 SET DGOTH("A",CNT)=$$CONVERT^DGENUPL1(SEG(8),,.ERROR)
+31 IF CHKFLG
IF +DGOTH("A",CNT)'>0
SET ERROR=1
+32 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 8",.ERRCOUNT)
SET QFLG=1
QUIT
+33 SET $PIECE(DGOTH("A",CNT),U,2)=$$CONVERT^DGENUPL1(SEG(9),,.ERROR)
+34 IF CHKFLG
IF +$PIECE(DGOTH("A",CNT),U,2)'>0
SET ERROR=1
+35 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 9",.ERRCOUNT)
SET QFLG=1
QUIT
+36 SET $PIECE(DGOTH("A",CNT),U,3)=SUBDT
+37 SET $PIECE(DGOTH("A",CNT),U,4)=$$CONVERT^DGENUPL1(SEG(11),,.ERROR)
+38 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 11",.ERRCOUNT)
SET QFLG=1
QUIT
+39 SET $PIECE(DGOTH("A",CNT),U,5)=$$CONVERT^DGENUPL1(SEG(10),"DATE",.ERROR)
+40 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 10",.ERRCOUNT)
SET QFLG=1
QUIT
+41 SET $PIECE(DGOTH("A",CNT),U,6)=$$CONVERT^DGENUPL1(SEG(12),"DATE",.ERROR)
+42 IF CHKFLG
IF $PIECE(DGOTH("A",CNT),U,6)=""
SET ERROR=1
+43 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZTE segment, field 12",.ERRCOUNT)
SET QFLG=1
QUIT
+44 SET DGOTH("A",CNT)=DGOTH("A",CNT)_U_ENTBY_U_FCLTY_U_ORIGTS_U_EDITTS
+45 QUIT
End DoDot:1
if QFLG
QUIT
+46 QUIT
ZCE ; process ZCE segment DG*5.3*1014
+1 NEW DGCPCD,DGEFDT,DGEDDT,DGLUTS
+2 SET DGCPCD=$$CONVERT^DGENUPL1(SEG(2),,.ERROR)
IF "^A^C^I^T^"'[(U_DGCPCD_U)
SET ERROR=1
+3 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZCE segment, field 2",.ERRCOUNT)
QUIT
+4 SET DGEFDT=$$CONVERT^DGENUPL1(SEG(3),"DATE",.ERROR)
+5 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZCE segment, field 3",.ERRCOUNT)
QUIT
+6 SET DGEDDT=$$CONVERT^DGENUPL1(SEG(4),"DATE",.ERROR)
+7 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZCE segment, field 4",.ERRCOUNT)
QUIT
+8 SET DGLUTS=$$CONVERT^DGENUPL1(SEG(5),"TS",.ERROR)
+9 IF ERROR
DO ADDERROR^DGENUPL(MSGID,$GET(DGPAT("SSN")),"Invalid value in ZCE segment, field 5",.ERRCOUNT)
QUIT
+10 SET DGCCPC=DGCCPC+1
+11 SET DGCCPG(DGCCPC)=DGCPCD_U_DGEFDT_U_DGEDDT_U_DGLUTS
+12 QUIT