Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DIAR

DIAR.m

Go to the documentation of this file.
DIAR ;SFISC/TKW,WISC/CAP-ARCHIVING FUNCTIONS ;7/1/93  4:17 PM
 ;;22.0;VA FileMan;;Mar 30, 1999
 ;Per VHA Directive 10-93-142, this routine should not be modified.
 G NOKL
 ;
1 ;;SELECT ENTRIES TO ARCHIVE
 S DIAR=1 D DIAR^DICRW G Q:Y<0 S %=$P(Y,U,2),(Y,DIARF,DIART)=+Y
 ;TEMPORARY CHANGE TO SKIP SUB-FILE OPTION--NOT COMPLETE
 G O
 G O:'$O(^DD(DIARF,"SB",0))
 W !!,"IF YOU PLAN TO ARCHIVE DATA ONLY FROM ONE SUB-FILE"
 W !,"PLEASE IDENTIFY IT HERE.  OTHERWISE, JUST PRESS RETURN.",!
 D SUB^DICRW G Q:$D(DTOUT)!$D(DUOUT),O:'$D(DIA) S DIARF=DIA
 S DIARF0="D0," F D=1:1 Q:'$D(^DD(DIA,0,"UP"))  S DIARF0=DIARF0_"D"_D_",",DIA=^("UP")
O S I="" D CHK
 I '$D(DIARC) D NEW^DIARCALC G Q:'$D(DIARC) G T1
 I $P(Y(0),U,7)>0 W !!,"There is already an outstanding "_$S(+$P(Y(0),U,17):"extract",1:"archiving")_" activity.",!,"Please finish it or CANCEL it.",$C(7),!! G Q
 D MRK^DIARU
T1 S DIC=DIART,L="]" I $D(DIARF0) S DIARF1=$L(DIARF0,",")-1
 D EN^DIS I '$P(^DIAR(1.11,DIARC,0),U,7) W $C(7),!!,"NO RECORDS WERE SELECTED TO BE "_$S($D(DIAX):"EXTRACTED",1:"ARCHIVED")_"!!",!,"I AM DELETING THIS ARCHIVING ACTIVITY RECORD!!" S DIK="^DIAR(1.11,",DA=DIARC D ^DIK
 G Q
 ;
CHK ;IS THERE A VALID SEARCH ?
 K DIARC,Y(0) S I=0,Y=$S($D(DIARF):DIARF,1:Y)
C S I=$O(^DIAR(1.11,"C",+Y,I)) Q:'I  S Y(0)=""
 G C:'$D(^DIAR(1.11,I,0)) G C:$P(^(0),U,8)>89 S Y(0)=^(0)
 S DIC=$P(Y(0),U,2),DIARC=I,DIARU=$P(Y(0),U,3),DIARP=$P(Y(0),U,4)
 Q
2 ;;ADD/DELETE SELECTED ENTRIES
 S DIAR=2 G ENTE^DIARB
 ;
3 ;;PRINT SELECTED ENTRIES
 S DIAR=3 G OUT^DIARA
 ;
4 ;;CREATE FILEGRAM ARCHIVING TEMPLATE
 S DI=1,DIAR="" G EN^DIFGO
 ;
5 ;;WRITE ENTRIES TO TEMPORARY STORAGE
 S DIAR=4 G OUT^DIARA
 ;
 ;
