- MAGNU002 ;WOIFO/NST - Utilities for RPC calls ; 02 May 2017 4:16 PM
- ;;3.0;IMAGING;**185**;Mar 19, 2002;Build 92;Aug 02, 2012
- ;; 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()
- ;
- GETVAL(MAGRY) ; Returns data value in MAGRY
- Q $P(MAGRY,$$RESDEL(),$$RESDATA())
- ;
- SETVAL(MAGRY,VAL) ; set VAL in RY data piece
- S $P(MAGRY,$$RESDEL(),$$RESDATA())=VAL
- Q
- ;
- SETOKVAL(VAL) ; set OK result and value
- N RY
- S RY=$$OK()
- D SETVAL(.RY,VAL)
- Q RY
- ;
- SETERROR(VAL) ; set Error result and value
- Q $$FAILED()_$$RESDEL()_VAL
- ;
- ;
- ; Input Parameters
- ; ================
- ; MSG = VA FileMan error array
- ;
- ; Return Values
- ; =============
- ; MAGRY(0) = Success status
- ; MAGRY(0) = Failure status^Error Message
- ;
- ; Return 1 = error in MSG array
- ; 0 = no error in MSG array
- ISERROR(MAGRY,MSG) ; Check for error message
- I '$D(MSG("DIERR")) S MAGRY(0)=$$OK() Q 0 ; No error
- ;
- N MAGRESA
- D MSG^DIALOG("A",.MAGRESA,245,5,"MSG")
- S MAGRY(0)=$$SETERROR(MAGRESA(1))
- Q 1
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGNU002 2280 printed Jan 18, 2025@03:08:40 Page 2
- MAGNU002 ;WOIFO/NST - Utilities for RPC calls ; 02 May 2017 4:16 PM
- +1 ;;3.0;IMAGING;**185**;Mar 19, 2002;Build 92;Aug 02, 2012
- +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()
- +2 ;
- GETVAL(MAGRY) ; Returns data value in MAGRY
- +1 QUIT $PIECE(MAGRY,$$RESDEL(),$$RESDATA())
- +2 ;
- SETVAL(MAGRY,VAL) ; set VAL in RY data piece
- +1 SET $PIECE(MAGRY,$$RESDEL(),$$RESDATA())=VAL
- +2 QUIT
- +3 ;
- SETOKVAL(VAL) ; set OK result and value
- +1 NEW RY
- +2 SET RY=$$OK()
- +3 DO SETVAL(.RY,VAL)
- +4 QUIT RY
- +5 ;
- SETERROR(VAL) ; set Error result and value
- +1 QUIT $$FAILED()_$$RESDEL()_VAL
- +2 ;
- +3 ;
- +4 ; Input Parameters
- +5 ; ================
- +6 ; MSG = VA FileMan error array
- +7 ;
- +8 ; Return Values
- +9 ; =============
- +10 ; MAGRY(0) = Success status
- +11 ; MAGRY(0) = Failure status^Error Message
- +12 ;
- +13 ; Return 1 = error in MSG array
- +14 ; 0 = no error in MSG array
- ISERROR(MAGRY,MSG) ; Check for error message
- +1 ; No error
- IF '$DATA(MSG("DIERR"))
- SET MAGRY(0)=$$OK()
- QUIT 0
- +2 ;
- +3 NEW MAGRESA
- +4 DO MSG^DIALOG("A",.MAGRESA,245,5,"MSG")
- +5 SET MAGRY(0)=$$SETERROR(MAGRESA(1))
- +6 QUIT 1