AZGSAVEM ;RPMS/TJF/MLQ;SAVE GLOBAL TO UNIX MEDIA; [ 03/11/94 7:42 AM ]
;;1.4;AUGS;**1**;OCT 16, 1991
I ^%ZOSF("OS")["PC"!($P($G(^AUTTSITE(1,0)),U,21)=2) G ^AZGSAVEP
G:$D(AUMED) NOSELT
ASK R !!,"Copy transaction file to ('^' TO EXIT WITHOUT SAVING)",!!?10,"[T]ape, [C]artridge, [D]iskette, or [F]ile F// ",AUMED:DTIME S AUMED=$E(AUMED_"F")
I "^"[AUMED S AUFLG(1)="Job Terminated by Operator at Device Select",AUFLG=-1 G END
G HELP:"?"[AUMED,ASK:"CcDdFfTt"'[AUMED
NOSELT I '$D(ZTQUEUED) S IOP=$I D ^%ZIS K IOP S IOP="HOME" D ^%ZIS S X=0 X ^%ZOSF("RM") ;IHS/THL 'CURRENT' CHANGED TO 'HOME'
S IO=AUIO,%DEV=IO D TAPE:"Tt"[AUMED D CART:"Cc"[AUMED D DISK:"Dd"[AUMED D UNIX:"Ff"[AUMED
Q
HELP W !!,"This option saves the ' ",AUNAR," ",AUGL,"' transaction file to either a tape,",!,"a floppy diskette, or a Unix file. The default is to a unix file",!,"in the ",AUUF," directory."
W !,"Enter either a ""C"" for tape cartridge, a ""T"" for 9-track tape, a ""D"" for floppy disk, or an ""F"" for Unix file."
G ASK
DISK ;
S X="^" U IO(0) W !!,"Mount a FORMATTED Floppy Diskette, 'WRITE ENABLED' ",*7,!,"Press RETURN When Ready or ""^"" to Exit WITHOUT SAVING " R X:DTIME I X["^" S AUFLG(1)="Job Aborted by Operator During Floppy Mount",AUFLG=-1 G END
O IO:("/dev/fd0":"W"):0 E S ERRMSG="Floppy Disk" G ERRMESS
U IO I $ZA<0 U IO(0) W !!,"Please",*7 G DISK
U IO(0) W !,"Please Standby - Copying Data to Floppy",! D ^AZGSAV1M
C:IO'=IO(0) IO
U IO(0) R !!,"Remove the Floppy... Press RETURN when Ready:",X:DTIME G END
UNIX ;
HFS ;
S AZGT1=$P($H,",",2)
HFS1 F %DEV=51:1:54 O %DEV::0 Q:$T
I '$T,$P($H,",",2)<(AZGT1+10) G HFS1
I '$T,$P($H,",",2)>(AZGT1+9) S ERRMSG="All Host File Servers Busy!" G ERRMESS
S PRE=$E(AUGL,2,5),ASUFAC=$S('$D(AUSUFAC):$P(^AUTTLOC(DUZ(2),0),"^",10),1:AUSUFAC),X=""
I '$D(ZTQUEUED) U IO(0) W !!,"UNIX File Being Created' ",*7 ;IHS/THL ADDED CHECK FOR BACKGROUND
S %FN=AUUF_"/"_$S('$D(AUFN):PRE_ASUFAC_"."_AUCARTNO,1:AUFN)
O %DEV:(%FN:"W"):0 E S ERRMSG="UNIX File" G ERRMESS
I '$D(ZTQUEUED) U IO(0) W !,"Please Standby - Copying Data to UNIX File ",$S('$D(AUFN):PRE_ASUFAC_"."_AUCARTNO,1:AUFN),! ;IHS/THL ADDED CHECK FOR BACKGROUND
D ^AZGSAV1M
G CLOSE
TAPE S DEVICE="/dev/rmt0",MESSAGE="9-Track" G TAPETST
CART S DEVICE="/dev/rct",MESSAGE="Cartridge"
;
TAPETST R !,"Do you want to test the TAPE DRIVE? (Y/N) Y//",Y:DTIME S Y=$E(Y_"Y") I "Yy"[Y D TAPETEST G:$D(AUFLG) CLOSE I Y["^" S AUFLG(1)="Job Aborted by Operator During Tape Test",AUFLG=-1 G END
S U IO(0) W !!,"Mount ",MESSAGE," Tape, 'WRITE ENABLED' ",*7
R !,"Press RETURN When Ready - ""^"" to Exit ",X:DTIME I X["^" S AUFLG(1)="Job Terminated By Operator at Mount Message",AUFLG=-1 G CLOSE
MAGOPEN O IO:(DEVICE:"W"):0 E S ERRMSG="Magtape Device" G ERRMESS
U IO I $ZA<0 U IO(0) W !!,"Please",*7 G S
U IO(0) W !,"Please Standby - Copying Data to Tape",!
D ^AZGSAV1M G EXIT
SW U IO(0) W *7,!!," The Tape Is WRITE PROTECTED. Please Remove The Tape,"
W !," And Re-position The Write Protect/Enable Switch.",!," "
G MAGOPEN
ERRMESS I '$D(ZTQUEUED) U IO(0) W !,ERRMSG," NOT AVAILABLE" ;IHS/THL ADDED CHECH FOR BACKGROUND
S AUFLG(1)=ERRMSG_" Not Available",AUFLG=-1 G END
EXIT U IO:(DEVICE) C:IO'=IO(0) IO U IO(0) W !!,"Rewinding tape. <WAIT>" W "." H 2
U IO(0) W !!,"Remove the tape... Press RETURN when Ready:" R X:DTIME
G END
CLOSE C:IO'=IO(0) IO,%DEV
END ; uncomment the line below to get data file queued for uucp
;I '$D(AUFLG),$P(^AUTTSITE(1,0),"^",14)]"" D UUCPQ ;IHS/MFD added line
K PRE,ASUFAC,OUTDATA,INDATA,DEVICE,MESSAGE,IO,ERRMSG,X,Y,%FN
Q
TAPETEST U IO(0) W !!,"TAPE TEST...Mount ",MESSAGE," Tape, 'WRITE ENABLED' ",*7
R !,"TAPE TEST...Press RETURN When Ready - ""^"" to Exit ",X:DTIME
I X["^" S AUFLG(1)="Job Aborted by Operator during Tape Test",AUFLG=-1 Q
W !,"TAPE TEST...Opening tape drive." H 1
O IO:(DEVICE:"W"):0 E G TESTERR
U IO I $ZA<0 U IO(0) W !!,"Please",*7 G TAPETEST
U IO(0) W !,"TAPE TEST...Tape drive opened.",!,"TAPE TEST...Writing test data to tape." H 1
WRITE S OUTDATA="TEST DATA RECORD WRITTEN TO TAPE ON "_AUDT U IO W OUTDATA,!
W "**",!,"**",!!
U IO(0) W !,"TAPE TEST...Data written." C:IO'=IO(0) IO H 6 U IO(0) W !,"TAPE TEST...Reading test data from tape.",! H 1
O IO:(DEVICE:"R"):0 E G TESTERR
U IO R INDATA:DTIME C:IO'=IO(0) IO W !,"WROTE : '",OUTDATA,"'",!," READ : '",INDATA,"'"
I INDATA=OUTDATA W !,"TAPE TEST...Successful."
E W !,"TAPE TEST...FAILED...$#@!" S AUFLG(1)="Tape Test Failed During Testing",AUFLG=-1 Q
Q
TESTERR S AUFLG(1)="Device Not Available During Tape Testing",AUFLG=-1
U IO(0) W !,*7,AUFLG(1),*7 Q
UUCPQ ;
S AUUUCP=$P(^AUTTSITE(1,0),"^",14)
S AUUUCPQ="/usr/bin/sendto "_AUUUCP_" /usr/spool/uucppublic/"_PRE_ASUFAC_"."_AUCARTNO
S AUUUCPQ=$$JOBWAIT^%HOSTCMD(AUUUCPQ) ; AUGS*1.4*1
I AUUUCPQ S AUFLG=-1,AUFLG(1)="Queue of File to uucp Failed" ; AUGS*1.4*1
E W:'$D(ZTQUEUED) !,"Export file ",PRE,ASUFAC,".",AUCARTNO," queued up to be sent to ",AUUUCP,"...",! ; AUGS*1.4*1
K AUUUCP,AUUUCPQ ; AUGS*1.4*1
Q
AZGSAVEM ;RPMS/TJF/MLQ;SAVE GLOBAL TO UNIX MEDIA; [ 03/11/94 7:42 AM ]
+1 ;;1.4;AUGS;**1**;OCT 16, 1991
+2 IF ^%ZOSF("OS")["PC"!($PIECE($GET(^AUTTSITE(1,0)),U,21)=2)
GOTO ^AZGSAVEP
+3 IF $DATA(AUMED)
GOTO NOSELT
ASK READ !!,"Copy transaction file to ('^' TO EXIT WITHOUT SAVING)",!!?10,"[T]ape, [C]artridge, [D]iskette, or [F]ile F// ",AUMED:DTIME
SET AUMED=$EXTRACT(AUMED_"F")
+1 IF "^"[AUMED
SET AUFLG(1)="Job Terminated by Operator at Device Select"
SET AUFLG=-1
GOTO END
+2 IF "?"[AUMED
GOTO HELP
IF "CcDdFfTt"'[AUMED
GOTO ASK
NOSELT ;IHS/THL 'CURRENT' CHANGED TO 'HOME'
IF '$DATA(ZTQUEUED)
SET IOP=$IO
DO ^%ZIS
KILL IOP
SET IOP="HOME"
DO ^%ZIS
SET X=0
XECUTE ^%ZOSF("RM")
+1 SET IO=AUIO
SET %DEV=IO
IF "Tt"[AUMED
DO TAPE
IF "Cc"[AUMED
DO CART
IF "Dd"[AUMED
DO DISK
IF "Ff"[AUMED
DO UNIX
+2 QUIT
HELP WRITE !!,"This option saves the ' ",AUNAR," ",AUGL,"' transaction file to either a tape,",!,"a floppy diskette, or a Unix file. The default is to a unix file",!,"in the ",AUUF," directory."
+1 WRITE !,"Enter either a ""C"" for tape cartridge, a ""T"" for 9-track tape, a ""D"" for floppy disk, or an ""F"" for Unix file."
+2 GOTO ASK
DISK ;
+1 SET X="^"
USE IO(0)
WRITE !!,"Mount a FORMATTED Floppy Diskette, 'WRITE ENABLED' ",*7,!,"Press RETURN When Ready or ""^"" to Exit WITHOUT SAVING "
READ X:DTIME
IF X["^"
SET AUFLG(1)="Job Aborted by Operator During Floppy Mount"
SET AUFLG=-1
GOTO END
+2 OPEN IO:("/dev/fd0":"W"):0
IF '$TEST
SET ERRMSG="Floppy Disk"
GOTO ERRMESS
+3 USE IO
IF $ZA<0
USE IO(0)
WRITE !!,"Please",*7
GOTO DISK
+4 USE IO(0)
WRITE !,"Please Standby - Copying Data to Floppy",!
DO ^AZGSAV1M
+5 IF IO'=IO(0)
CLOSE IO
+6 USE IO(0)
READ !!,"Remove the Floppy... Press RETURN when Ready:",X:DTIME
GOTO END
UNIX ;
HFS ;
+1 SET AZGT1=$PIECE($HOROLOG,",",2)
HFS1 FOR %DEV=51:1:54
OPEN %DEV::0
IF $TEST
QUIT
+1 IF '$TEST
IF $PIECE($HOROLOG,",",2)<(AZGT1+10)
GOTO HFS1
+2 IF '$TEST
IF $PIECE($HOROLOG,",",2)>(AZGT1+9)
SET ERRMSG="All Host File Servers Busy!"
GOTO ERRMESS
+3 SET PRE=$EXTRACT(AUGL,2,5)
SET ASUFAC=$SELECT('$DATA(AUSUFAC):$PIECE(^AUTTLOC(DUZ(2),0),"^",10),1:AUSUFAC)
SET X=""
+4 ;IHS/THL ADDED CHECK FOR BACKGROUND
IF '$DATA(ZTQUEUED)
USE IO(0)
WRITE !!,"UNIX File Being Created' ",*7
+5 SET %FN=AUUF_"/"_$SELECT('$DATA(AUFN):PRE_ASUFAC_"."_AUCARTNO,1:AUFN)
+6 OPEN %DEV:(%FN:"W"):0
IF '$TEST
SET ERRMSG="UNIX File"
GOTO ERRMESS
+7 ;IHS/THL ADDED CHECK FOR BACKGROUND
IF '$DATA(ZTQUEUED)
USE IO(0)
WRITE !,"Please Standby - Copying Data to UNIX File ",$SELECT('$DATA(AUFN):PRE_ASUFAC_"."_AUCARTNO,1:AUFN),!
+8 DO ^AZGSAV1M
+9 GOTO CLOSE
TAPE SET DEVICE="/dev/rmt0"
SET MESSAGE="9-Track"
GOTO TAPETST
CART SET DEVICE="/dev/rct"
SET MESSAGE="Cartridge"
+1 ;
TAPETST READ !,"Do you want to test the TAPE DRIVE? (Y/N) Y//",Y:DTIME
SET Y=$EXTRACT(Y_"Y")
IF "Yy"[Y
DO TAPETEST
IF $DATA(AUFLG)
GOTO CLOSE
IF Y["^"
SET AUFLG(1)="Job Aborted by Operator During Tape Test"
SET AUFLG=-1
GOTO END
S USE IO(0)
WRITE !!,"Mount ",MESSAGE," Tape, 'WRITE ENABLED' ",*7
+1 READ !,"Press RETURN When Ready - ""^"" to Exit ",X:DTIME
IF X["^"
SET AUFLG(1)="Job Terminated By Operator at Mount Message"
SET AUFLG=-1
GOTO CLOSE
MAGOPEN OPEN IO:(DEVICE:"W"):0
IF '$TEST
SET ERRMSG="Magtape Device"
GOTO ERRMESS
+1 USE IO
IF $ZA<0
USE IO(0)
WRITE !!,"Please",*7
GOTO S
+2 USE IO(0)
WRITE !,"Please Standby - Copying Data to Tape",!
+3 DO ^AZGSAV1M
GOTO EXIT
SW USE IO(0)
WRITE *7,!!," The Tape Is WRITE PROTECTED. Please Remove The Tape,"
+1 WRITE !," And Re-position The Write Protect/Enable Switch.",!," "
+2 GOTO MAGOPEN
ERRMESS ;IHS/THL ADDED CHECH FOR BACKGROUND
IF '$DATA(ZTQUEUED)
USE IO(0)
WRITE !,ERRMSG," NOT AVAILABLE"
+1 SET AUFLG(1)=ERRMSG_" Not Available"
SET AUFLG=-1
GOTO END
EXIT USE IO:(DEVICE)
IF IO'=IO(0)
CLOSE IO
USE IO(0)
WRITE !!,"Rewinding tape. <WAIT>"
WRITE "."
HANG 2
+1 USE IO(0)
WRITE !!,"Remove the tape... Press RETURN when Ready:"
READ X:DTIME
+2 GOTO END
CLOSE IF IO'=IO(0)
CLOSE IO,%DEV
END ; uncomment the line below to get data file queued for uucp
+1 ;I '$D(AUFLG),$P(^AUTTSITE(1,0),"^",14)]"" D UUCPQ ;IHS/MFD added line
+2 KILL PRE,ASUFAC,OUTDATA,INDATA,DEVICE,MESSAGE,IO,ERRMSG,X,Y,%FN
+3 QUIT
TAPETEST USE IO(0)
WRITE !!,"TAPE TEST...Mount ",MESSAGE," Tape, 'WRITE ENABLED' ",*7
+1 READ !,"TAPE TEST...Press RETURN When Ready - ""^"" to Exit ",X:DTIME
+2 IF X["^"
SET AUFLG(1)="Job Aborted by Operator during Tape Test"
SET AUFLG=-1
QUIT
+3 WRITE !,"TAPE TEST...Opening tape drive."
HANG 1
+4 OPEN IO:(DEVICE:"W"):0
IF '$TEST
GOTO TESTERR
+5 USE IO
IF $ZA<0
USE IO(0)
WRITE !!,"Please",*7
GOTO TAPETEST
+6 USE IO(0)
WRITE !,"TAPE TEST...Tape drive opened.",!,"TAPE TEST...Writing test data to tape."
HANG 1
WRITE SET OUTDATA="TEST DATA RECORD WRITTEN TO TAPE ON "_AUDT
USE IO
WRITE OUTDATA,!
+1 WRITE "**",!,"**",!!
+2 USE IO(0)
WRITE !,"TAPE TEST...Data written."
IF IO'=IO(0)
CLOSE IO
HANG 6
USE IO(0)
WRITE !,"TAPE TEST...Reading test data from tape.",!
HANG 1
+3 OPEN IO:(DEVICE:"R"):0
IF '$TEST
GOTO TESTERR
+4 USE IO
READ INDATA:DTIME
IF IO'=IO(0)
CLOSE IO
WRITE !,"WROTE : '",OUTDATA,"'",!," READ : '",INDATA,"'"
+5 IF INDATA=OUTDATA
WRITE !,"TAPE TEST...Successful."
+6 IF '$TEST
WRITE !,"TAPE TEST...FAILED...$#@!"
SET AUFLG(1)="Tape Test Failed During Testing"
SET AUFLG=-1
QUIT
+7 QUIT
TESTERR SET AUFLG(1)="Device Not Available During Tape Testing"
SET AUFLG=-1
+1 USE IO(0)
WRITE !,*7,AUFLG(1),*7
QUIT
UUCPQ ;
+1 SET AUUUCP=$PIECE(^AUTTSITE(1,0),"^",14)
+2 SET AUUUCPQ="/usr/bin/sendto "_AUUUCP_" /usr/spool/uucppublic/"_PRE_ASUFAC_"."_AUCARTNO
+3 ; AUGS*1.4*1
SET AUUUCPQ=$$JOBWAIT^%HOSTCMD(AUUUCPQ)
+4 ; AUGS*1.4*1
IF AUUUCPQ
SET AUFLG=-1
SET AUFLG(1)="Queue of File to uucp Failed"
+5 ; AUGS*1.4*1
IF '$TEST
IF '$DATA(ZTQUEUED)
WRITE !,"Export file ",PRE,ASUFAC,".",AUCARTNO," queued up to be sent to ",AUUUCP,"...",!
+6 ; AUGS*1.4*1
KILL AUUUCP,AUUUCPQ
+7 QUIT