MAGVAF02 ;WOIFO/NST - Utilities for RPC calls ; 13 Feb 2012 4:16 PM
 ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 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
 ;
OK() Q 0   ; Success status
 ;
FAILED() Q -1   ; Failure status
 ;
RESDEL() Q "^"  ; Result delimiter
 ;
RESDATA() Q 3  ; Returns the piece number where the result data value is stored in MAGRY
 ;
ISOK(MAGRY) ; Returns 0 (failed) or 1 (success): Checks if first piece of MAGRY is success
 Q +MAGRY=$$OK^MAGVAF02()
 ;
GETVAL(MAGRY) ; Returns data value in MAGRY
 Q $P(MAGRY,$$RESDEL^MAGVAF02(),$$RESDATA^MAGVAF02())
 ;
SETVAL(MAGRY,VAL) ; Set VAL in MAGRY data piece
 S $P(MAGRY,$$RESDEL^MAGVAF02(),$$RESDATA^MAGVAF02())=VAL
 Q
 ;
XML1LINE() ; Returns the first line in XML formatted RPCs output
 Q "<?xml version=""1.0"" encoding=""utf-8""?>"
 ;
SETOKVAL(MAGRY,VAL) ; Sets data value in MAGRY and set OK status
 S MAGRY=$$OK^MAGVAF02()
 S $P(MAGRY,$$RESDEL^MAGVAF02(),$$RESDATA^MAGVAF02())=VAL
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGVAF02   1958     printed  Sep 23, 2025@19:45:35                                                                                                                                                                                                    Page 2
MAGVAF02  ;WOIFO/NST - Utilities for RPC calls ; 13 Feb 2012 4:16 PM
 +1       ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 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      ;
OK()      ; Success status
           QUIT 0
 +1       ;
FAILED()  ; Failure status
           QUIT -1
 +1       ;
RESDEL()  ; Result delimiter
           QUIT "^"
 +1       ;
RESDATA() ; Returns the piece number where the result data value is stored in MAGRY
           QUIT 3
 +1       ;
ISOK(MAGRY) ; Returns 0 (failed) or 1 (success): Checks if first piece of MAGRY is success
 +1        QUIT +MAGRY=$$OK^MAGVAF02()
 +2       ;
GETVAL(MAGRY) ; Returns data value in MAGRY
 +1        QUIT $PIECE(MAGRY,$$RESDEL^MAGVAF02(),$$RESDATA^MAGVAF02())
 +2       ;
SETVAL(MAGRY,VAL) ; Set VAL in MAGRY data piece
 +1        SET $PIECE(MAGRY,$$RESDEL^MAGVAF02(),$$RESDATA^MAGVAF02())=VAL
 +2        QUIT 
 +3       ;
XML1LINE() ; Returns the first line in XML formatted RPCs output
 +1        QUIT "<?xml version=""1.0"" encoding=""utf-8""?>"
 +2       ;
SETOKVAL(MAGRY,VAL) ; Sets data value in MAGRY and set OK status
 +1        SET MAGRY=$$OK^MAGVAF02()
 +2        SET $PIECE(MAGRY,$$RESDEL^MAGVAF02(),$$RESDATA^MAGVAF02())=VAL
 +3        QUIT