MAGT7ST ;WOIFO/MLH/PMK - telepathology - create HL7 message to DPS - segment build - TQ1 ; 17 Jul 2013 12:07 PM
 ;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
 ;; Per VHA Directive 2004-038, this routine should not be modified.
 ;; +---------------------------------------------------------------+
 ;; | Property of the US Government.                                |
 ;; | No permission to copy or redistribute this software is given. |
 ;; | Use of unreleased versions of this software requires the user |
 ;; | to execute a written test agreement with the VistA Imaging    |
 ;; | Development Office of the Department of Veterans Affairs,     |
 ;; | telephone (301) 734-0100.                                     |
 ;; | The Food and Drug Administration classifies this software as  |
 ;; | a medical device.  As such, it may not be changed in any way. |
 ;; | Modifications to this software may result in an adulterated   |
 ;; | medical device under 21CFR820, the use of which is considered |
 ;; | to be a violation of US Federal Statutes.                     |
 ;; +---------------------------------------------------------------+
 ;;
 Q
 ;
TQ1SEG(SEGELTS,DFN) ; FUNCTION - main entry point - create a TQ1 segment
 N SETID S SETID=1 ; set ID value for TQ1 segment
 N FLDSETID S FLDSETID=1 ; set ID field in TQ1 segment
 N PRIO S PRIO="R" ; priority code - always "R"
 N FLDPRIO S FLDPRIO=9 ; priority field in TQ1 segment
 N ERRSTAT S ERRSTAT=0 ; error status - assume nothing to report
 ;
 K SEGELTS ; always refresh *segment* array (not message array) on entry
 ;
 D SET^HLOAPI(.SEGELTS,"TQ1",0) ; segment type
 D  ; set field values - check abort flag after every field is set
 . D  Q:ERRSTAT  ; TQ1-1-set ID
 . . D SET^HLOAPI(.SEGELTS,SETID,FLDSETID)
 . . Q
 . D  Q:ERRSTAT  ; TQ1-9-priority
 . . D SET^HLOAPI(.SEGELTS,PRIO,FLDPRIO)
 . . Q
 . Q
 ;
 Q ERRSTAT
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGT7ST   1922     printed  Sep 23, 2025@19:44:52                                                                                                                                                                                                     Page 2
MAGT7ST   ;WOIFO/MLH/PMK - telepathology - create HL7 message to DPS - segment build - TQ1 ; 17 Jul 2013 12:07 PM
 +1       ;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
 +2       ;; Per VHA Directive 2004-038, this routine should not be modified.
 +3       ;; +---------------------------------------------------------------+
 +4       ;; | Property of the US Government.                                |
 +5       ;; | No permission to copy or redistribute this software is given. |
 +6       ;; | Use of unreleased versions of this software requires the user |
 +7       ;; | to execute a written test agreement with the VistA Imaging    |
 +8       ;; | Development Office of the Department of Veterans Affairs,     |
 +9       ;; | telephone (301) 734-0100.                                     |
 +10      ;; | The Food and Drug Administration classifies this software as  |
 +11      ;; | a medical device.  As such, it may not be changed in any way. |
 +12      ;; | Modifications to this software may result in an adulterated   |
 +13      ;; | medical device under 21CFR820, the use of which is considered |
 +14      ;; | to be a violation of US Federal Statutes.                     |
 +15      ;; +---------------------------------------------------------------+
 +16      ;;
 +17       QUIT 
 +18      ;
TQ1SEG(SEGELTS,DFN) ; FUNCTION - main entry point - create a TQ1 segment
 +1       ; set ID value for TQ1 segment
           NEW SETID
           SET SETID=1
 +2       ; set ID field in TQ1 segment
           NEW FLDSETID
           SET FLDSETID=1
 +3       ; priority code - always "R"
           NEW PRIO
           SET PRIO="R"
 +4       ; priority field in TQ1 segment
           NEW FLDPRIO
           SET FLDPRIO=9
 +5       ; error status - assume nothing to report
           NEW ERRSTAT
           SET ERRSTAT=0
 +6       ;
 +7       ; always refresh *segment* array (not message array) on entry
           KILL SEGELTS
 +8       ;
 +9       ; segment type
           DO SET^HLOAPI(.SEGELTS,"TQ1",0)
 +10      ; set field values - check abort flag after every field is set
           Begin DoDot:1
 +11      ; TQ1-1-set ID
               Begin DoDot:2
 +12               DO SET^HLOAPI(.SEGELTS,SETID,FLDSETID)
 +13               QUIT 
               End DoDot:2
               if ERRSTAT
                   QUIT 
 +14      ; TQ1-9-priority
               Begin DoDot:2
 +15               DO SET^HLOAPI(.SEGELTS,PRIO,FLDPRIO)
 +16               QUIT 
               End DoDot:2
               if ERRSTAT
                   QUIT 
 +17           QUIT 
           End DoDot:1
 +18      ;
 +19       QUIT ERRSTAT