- AGMPCHK ;GDIT/HS/SWH-Site ID Check; NOV 11, 2016
- ;;7.2;IHS PATIENT REGISTRATION;**5**;NOV 30, 2016 ;Build 20
- Q
- ;
- ;
- BUILD ;Create the Institution - Site Information globals entries
- N INST,SID
- I $G(^AGMPCHK(0))'="" W !,"The Build process for the AGMPCHK global is already completed, please use the Update option!" Q ;The CHK global entries have already been created, run the Update routine if you need to change their values
- S ^AGMPCHK(0)=0 ;Set the initial count to zero
- S INST=0 ;Set the Institution to zero
- F S INST=$O(^AGFAC(INST)) Q:INST="" D ;Loop through the Institution numbers from the AGFAC global
- .I $P($G(^AGFAC(INST,0)),U,21)'="Y" Q ;If the the Institution isn't an Ordering Facility don't process
- .S SID=$P($G(^DIC(4,INST,99)),U,1) ;Pull the SiteID from the Institution file
- .D CENTRY(SID,INST,"VALID")
- Q
- ;
- ;
- UENTRY(INST,VAL,ID1) ;Update an entry within the ^AGMPCHK global
- S ^AGMPCHK(INST,1)=VAL
- S ^AGMPCHK(INST)=ID1
- I (VAL="INVALID") D Q
- .S ^AGMPCHK(INST,"NT")=$H
- .D NOTIF^AGMPIHLO("","The "_INST_" / "_ID1_" site is now disabled.")
- S ^AGMPCHK(INST,0)=ID1
- Q
- ;
- ;
- CENTRY(ID1,INST,VAL) ;Create an entry within the ^AGMPCHK global
- S ^AGMPCHK(INST)=ID1
- S ^AGMPCHK(INST,0)=ID1
- S ^AGMPCHK(INST,1)=VAL
- S ^AGMPCHK(0)=$G(^AGMPCHK(0))+1 ;Add one to to total number of entries
- Q
- ;
- ;
- RENTRY(INST) ;Remove an entry within the ^AGMPCHK global
- K ^AGMPCHK(INST)
- S ^AGMPCHK(0)=$G(^AGMPCHK(0))-1 ; Subtract one from the total number of entries
- Q
- ;
- ;
- GETINST(ID1,INST) ;Retrieve the institution associated with the Site from the ^AGMPCHK global
- N TINST
- S TINST=0
- S INST=""
- F S TINST=$O(^AGMPCHK(TINST)) Q:TINST="" D
- .I $G(^AGMPCHK(TINST))=ID1 S INST=TINST
- Q
- ;
- ;
- SITELST ;Print out the current site information within the ^AGMPCHK global
- N INTS,TB
- I '($G(^AGMPCHK(0))) W !,"There is no site information to display" Q
- S INST=0
- S TB=" "
- W !,"Inst",TB,"Site ID",TB,"OLD Site ID",TB,"Status"
- F S INST=$O(^AGMPCHK(INST)) Q:INST="" D
- .W !,INST
- .W $J(^AGMPCHK(INST),11)
- .W $J(^AGMPCHK(INST,0),14)
- .W $J(^AGMPCHK(INST,1),14)
- Q
- ;
- ;
- ISITERST ;Interactive Reset, user option
- L +^AGMPCHK:3
- I '$T D Q
- .W !,"Please run the Site Reset option again, currently there is a lock on the ^AGMPCHK global. If this notification continues please contact the OIT HelpDesk."
- L -^AGMPCHK
- N INST,TC,DIR,TID,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
- S INST=0
- S TC=1
- S DIR(0)=""
- S DIR("A")="Site"
- S DIR(0)="SO^1:ALL"
- F S INST=$O(^AGMPCHK(INST)) Q:INST="" D
- .S TC=TC+1
- .S TID=$G(^AGMPCHK(INST))
- .S DIR(0)=DIR(0)_";"_TC_":"_TID_" - "_$G(^AGMPCHK(INST,1))
- D ^DIR
- I Y D SITERST(Y(0))
- Q
- ;
- ;
- SITERST(RSID) ;Site Reset, mark Valid the SiteID that is sent in, 'ALL' is sent in then we loop through the AGMPCHK global marking all Valid
- L +^AGMPCHK:5 ;Attempt to lock the AGMPCHK global.
- I '$T D Q ;if no lock quit the update process.
- .W !,"Please run the Site Reset option again, currently there is a lock on the ^AGMPCHK global. If this notification continues please contact the OIT HelpDesk."
- N INST,RESULT
- S RSID=$p(RSID," ",1)
- I RSID="ALL" D L -^AGMPCHK Q ;If we're to update all entries within the AGMPCHK global
- .S INST=0 ;The Institution variable we use to loop through the sites within the global
- .S RESULT="ALL Sites are marked valid"
- .F S INST=$O(^AGMPCHK(INST)) Q:INST="" D ;Loop while there's an Institution
- ..I '(^AGMPCHK(INST,1)="VALID") D
- ...D SNDMSGQ(INST)
- ...D UENTRY(INST,"VALID",$P($G(^DIC(4,INST,99)),U,1))
- .W !,RESULT
- D GETINST(RSID,.INST)
- I (INST="") D L -^AGMPCHK Q
- .S RESULT="The "_RSID_" wasn't found in the SiteId List"
- .W !,RESULT
- I ^AGMPCHK(INST,1)="VALID" D L -^AGMPCHK Q
- .S RESULT="The "_RSID_" site is already marked valid"
- .W !,RESULT
- D SNDMSGQ(INST)
- D UENTRY(INST,"VALID",RSID)
- S RESULT="Site "_RSID_" was marked valid."
- W !,RESULT
- L -^AGMPCHK ;Unlock the AGMPCHK global
- Q
- ;
- ;
- UPDATE ;Check to see if the information stored is the same as the information in the AGFAC and Institution Globals
- N INST,USID,$ESTACK,$ETRAP
- S $ETRAP="D UNWIND^%ZTER"
- I '($G(^AGMPCHK(0))) Q ;The CHK global isn't built we need to create it before the Check routine is ran
- L +^AGMPCHK:5 I '$T Q ;Attempt to lock the AGMPCHK global, if no lock quit the update process.
- S INST=0 ;Set the Institution to zero
- F S INST=$O(^AGFAC(INST)) Q:INST="" D ;Loop through the Institution numbers from the AGFAC global
- .I '($P($G(^AGFAC(INST,0)),U,21)="Y") D Q ;If the the Institution isn't an Ordering Facility we do not check or store this information
- ..I '($G(^AGMPCHK(INST))="") D RENTRY(INST) Q
- .S USID=$P($G(^DIC(4,INST,99)),U,1) ;Pull the SiteID from the Institution file
- .I ($G(^AGMPCHK(INST))="") D CENTRY(USID,INST,"INVALID") Q
- .I '($G(^AGMPCHK(INST,0))=USID) D Q
- ..I ($G(^AGMPCHK(INST,1))="VALID") D UENTRY(INST,"INVALID",USID) Q
- L -^AGMPCHK ;Unlock the AGMPCHK global
- Q
- ;
- ;
- UPDMSGQ(PDFN,PDFN2,PMSGTYPE,PSITE) ;Add the needed entries to the AGMPCHKQ global
- L +^AGMPCHKQ(PSITE,PDFN):5 I '$T Q ;Attempt to lock the AGMPCHKQ(SITE,Patient) global node, if no lock quit the update process.
- I ($G(PMSGTYPE)="A40") D L -^AGMPCHKQ(PSITE,PDFN) Q ;if this is a merge message do some checks and then set the Queue entry as needed.
- .I '($G(PDFN2)) D NOTIF^AGMPIHLO(PDFN,"Unable to ADD merge entry to the AGMPCHKQ. No DFN2") Q
- .I '($G(PDFN)) D NOTIF^AGMPIHLO(PDFN,"Unable to ADD merge entry to the AGMPCHKQ. No DFN") Q
- .I ($D(^DPT(PDFN,0))),'($D(^DPT(PDFN2,0))),'($D(^AGMPCHKQ(PSITE,PDFN2,0))="1") D NOTIF^AGMPIHLO(PDFN,"Missing DFN2 information not ADDing the merge entry to the AGMPCHKQ.") Q
- .I ($D(^DPT(PDFN2,0))),'($D(^DPT(PDFN,0))),'($D(^AGMPCHKQ(PSITE,PDFN,0))="1") D NOTIF^AGMPIHLO(PDFN,"Missing DFN information not ADDing the merge entry to the AGMPCHKQ.") Q
- .I '($D(^AGMPCHKQ(PSITE,PDFN,1))) D Q
- ..I '($D(^AGMPCHKQ(PSITE,PDFN))) S ^AGMPCHKQ(PSITE,0)=$G(^AGMPCHKQ(PSITE,0))+1
- ..S ^AGMPCHKQ(PSITE,PDFN,1)=PDFN2
- I '($D(^AGMPCHKQ(PSITE,PDFN,0))) D L -^AGMPCHKQ(PSITE,PDFN) Q
- .I '($D(^AGMPCHKQ(PSITE,PDFN))) S ^AGMPCHKQ(PSITE,0)=$G(^AGMPCHKQ(PSITE,0))+1
- .S ^AGMPCHKQ(PSITE,PDFN,0)=""
- L -^AGMPCHKQ(PSITE,PDFN)
- Q
- ;
- ;
- SNDMSGQ(PSITE) ;Send the messages for the instituiton/site ID that is now VALID
- N AGMPCHKFLG,SUCCESS,SDUZ2,SNDC,DEXEC,TDFN,TDFN2
- I $D(^AGMPCHKQ(PSITE)) D Q
- .S AGMPCHKFLG=1
- .S SUCCESS=1
- .S SDUZ2=DUZ(2)
- .S DUZ(2)=PSITE ; SAC 2009 2.2.3.3
- .S SNDC=1
- .S TDFN=""
- .F S TDFN=$O(^AGMPCHKQ(PSITE,TDFN),-1) Q:'TDFN D
- ..L +^AGMPCHKQ(PSITE,TDFN):5 I '$T S SNDC=0 Q ;Attempt to lock the AGMPCHKQ(SITE,Patient) global node, if we can't lock go to the next patient.
- ..I $D(^AGMPCHKQ(PSITE,TDFN,0)) D
- ...D CREATMSG^AGMPIHLO(TDFN,"A08",,.SUCCESS)
- ..I SUCCESS,$G(^AGMPCHKQ(PSITE,TDFN,1)) D
- ...S TDFN2=$G(^AGMPCHKQ(PSITE,TDFN,1))
- ...I $D(^AGMPCHKQ(PSITE,TDFN2,0)) D
- ....D CREATMSG^AGMPIHLO(TDFN2,"A08",,.SUCCESS)
- ....I SUCCESS K ^AGMPCHKQ(PSITE,TDFN2)
- ...I SUCCESS D CREATMSG^AGMPIHLO(TDFN,"A40",TDFN2,.SUCCESS)
- ..I SNDC S SNDC=SUCCESS
- ..L -^AGMPCHKQ(PSITE,TDFN)
- ..Q:'SUCCESS
- ..K ^AGMPCHKQ(PSITE,TDFN)
- .I SNDC D
- ..K ^AGMPCHKQ(PSITE)
- ..W !,"Messages sent for Site "_PSITE
- .I 'SNDC W !,"There was an Error in processing the messages for Site "_PSITE
- .K AGMPCHKFLG
- .S DUZ(2)=SDUZ2 ; SAC 2009 2.2.3.3
- Q
- AGMPCHK ;GDIT/HS/SWH-Site ID Check; NOV 11, 2016
- +1 ;;7.2;IHS PATIENT REGISTRATION;**5**;NOV 30, 2016 ;Build 20
- +2 QUIT
- +3 ;
- +4 ;
- BUILD ;Create the Institution - Site Information globals entries
- +1 NEW INST,SID
- +2 ;The CHK global entries have already been created, run the Update routine if you need to change their values
- IF $GET(^AGMPCHK(0))'=""
- WRITE !,"The Build process for the AGMPCHK global is already completed, please use the Update option!"
- QUIT
- +3 ;Set the initial count to zero
- SET ^AGMPCHK(0)=0
- +4 ;Set the Institution to zero
- SET INST=0
- +5 ;Loop through the Institution numbers from the AGFAC global
- FOR
- SET INST=$ORDER(^AGFAC(INST))
- IF INST=""
- QUIT
- Begin DoDot:1
- +6 ;If the the Institution isn't an Ordering Facility don't process
- IF $PIECE($GET(^AGFAC(INST,0)),U,21)'="Y"
- QUIT
- +7 ;Pull the SiteID from the Institution file
- SET SID=$PIECE($GET(^DIC(4,INST,99)),U,1)
- +8 DO CENTRY(SID,INST,"VALID")
- End DoDot:1
- +9 QUIT
- +10 ;
- +11 ;
- UENTRY(INST,VAL,ID1) ;Update an entry within the ^AGMPCHK global
- +1 SET ^AGMPCHK(INST,1)=VAL
- +2 SET ^AGMPCHK(INST)=ID1
- +3 IF (VAL="INVALID")
- Begin DoDot:1
- +4 SET ^AGMPCHK(INST,"NT")=$HOROLOG
- +5 DO NOTIF^AGMPIHLO("","The "_INST_" / "_ID1_" site is now disabled.")
- End DoDot:1
- QUIT
- +6 SET ^AGMPCHK(INST,0)=ID1
- +7 QUIT
- +8 ;
- +9 ;
- CENTRY(ID1,INST,VAL) ;Create an entry within the ^AGMPCHK global
- +1 SET ^AGMPCHK(INST)=ID1
- +2 SET ^AGMPCHK(INST,0)=ID1
- +3 SET ^AGMPCHK(INST,1)=VAL
- +4 ;Add one to to total number of entries
- SET ^AGMPCHK(0)=$GET(^AGMPCHK(0))+1
- +5 QUIT
- +6 ;
- +7 ;
- RENTRY(INST) ;Remove an entry within the ^AGMPCHK global
- +1 KILL ^AGMPCHK(INST)
- +2 ; Subtract one from the total number of entries
- SET ^AGMPCHK(0)=$GET(^AGMPCHK(0))-1
- +3 QUIT
- +4 ;
- +5 ;
- GETINST(ID1,INST) ;Retrieve the institution associated with the Site from the ^AGMPCHK global
- +1 NEW TINST
- +2 SET TINST=0
- +3 SET INST=""
- +4 FOR
- SET TINST=$ORDER(^AGMPCHK(TINST))
- IF TINST=""
- QUIT
- Begin DoDot:1
- +5 IF $GET(^AGMPCHK(TINST))=ID1
- SET INST=TINST
- End DoDot:1
- +6 QUIT
- +7 ;
- +8 ;
- SITELST ;Print out the current site information within the ^AGMPCHK global
- +1 NEW INTS,TB
- +2 IF '($GET(^AGMPCHK(0)))
- WRITE !,"There is no site information to display"
- QUIT
- +3 SET INST=0
- +4 SET TB=" "
- +5 WRITE !,"Inst",TB,"Site ID",TB,"OLD Site ID",TB,"Status"
- +6 FOR
- SET INST=$ORDER(^AGMPCHK(INST))
- IF INST=""
- QUIT
- Begin DoDot:1
- +7 WRITE !,INST
- +8 WRITE $JUSTIFY(^AGMPCHK(INST),11)
- +9 WRITE $JUSTIFY(^AGMPCHK(INST,0),14)
- +10 WRITE $JUSTIFY(^AGMPCHK(INST,1),14)
- End DoDot:1
- +11 QUIT
- +12 ;
- +13 ;
- ISITERST ;Interactive Reset, user option
- +1 LOCK +^AGMPCHK:3
- +2 IF '$TEST
- Begin DoDot:1
- +3 WRITE !,"Please run the Site Reset option again, currently there is a lock on the ^AGMPCHK global. If this notification continues please contact the OIT HelpDesk."
- End DoDot:1
- QUIT
- +4 LOCK -^AGMPCHK
- +5 NEW INST,TC,DIR,TID,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
- +6 SET INST=0
- +7 SET TC=1
- +8 SET DIR(0)=""
- +9 SET DIR("A")="Site"
- +10 SET DIR(0)="SO^1:ALL"
- +11 FOR
- SET INST=$ORDER(^AGMPCHK(INST))
- IF INST=""
- QUIT
- Begin DoDot:1
- +12 SET TC=TC+1
- +13 SET TID=$GET(^AGMPCHK(INST))
- +14 SET DIR(0)=DIR(0)_";"_TC_":"_TID_" - "_$GET(^AGMPCHK(INST,1))
- End DoDot:1
- +15 DO ^DIR
- +16 IF Y
- DO SITERST(Y(0))
- +17 QUIT
- +18 ;
- +19 ;
- SITERST(RSID) ;Site Reset, mark Valid the SiteID that is sent in, 'ALL' is sent in then we loop through the AGMPCHK global marking all Valid
- +1 ;Attempt to lock the AGMPCHK global.
- LOCK +^AGMPCHK:5
- +2 ;if no lock quit the update process.
- IF '$TEST
- Begin DoDot:1
- +3 WRITE !,"Please run the Site Reset option again, currently there is a lock on the ^AGMPCHK global. If this notification continues please contact the OIT HelpDesk."
- End DoDot:1
- QUIT
- +4 NEW INST,RESULT
- +5
- *** ERROR ***
- SET RSID=$p(RSID," ",1)
- +6 ;If we're to update all entries within the AGMPCHK global
- IF RSID="ALL"
- Begin DoDot:1
- +7 ;The Institution variable we use to loop through the sites within the global
- SET INST=0
- +8 SET RESULT="ALL Sites are marked valid"
- +9 ;Loop while there's an Institution
- FOR
- SET INST=$ORDER(^AGMPCHK(INST))
- IF INST=""
- QUIT
- Begin DoDot:2
- +10 IF '(^AGMPCHK(INST,1)="VALID")
- Begin DoDot:3
- +11 DO SNDMSGQ(INST)
- +12 DO UENTRY(INST,"VALID",$PIECE($GET(^DIC(4,INST,99)),U,1))
- End DoDot:3
- End DoDot:2
- +13 WRITE !,RESULT
- End DoDot:1
- LOCK -^AGMPCHK
- QUIT
- +14 DO GETINST(RSID,.INST)
- +15 IF (INST="")
- Begin DoDot:1
- +16 SET RESULT="The "_RSID_" wasn't found in the SiteId List"
- +17 WRITE !,RESULT
- End DoDot:1
- LOCK -^AGMPCHK
- QUIT
- +18 IF ^AGMPCHK(INST,1)="VALID"
- Begin DoDot:1
- +19 SET RESULT="The "_RSID_" site is already marked valid"
- +20 WRITE !,RESULT
- End DoDot:1
- LOCK -^AGMPCHK
- QUIT
- +21 DO SNDMSGQ(INST)
- +22 DO UENTRY(INST,"VALID",RSID)
- +23 SET RESULT="Site "_RSID_" was marked valid."
- +24 WRITE !,RESULT
- +25 ;Unlock the AGMPCHK global
- LOCK -^AGMPCHK
- +26 QUIT
- +27 ;
- +28 ;
- UPDATE ;Check to see if the information stored is the same as the information in the AGFAC and Institution Globals
- +1 NEW INST,USID,$ESTACK,$ETRAP
- +2 SET $ETRAP="D UNWIND^%ZTER"
- +3 ;The CHK global isn't built we need to create it before the Check routine is ran
- IF '($GET(^AGMPCHK(0)))
- QUIT
- +4 ;Attempt to lock the AGMPCHK global, if no lock quit the update process.
- LOCK +^AGMPCHK:5
- IF '$TEST
- QUIT
- +5 ;Set the Institution to zero
- SET INST=0
- +6 ;Loop through the Institution numbers from the AGFAC global
- FOR
- SET INST=$ORDER(^AGFAC(INST))
- IF INST=""
- QUIT
- Begin DoDot:1
- +7 ;If the the Institution isn't an Ordering Facility we do not check or store this information
- IF '($PIECE($GET(^AGFAC(INST,0)),U,21)="Y")
- Begin DoDot:2
- +8 IF '($GET(^AGMPCHK(INST))="")
- DO RENTRY(INST)
- QUIT
- End DoDot:2
- QUIT
- +9 ;Pull the SiteID from the Institution file
- SET USID=$PIECE($GET(^DIC(4,INST,99)),U,1)
- +10 IF ($GET(^AGMPCHK(INST))="")
- DO CENTRY(USID,INST,"INVALID")
- QUIT
- +11 IF '($GET(^AGMPCHK(INST,0))=USID)
- Begin DoDot:2
- +12 IF ($GET(^AGMPCHK(INST,1))="VALID")
- DO UENTRY(INST,"INVALID",USID)
- QUIT
- End DoDot:2
- QUIT
- End DoDot:1
- +13 ;Unlock the AGMPCHK global
- LOCK -^AGMPCHK
- +14 QUIT
- +15 ;
- +16 ;
- UPDMSGQ(PDFN,PDFN2,PMSGTYPE,PSITE) ;Add the needed entries to the AGMPCHKQ global
- +1 ;Attempt to lock the AGMPCHKQ(SITE,Patient) global node, if no lock quit the update process.
- LOCK +^AGMPCHKQ(PSITE,PDFN):5
- IF '$TEST
- QUIT
- +2 ;if this is a merge message do some checks and then set the Queue entry as needed.
- IF ($GET(PMSGTYPE)="A40")
- Begin DoDot:1
- +3 IF '($GET(PDFN2))
- DO NOTIF^AGMPIHLO(PDFN,"Unable to ADD merge entry to the AGMPCHKQ. No DFN2")
- QUIT
- +4 IF '($GET(PDFN))
- DO NOTIF^AGMPIHLO(PDFN,"Unable to ADD merge entry to the AGMPCHKQ. No DFN")
- QUIT
- +5 IF ($DATA(^DPT(PDFN,0)))
- IF '($DATA(^DPT(PDFN2,0)))
- IF '($DATA(^AGMPCHKQ(PSITE,PDFN2,0))="1")
- DO NOTIF^AGMPIHLO(PDFN,"Missing DFN2 information not ADDing the merge entry to the AGMPCHKQ.")
- QUIT
- +6 IF ($DATA(^DPT(PDFN2,0)))
- IF '($DATA(^DPT(PDFN,0)))
- IF '($DATA(^AGMPCHKQ(PSITE,PDFN,0))="1")
- DO NOTIF^AGMPIHLO(PDFN,"Missing DFN information not ADDing the merge entry to the AGMPCHKQ.")
- QUIT
- +7 IF '($DATA(^AGMPCHKQ(PSITE,PDFN,1)))
- Begin DoDot:2
- +8 IF '($DATA(^AGMPCHKQ(PSITE,PDFN)))
- SET ^AGMPCHKQ(PSITE,0)=$GET(^AGMPCHKQ(PSITE,0))+1
- +9 SET ^AGMPCHKQ(PSITE,PDFN,1)=PDFN2
- End DoDot:2
- QUIT
- End DoDot:1
- LOCK -^AGMPCHKQ(PSITE,PDFN)
- QUIT
- +10 IF '($DATA(^AGMPCHKQ(PSITE,PDFN,0)))
- Begin DoDot:1
- +11 IF '($DATA(^AGMPCHKQ(PSITE,PDFN)))
- SET ^AGMPCHKQ(PSITE,0)=$GET(^AGMPCHKQ(PSITE,0))+1
- +12 SET ^AGMPCHKQ(PSITE,PDFN,0)=""
- End DoDot:1
- LOCK -^AGMPCHKQ(PSITE,PDFN)
- QUIT
- +13 LOCK -^AGMPCHKQ(PSITE,PDFN)
- +14 QUIT
- +15 ;
- +16 ;
- SNDMSGQ(PSITE) ;Send the messages for the instituiton/site ID that is now VALID
- +1 NEW AGMPCHKFLG,SUCCESS,SDUZ2,SNDC,DEXEC,TDFN,TDFN2
- +2 IF $DATA(^AGMPCHKQ(PSITE))
- Begin DoDot:1
- +3 SET AGMPCHKFLG=1
- +4 SET SUCCESS=1
- +5 SET SDUZ2=DUZ(2)
- +6 ; SAC 2009 2.2.3.3
- SET DUZ(2)=PSITE
- +7 SET SNDC=1
- +8 SET TDFN=""
- +9 FOR
- SET TDFN=$ORDER(^AGMPCHKQ(PSITE,TDFN),-1)
- IF 'TDFN
- QUIT
- Begin DoDot:2
- +10 ;Attempt to lock the AGMPCHKQ(SITE,Patient) global node, if we can't lock go to the next patient.
- LOCK +^AGMPCHKQ(PSITE,TDFN):5
- IF '$TEST
- SET SNDC=0
- QUIT
- +11 IF $DATA(^AGMPCHKQ(PSITE,TDFN,0))
- Begin DoDot:3
- +12 DO CREATMSG^AGMPIHLO(TDFN,"A08",,.SUCCESS)
- End DoDot:3
- +13 IF SUCCESS
- IF $GET(^AGMPCHKQ(PSITE,TDFN,1))
- Begin DoDot:3
- +14 SET TDFN2=$GET(^AGMPCHKQ(PSITE,TDFN,1))
- +15 IF $DATA(^AGMPCHKQ(PSITE,TDFN2,0))
- Begin DoDot:4
- +16 DO CREATMSG^AGMPIHLO(TDFN2,"A08",,.SUCCESS)
- +17 IF SUCCESS
- KILL ^AGMPCHKQ(PSITE,TDFN2)
- End DoDot:4
- +18 IF SUCCESS
- DO CREATMSG^AGMPIHLO(TDFN,"A40",TDFN2,.SUCCESS)
- End DoDot:3
- +19 IF SNDC
- SET SNDC=SUCCESS
- +20 LOCK -^AGMPCHKQ(PSITE,TDFN)
- +21 IF 'SUCCESS
- QUIT
- +22 KILL ^AGMPCHKQ(PSITE,TDFN)
- End DoDot:2
- +23 IF SNDC
- Begin DoDot:2
- +24 KILL ^AGMPCHKQ(PSITE)
- +25 WRITE !,"Messages sent for Site "_PSITE
- End DoDot:2
- +26 IF 'SNDC
- WRITE !,"There was an Error in processing the messages for Site "_PSITE
- +27 KILL AGMPCHKFLG
- +28 ; SAC 2009 2.2.3.3
- SET DUZ(2)=SDUZ2
- End DoDot:1
- QUIT
- +29 QUIT