MAGSDOFF ; OI&T-Clin3/DWM - DEX & AA Track Offline Images ; 01/31/13
;;3.0;IMAGING;**135**;Mar 19, 2002;Build 5238;Jul 17, 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. |
;; +---------------------------------------------------------------+
;;
; Process:
; - validate mail group 'OFFLINE IMAGE TRACKERS'
; - read and store platter report in ^TMP($J, global
; - extract image file names into ^TMP($J,"PLATTER",
; - import image file names into #2006.033 'OFFLINE IMAGES FILE'
; - update original AA platter report to DEX format
; Original AA platter report format:
; "File Path","File ID","File Size","Migration ID",
; "Migration Time",Status "
; 'Split' files are added as duplicates but with their corresponding
; platter name - this allows online/offline to work as needed.
Q
EN ; entry point; called by ^MAGSDOFL; from option [MAG JB OFFLINE]
N FILE,PATH,Y,L,LN,N,XX,DIR,X,GRP,MAILCHK,I,MAGPLAT
K ^TMP($J),DIR
W !!,"AA Offline Platter Utility",! F I=1:1:26 W "-"
;
; validate mail group 'OFFLINE IMAGE TRACKERS'
S GRP="OFFLINE IMAGE TRACKERS"
W !!,"Validating mail group '"_GRP_"'..." H 2
S MAILCHK=$$MAIL(GRP) F I=1:1:$L(MAILCHK,U) W !,?7,$P(MAILCHK,U,I)
;
; ask directory & file name
D DIR
I '$D(PATH)!('$D(FILE)) Q
;
; $$FTG^%ZISH(): Load Host File into Global
W !!,"Extracting data from "_FILE_"..."
S Y=$$FTG^%ZISH(PATH,FILE,$NA(^TMP($J,0)),2)
I Y=0 D ERR(1,FILE,PATH) G EXIT
I '$D(^TMP($J)) D ERR(2,FILE) G EXIT
W "completed.",!
;
; extract image file name from data saved in ^TMP($J,
D PULL
I '$D(^TMP($J,"PLATTER")) D Q
. W !!,"No files to take offline - "
. W "platter report will not be modified",!! Q
;
; import image file names into #2006.033 'OFFLINE IMAGES FILE'
D OFF
I MAGPLAT="ERROR" D G EXIT
. W !!,"Unable to create unique report platter name 30 characters or less"
. Q
; update platter report file in directory
D UPD
;
EXIT ;
;
K ^TMP($J),FILE,PATH,MAGPLAT
Q
;
DIR ; ask path & file name
N DIR,Y,I
W ! S DIR(0)="F"
S DIR("A")="Enter File Directory ( example user$:[dir] ) "
D ^DIR Q:Y["^"!(Y=-1) S PATH=Y K DIR
S DIR(0)="F"
S DIR("A")="Enter File Name ( example aab42_134175.txt ) "
D ^DIR Q:Y["^"!(Y=-1) S FILE=Y K DIR
Q
;
PULL ; extract image file name from data saved in ^TMP($J,
; build ^TMP($J,"PLATTER",L)=file_name
N L,LN,N,XX,CNT
W !,"Pulling image file names from report data",!
S (L,CNT)=0 F S L=$O(^TMP($J,L)) Q:'L D
. S LN=^TMP($J,L)
. ; pattern match example "bil0001.txt ..."
. I $P(LN," ",1)?.E1"."2.5AN D Q
.. S LN=$P(LN," ") D SET
.. Q
. ; pull name "default/xxx0/00/23/46/97/xxx00023469737.TIF",2028..."
. I LN["/" D
.. ; a few bogus lines may exist in report
.. Q:LN[".config_backup"!(LN["self_test")
.. S LN=$P(LN,"""",2)
.. F N=1:1 S XX=$P(LN,"/",N) Q:XX="" I XX?.E1"."2.5AN S LN=XX
.. D SET
.. Q
. Q
W !,"completed - "_CNT_" file names found.",!
Q
;
SET ; LN = image file name
S CNT=CNT+1 I CNT#500=0 W "."
S ^TMP($J,"PLATTER",CNT)=LN
Q
;
OFF ; import image file names into #2006.033 'OFFLINE IMAGES FILE'
N L,CNT,CNT1,MAGFL,MAGFDA,MAGIEN,LN
N DIERR,MRK,OIEN,RPT,DUP,MAGPLAT1,I
S (L,CNT,CNT1,DUP)=0,MAGFL=2006.033
; platter name limited to 30 characters, and must be unique
S MAGPLAT=$P(FILE,".") S:$L(MAGPLAT)>30 MAGPLAT=$$PLAT(MAGPLAT)
Q:MAGPLAT="ERROR"
W !,"Updating the individual image files as 'offline'"
F S L=$O(^TMP($J,"PLATTER",L)) Q:'L D
. S LN=^TMP($J,"PLATTER",L)
. ;
. ; check for existing image file from same platter report
. I $D(^MAGQUEUE(2006.033,"B",LN)) S MRK=0 D Q:MRK
.. S OIEN="" F S OIEN=$O(^MAGQUEUE(2006.033,"B",LN,OIEN)) Q:'OIEN D
... S RPT=$P(^MAGQUEUE(2006.033,OIEN,0),U,2)
... ; file/platter entry already in #2006.033:
... I RPT=MAGPLAT S MRK=1,DUP=DUP+1
... Q
.. Q
. ;
. S CNT=CNT+1 I CNT#500=0 W "."
. ; using "+1," instead of "?+1," to allow duplicate "split" entries
. K MAGIEN S MAGIEN="+1,"
. S MAGFDA(MAGFL,MAGIEN,.01)=LN ; .01 FILENAME
. S MAGFDA(MAGFL,MAGIEN,1)=MAGPLAT ; 1 JUKEBOX PLATTER
. D UPDATE^DIE("E","MAGFDA","MAGIEN","MAGERR")
. ;
. ; check and process error msg if needed
. I '$D(DIERR) S CNT1=CNT1+1
. E D ERR(3,LN,"",.MAGERR) K MAGERR
. Q
W !,"Done - "_CNT1_" entries added to #2006.033"
; "duplicates" could be 1. already in #2006.033 or an actual
; file duplication on the platter report
I DUP W !,DUP_" duplicate(s) not added"
Q
;
UPD ; update platter report file in directory
N Y,LAST,LAST1
I MAGPLAT'=$P(FILE,".") W !!,"Creating new platter report "_MAGPLAT
E W !!,"Reformatting platter report "_MAGPLAT
I '$D(^TMP($J,"PLATTER")) D Q
. W !!,"No platter data available for updating of report!"
. Q
; add platter name at top; add end statement
S ^TMP($J,"PLATTER",0)="Media """_MAGPLAT_"""" ;platter name
S LAST="",LAST=$O(^TMP($J,"PLATTER",LAST),-1),LAST1=LAST+1
S ^TMP($J,"PLATTER",LAST1)=LAST_" Files Listed"
;
S FILE=MAGPLAT_".TXT",Y=$$GTF^%ZISH($NA(^TMP($J,"PLATTER",0)),3,PATH,FILE)
I 'Y W !!,"Unable to create/update platter report",! W PATH_FILE Q
W !,"Finished"
Q
;
PLAT(MAGPLAT) ; starting at 30 char length, whittle down until unique
N MAGPLAT30,I
W !,"Original report name is greater than the allowed 30 characters,"
W !,?5,"a new name for the report will be generated for #2006.033."
S MAGPLAT30=""
F I=30:-1:2 D:MAGPLAT30'=MAGPLAT
. S MAGPLAT30=$E(MAGPLAT,1,I) D
. ; check to see if platter name already exist
. Q:$D(^MAGQUEUE(2006.033,"C",MAGPLAT30))
. S MAGPLAT=MAGPLAT30
. Q
; unable to create unique platter name
I MAGPLAT30'=MAGPLAT Q "ERROR"
;
Q MAGPLAT
;
ERR(TY,T1,T2,T3) ; error messaging
Q:'TY
I TY=2 W !!,"Unable to pull data from "_T1 Q
I TY=3 D Q
. W !!,"Unable to add "_LN_" as an offline image",!
. D MSG^DIALOG("WE","",50,5,"T3") K T3
. Q
W !!,"Unable to access "_T2_T1
K TY,T1,T2
Q
;
MAIL(GRP) ; add "OFFLINE IMAGE TRACKERS" and/or active member
; No update if group exist w/active local member
; If no group add it, add DUZ as member and mag server
; If group w/o active local member, add DUZ as member and mag server
;
N CHKG,CHKM,Y,TYPE,INT,ENR,XMY,ORG,DESC,MAGMAIL,MAGSVR,GRPIEN,RES
I GRP="" Q "No action taken, mail group name required"
S CHKG=$D(^XMB(3.8,"B",GRP)),CHKM=$$GOTLOCAL^XMXAPIG(GRP)
S MAGMAIL="G.MAG SERVER" I $D(^XMB(3.8,"B",$P(MAGMAIL,".",2))) D
. S MAGSVR="",MAGSVR=$O(^XMB(3.8,"B",$P(MAGMAIL,".",2),MAGSVR))
;
; mail group exist w/active member
Q:CHKG&(CHKM) "Mail group '"_GRP_"' present with active member."
I '$D(DUZ) Q "No DUZ defined, unable to add/edit mail group."
;
S (TYPE,ENR)=0,INT=1,ORG=DUZ,XMY(DUZ)=""
S DESC(1)="Mail group to send messages regarding accessing "
S DESC(1)=DESC(1)_"images on offline jukebox platters."
S Y=$$MG^XMBGRP(GRP,TYPE,ORG,ENR,.XMY,.DESC,INT)
I 'Y D Q RES(1)_U_RES(2)
. S RES(1)="Unable to add mail group '"_GRP_"', contact "
. S RES(2)="Support if further assistance is needed."
S GRPIEN=Y
;
; add 'MAG SERVER' as member group if not already there
S (RES(3),RES(4))=""
I $D(MAGSVR)&('$D(^XMB(3.8,GRPIEN,5,"B",MAGSVR))) D
. D ADDMBRS^XMXAPIG(DUZ,GRP,MAGMAIL)
. Q:'$D(^XMB(3.8,GRPIEN,5,"B",MAGSVR))
. S RES(3)="Added member group: '"_MAGMAIL_"' to mail group"
. S RES(4)=" '"_GRP_"'"
;
; "offline" group and members added
I 'CHKG D Q RES(1)_U_RES(2)_U_RES(3)
. S RES(1)="Mail group '"_GRP_"' created."
. S RES(2)="Added local user: '"_$P(^VA(200,DUZ,0),U)
. S RES(2)=RES(2)_"' to mail group"
;
; "offline" was present but w/o an active local user
S RES(1)="Added local user '"_$P(^VA(200,DUZ,0),U)
S RES(1)=RES(1)_"' to mail group '"_GRP_"'"
Q RES(1)_U_RES(3)_RES(4)
;
KILL ; remove before release
K ^MAGQUEUE(2006.033)
S ^MAGQUEUE(2006.033,0)="OFFLINE IMAGES^2006.033AO^"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGSDOFF 8831 printed Oct 16, 2024@18:08:58 Page 2
MAGSDOFF ; OI&T-Clin3/DWM - DEX & AA Track Offline Images ; 01/31/13
+1 ;;3.0;IMAGING;**135**;Mar 19, 2002;Build 5238;Jul 17, 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 ; Process:
+18 ; - validate mail group 'OFFLINE IMAGE TRACKERS'
+19 ; - read and store platter report in ^TMP($J, global
+20 ; - extract image file names into ^TMP($J,"PLATTER",
+21 ; - import image file names into #2006.033 'OFFLINE IMAGES FILE'
+22 ; - update original AA platter report to DEX format
+23 ; Original AA platter report format:
+24 ; "File Path","File ID","File Size","Migration ID",
+25 ; "Migration Time",Status "
+26 ; 'Split' files are added as duplicates but with their corresponding
+27 ; platter name - this allows online/offline to work as needed.
+28 QUIT
EN ; entry point; called by ^MAGSDOFL; from option [MAG JB OFFLINE]
+1 NEW FILE,PATH,Y,L,LN,N,XX,DIR,X,GRP,MAILCHK,I,MAGPLAT
+2 KILL ^TMP($JOB),DIR
+3 WRITE !!,"AA Offline Platter Utility",!
FOR I=1:1:26
WRITE "-"
+4 ;
+5 ; validate mail group 'OFFLINE IMAGE TRACKERS'
+6 SET GRP="OFFLINE IMAGE TRACKERS"
+7 WRITE !!,"Validating mail group '"_GRP_"'..."
HANG 2
+8 SET MAILCHK=$$MAIL(GRP)
FOR I=1:1:$LENGTH(MAILCHK,U)
WRITE !,?7,$PIECE(MAILCHK,U,I)
+9 ;
+10 ; ask directory & file name
+11 DO DIR
+12 IF '$DATA(PATH)!('$DATA(FILE))
QUIT
+13 ;
+14 ; $$FTG^%ZISH(): Load Host File into Global
+15 WRITE !!,"Extracting data from "_FILE_"..."
+16 SET Y=$$FTG^%ZISH(PATH,FILE,$NAME(^TMP($JOB,0)),2)
+17 IF Y=0
DO ERR(1,FILE,PATH)
GOTO EXIT
+18 IF '$DATA(^TMP($JOB))
DO ERR(2,FILE)
GOTO EXIT
+19 WRITE "completed.",!
+20 ;
+21 ; extract image file name from data saved in ^TMP($J,
+22 DO PULL
+23 IF '$DATA(^TMP($JOB,"PLATTER"))
Begin DoDot:1
+24 WRITE !!,"No files to take offline - "
+25 WRITE "platter report will not be modified",!!
QUIT
End DoDot:1
QUIT
+26 ;
+27 ; import image file names into #2006.033 'OFFLINE IMAGES FILE'
+28 DO OFF
+29 IF MAGPLAT="ERROR"
Begin DoDot:1
+30 WRITE !!,"Unable to create unique report platter name 30 characters or less"
+31 QUIT
End DoDot:1
GOTO EXIT
+32 ; update platter report file in directory
+33 DO UPD
+34 ;
EXIT ;
+1 ;
+2 KILL ^TMP($JOB),FILE,PATH,MAGPLAT
+3 QUIT
+4 ;
DIR ; ask path & file name
+1 NEW DIR,Y,I
+2 WRITE !
SET DIR(0)="F"
+3 SET DIR("A")="Enter File Directory ( example user$:[dir] ) "
+4 DO ^DIR
if Y["^"!(Y=-1)
QUIT
SET PATH=Y
KILL DIR
+5 SET DIR(0)="F"
+6 SET DIR("A")="Enter File Name ( example aab42_134175.txt ) "
+7 DO ^DIR
if Y["^"!(Y=-1)
QUIT
SET FILE=Y
KILL DIR
+8 QUIT
+9 ;
PULL ; extract image file name from data saved in ^TMP($J,
+1 ; build ^TMP($J,"PLATTER",L)=file_name
+2 NEW L,LN,N,XX,CNT
+3 WRITE !,"Pulling image file names from report data",!
+4 SET (L,CNT)=0
FOR
SET L=$ORDER(^TMP($JOB,L))
if 'L
QUIT
Begin DoDot:1
+5 SET LN=^TMP($JOB,L)
+6 ; pattern match example "bil0001.txt ..."
+7 IF $PIECE(LN," ",1)?.E1"."2.5AN
Begin DoDot:2
+8 SET LN=$PIECE(LN," ")
DO SET
+9 QUIT
End DoDot:2
QUIT
+10 ; pull name "default/xxx0/00/23/46/97/xxx00023469737.TIF",2028..."
+11 IF LN["/"
Begin DoDot:2
+12 ; a few bogus lines may exist in report
+13 if LN[".config_backup"!(LN["self_test")
QUIT
+14 SET LN=$PIECE(LN,"""",2)
+15 FOR N=1:1
SET XX=$PIECE(LN,"/",N)
if XX=""
QUIT
IF XX?.E1"."2.5AN
SET LN=XX
+16 DO SET
+17 QUIT
End DoDot:2
+18 QUIT
End DoDot:1
+19 WRITE !,"completed - "_CNT_" file names found.",!
+20 QUIT
+21 ;
SET ; LN = image file name
+1 SET CNT=CNT+1
IF CNT#500=0
WRITE "."
+2 SET ^TMP($JOB,"PLATTER",CNT)=LN
+3 QUIT
+4 ;
OFF ; import image file names into #2006.033 'OFFLINE IMAGES FILE'
+1 NEW L,CNT,CNT1,MAGFL,MAGFDA,MAGIEN,LN
+2 NEW DIERR,MRK,OIEN,RPT,DUP,MAGPLAT1,I
+3 SET (L,CNT,CNT1,DUP)=0
SET MAGFL=2006.033
+4 ; platter name limited to 30 characters, and must be unique
+5 SET MAGPLAT=$PIECE(FILE,".")
if $LENGTH(MAGPLAT)>30
SET MAGPLAT=$$PLAT(MAGPLAT)
+6 if MAGPLAT="ERROR"
QUIT
+7 WRITE !,"Updating the individual image files as 'offline'"
+8 FOR
SET L=$ORDER(^TMP($JOB,"PLATTER",L))
if 'L
QUIT
Begin DoDot:1
+9 SET LN=^TMP($JOB,"PLATTER",L)
+10 ;
+11 ; check for existing image file from same platter report
+12 IF $DATA(^MAGQUEUE(2006.033,"B",LN))
SET MRK=0
Begin DoDot:2
+13 SET OIEN=""
FOR
SET OIEN=$ORDER(^MAGQUEUE(2006.033,"B",LN,OIEN))
if 'OIEN
QUIT
Begin DoDot:3
+14 SET RPT=$PIECE(^MAGQUEUE(2006.033,OIEN,0),U,2)
+15 ; file/platter entry already in #2006.033:
+16 IF RPT=MAGPLAT
SET MRK=1
SET DUP=DUP+1
+17 QUIT
End DoDot:3
+18 QUIT
End DoDot:2
if MRK
QUIT
+19 ;
+20 SET CNT=CNT+1
IF CNT#500=0
WRITE "."
+21 ; using "+1," instead of "?+1," to allow duplicate "split" entries
+22 KILL MAGIEN
SET MAGIEN="+1,"
+23 ; .01 FILENAME
SET MAGFDA(MAGFL,MAGIEN,.01)=LN
+24 ; 1 JUKEBOX PLATTER
SET MAGFDA(MAGFL,MAGIEN,1)=MAGPLAT
+25 DO UPDATE^DIE("E","MAGFDA","MAGIEN","MAGERR")
+26 ;
+27 ; check and process error msg if needed
+28 IF '$DATA(DIERR)
SET CNT1=CNT1+1
+29 IF '$TEST
DO ERR(3,LN,"",.MAGERR)
KILL MAGERR
+30 QUIT
End DoDot:1
+31 WRITE !,"Done - "_CNT1_" entries added to #2006.033"
+32 ; "duplicates" could be 1. already in #2006.033 or an actual
+33 ; file duplication on the platter report
+34 IF DUP
WRITE !,DUP_" duplicate(s) not added"
+35 QUIT
+36 ;
UPD ; update platter report file in directory
+1 NEW Y,LAST,LAST1
+2 IF MAGPLAT'=$PIECE(FILE,".")
WRITE !!,"Creating new platter report "_MAGPLAT
+3 IF '$TEST
WRITE !!,"Reformatting platter report "_MAGPLAT
+4 IF '$DATA(^TMP($JOB,"PLATTER"))
Begin DoDot:1
+5 WRITE !!,"No platter data available for updating of report!"
+6 QUIT
End DoDot:1
QUIT
+7 ; add platter name at top; add end statement
+8 ;platter name
SET ^TMP($JOB,"PLATTER",0)="Media """_MAGPLAT_""""
+9 SET LAST=""
SET LAST=$ORDER(^TMP($JOB,"PLATTER",LAST),-1)
SET LAST1=LAST+1
+10 SET ^TMP($JOB,"PLATTER",LAST1)=LAST_" Files Listed"
+11 ;
+12 SET FILE=MAGPLAT_".TXT"
SET Y=$$GTF^%ZISH($NAME(^TMP($JOB,"PLATTER",0)),3,PATH,FILE)
+13 IF 'Y
WRITE !!,"Unable to create/update platter report",!
WRITE PATH_FILE
QUIT
+14 WRITE !,"Finished"
+15 QUIT
+16 ;
PLAT(MAGPLAT) ; starting at 30 char length, whittle down until unique
+1 NEW MAGPLAT30,I
+2 WRITE !,"Original report name is greater than the allowed 30 characters,"
+3 WRITE !,?5,"a new name for the report will be generated for #2006.033."
+4 SET MAGPLAT30=""
+5 FOR I=30:-1:2
if MAGPLAT30'=MAGPLAT
Begin DoDot:1
+6 SET MAGPLAT30=$EXTRACT(MAGPLAT,1,I)
Begin DoDot:2
End DoDot:2
+7 ; check to see if platter name already exist
+8 if $DATA(^MAGQUEUE(2006.033,"C",MAGPLAT30))
QUIT
+9 SET MAGPLAT=MAGPLAT30
+10 QUIT
End DoDot:1
+11 ; unable to create unique platter name
+12 IF MAGPLAT30'=MAGPLAT
QUIT "ERROR"
+13 ;
+14 QUIT MAGPLAT
+15 ;
ERR(TY,T1,T2,T3) ; error messaging
+1 if 'TY
QUIT
+2 IF TY=2
WRITE !!,"Unable to pull data from "_T1
QUIT
+3 IF TY=3
Begin DoDot:1
+4 WRITE !!,"Unable to add "_LN_" as an offline image",!
+5 DO MSG^DIALOG("WE","",50,5,"T3")
KILL T3
+6 QUIT
End DoDot:1
QUIT
+7 WRITE !!,"Unable to access "_T2_T1
+8 KILL TY,T1,T2
+9 QUIT
+10 ;
MAIL(GRP) ; add "OFFLINE IMAGE TRACKERS" and/or active member
+1 ; No update if group exist w/active local member
+2 ; If no group add it, add DUZ as member and mag server
+3 ; If group w/o active local member, add DUZ as member and mag server
+4 ;
+5 NEW CHKG,CHKM,Y,TYPE,INT,ENR,XMY,ORG,DESC,MAGMAIL,MAGSVR,GRPIEN,RES
+6 IF GRP=""
QUIT "No action taken, mail group name required"
+7 SET CHKG=$DATA(^XMB(3.8,"B",GRP))
SET CHKM=$$GOTLOCAL^XMXAPIG(GRP)
+8 SET MAGMAIL="G.MAG SERVER"
IF $DATA(^XMB(3.8,"B",$PIECE(MAGMAIL,".",2)))
Begin DoDot:1
+9 SET MAGSVR=""
SET MAGSVR=$ORDER(^XMB(3.8,"B",$PIECE(MAGMAIL,".",2),MAGSVR))
End DoDot:1
+10 ;
+11 ; mail group exist w/active member
+12 if CHKG&(CHKM)
QUIT "Mail group '"_GRP_"' present with active member."
+13 IF '$DATA(DUZ)
QUIT "No DUZ defined, unable to add/edit mail group."
+14 ;
+15 SET (TYPE,ENR)=0
SET INT=1
SET ORG=DUZ
SET XMY(DUZ)=""
+16 SET DESC(1)="Mail group to send messages regarding accessing "
+17 SET DESC(1)=DESC(1)_"images on offline jukebox platters."
+18 SET Y=$$MG^XMBGRP(GRP,TYPE,ORG,ENR,.XMY,.DESC,INT)
+19 IF 'Y
Begin DoDot:1
+20 SET RES(1)="Unable to add mail group '"_GRP_"', contact "
+21 SET RES(2)="Support if further assistance is needed."
End DoDot:1
QUIT RES(1)_U_RES(2)
+22 SET GRPIEN=Y
+23 ;
+24 ; add 'MAG SERVER' as member group if not already there
+25 SET (RES(3),RES(4))=""
+26 IF $DATA(MAGSVR)&('$DATA(^XMB(3.8,GRPIEN,5,"B",MAGSVR)))
Begin DoDot:1
+27 DO ADDMBRS^XMXAPIG(DUZ,GRP,MAGMAIL)
+28 if '$DATA(^XMB(3.8,GRPIEN,5,"B",MAGSVR))
QUIT
+29 SET RES(3)="Added member group: '"_MAGMAIL_"' to mail group"
+30 SET RES(4)=" '"_GRP_"'"
End DoDot:1
+31 ;
+32 ; "offline" group and members added
+33 IF 'CHKG
Begin DoDot:1
+34 SET RES(1)="Mail group '"_GRP_"' created."
+35 SET RES(2)="Added local user: '"_$PIECE(^VA(200,DUZ,0),U)
+36 SET RES(2)=RES(2)_"' to mail group"
End DoDot:1
QUIT RES(1)_U_RES(2)_U_RES(3)
+37 ;
+38 ; "offline" was present but w/o an active local user
+39 SET RES(1)="Added local user '"_$PIECE(^VA(200,DUZ,0),U)
+40 SET RES(1)=RES(1)_"' to mail group '"_GRP_"'"
+41 QUIT RES(1)_U_RES(3)_RES(4)
+42 ;
KILL ; remove before release
+1 KILL ^MAGQUEUE(2006.033)
+2 SET ^MAGQUEUE(2006.033,0)="OFFLINE IMAGES^2006.033AO^"
+3 QUIT