6 ;;MOVE ARCHIVED DATA TO PERMANENT STORAGE
 S DIAR=5 D FILE^DIARU G Q:'$D(DIARC)
 W !!,"NOTE: This option will 1) print an archive activity report to specified",!,"PRINTER DEVICE and 2) will move archive data to permanent storage to specified",!,"ARCHIVE STORAGE DEVICE."
 W !!,"Select some type of SEQUENTIAL media, such as SDP, TAPE, or DISK FILE (HFS),",!,"for archival storage.",!
 S %ZIS("A")="PRINTER DEVICE: ",%ZIS("B")="",%ZIS="NQ" D ^%ZIS G 65:POP S DIARPDEV=$S($D(ION)#2:ION,1:IO),DIARTRM=$S(IO=IO(0):1,1:0)
 I $D(IOST)#2,IOST]"" S DIARPDEV=DIARPDEV_";"_IOST
 F DIARX="IOM","IOSL" S:($D(@DIARX)#2&@DIARX) DIARPDEV=DIARPDEV_";"_@DIARX
 I $D(IO("Q")) S DIARQUED=1
 S %ZIS="Q",%ZIS("B")="",%ZIS("A")="ARCHIVE STORAGE DEVICE: " D ^%ZIS G 65:POP
 I IOT'["HFS",IOT'["MT",IOT'["SDP" D 63 I $D(DIRUT)!('Y) D 64 G 65
 I $D(IO("Q")),DIARTRM U IO(0) W !,$C(7),"SINCE YOU SELECTED QUEUEING, YOU SHOULD SELECT A PRINTER DEVICE",!,"OTHER THAN YOUR TERMINAL!",! G 65
 D AL I $D(DTOUT)!$D(DIRUT) D 64 G 65
 I $D(IO("Q")) D  G Q
 . I '$D(DIARQUED),'DIARTRM S DIARQUED=1 U IO(0) W !,$C(7),"SINCE YOU SELECTED QUEUEING, REPORT WILL BE QUEUED ALSO!",!
 . S ZTRTN="62^DIAR",ZTSAVE("DIARC")="",ZTSAVE("DIAR")="",ZTDESC="Move archived data to permanent storage",ZTSAVE("DIARPDEV")="",ZTSAVE("DIARQUED")=""
 . D ^%ZTLOAD,HOME^%ZIS Q
62 D ^DIARX
 S DIARL="F  Q:$A(DIARLINE)-32  S DIARLINE=$E(DIARLINE,2,999)"
 U IO F I=0:0 S I=$O(^DIAR(1.11,DIARC,"D",I)) Q:I'>0  I $D(^(I,0)) S DIARLINE=^(0) X:$E(DIARLINE)[" " DIARL W DIARLINE,!
 W "#$#",!
 D 64,OUT^DIARX,UPDATE^DIARU
 G Q
63 U IO(0) W !,$C(7),"The ARCHIVE STORAGE device selected does not look like a SEQUENTIAL",!,"storage medium.",!
 K DIR S DIR(0)="Y",DIR("B")="NO",DIR("A")="Are you sure you want to continue" D ^DIR
 I Y U IO(0) W !,"OK.",!
 Q
64 X $G(^%ZIS("C"))
 Q
65 ;
 G UNLK^DIARA
 ;
7 ;;PURGE STORED ENTRIES
D S DIAR=90 G ENTD^DIARA
 ;
8 ;;CANCEL ARCHIVAL SELECTION
 S DIAR=99 G ENTC^DIARA
 ;
9 ;;FIND ARCHIVED ENTRIES
 S DIC=9.4,DIC(0)="QM",DIC("S")="I $P(^(0),U,2)=""XU""",X="KERNEL" D ^DIC K X,DIC I Y'>0 W !,$C(7),"YOU NEED KERNEL TO RUN THIS OPTION" Q
 I $G(^DIC(9.4,+Y,"VERSION"))'>7.0 W !,$C(7),"YOU NEED KERNEL V7.1 TO RUN THIS OPTION" Q
 G ^DIARR
 ;
Q G Q^DIARB
 ;
AL ; archive device label
 U IO(0) K DIR,DA
 S DIARXXX=$S(IOT["MT":IO_"ARCHIVE"_";"_DT_";"_DIARC,1:IO)
 S DIR(0)="1.11,18",DIR("B")=DIARXXX D ^DIR Q:$D(DTOUT)!$D(DUOUT)
 S DIARXXX=X,DIE=1.11,DA=DIARC,DR="18////^S X=DIARXXX" D ^DIE
 Q
NOKL S DIK="^DOPT(""DIAR""," G GO:$D(^DOPT("DIAR",9))
 S ^(0)="ARCHIVE OPTION^1.01^" K ^("B")
 F I=1:1:9 S ^DOPT("DIAR",I,0)=$P($T(@I),";;",2)
 D IXALL^DIK
GO W ! S DIC=DIK,DIC(0)="AEQI" D ^DIC K DIC,DIK
 I Y'<0 S X=+Y K Y D @X G NOKL
 W ! G Q^DII