ACRFZISH ;IHS/OIRM/DSD/AEF/MRS - VARIOUS ZIS/ZISH UTILITY SUBROUTINES [ 10/27/2004 4:18 PM ]
;;2.1;ADMIN RESOURCE MGT SYSTEM;**13**;NOV 05, 2001
;NEW ROUTINE; ACR*2.1*13.01 IM13574
;
HFS(ZISH1,ZISH2,ZISH3,%FILE) ;EP ; VERBOSE & "FILE"
;----- CREATE AND OPEN UNIX FILE
; ENTERS WITH: ZISH1= PATH
; ZISH2= FILENAME
; ZISH3= "R" OR "W"
; RETURNS: %FILE = DEVICE NUMBER (or UNDEFINED)
; NOTE: USE CLOSE^ACRFZISH("FILE"), NOT ^%ZISC
;
N X,Y
D OPEN^%ZISH("FILE",ZISH1,ZISH2,ZISH3)
I POP D Q
. U IO(0) W !,"CANNOT OPEN FILE "_ZISH1_ZISH2
S %FILE=IO
Q
DEL(ZISH1,ZISH2) ;EP; CALLS EXTRINSIC FUNCTION TO DELETE FILES
;
; ENTERS WITH: ZISH1= PATH
; ZISH2= FILENAME
;
N Y
S Y=$$DEL^%ZISH(ZISH1,ZISH2)
Q
;
OPEN(ZISH1,ZISH2,ZISH3,%DEV) ;EP; OPEN UNIX FILES - VERBOSE & NO "FILE"
;
; INPUT:
; ZISH1 = DIRECTORY PATH STRING
; ZISH2 = FILENAME
; ZISH3 = OPEN MODE "R" = READ ONLY; "W" = WRITE
;
; RETURNS:
; %DEV = DEVICE NUMBER IF OPEN, UNDEFINED IF NOT
;
N Y
S Y=$$OPEN^%ZISH(ZISH1,ZISH2,ZISH3) ;ACR*2.1*13.01 IM13574
I Y D Q
. W !,"CANNOT OPEN FILE "_ZISH1_ZISH2
S %DEV=IO
Q
OPEN1166 ;EP; OLD 1166 APPROVALS FOR PAYMENT CHECKS
;EP entry point for using $$TERMINAL^%HOSTCMD
I '$D(^AFSLPRM(1,2)) D Q
.W !!,"SORRY...1166 AFP SYSTEM PARAMETERS FILE NOT COMPLETED"
.W !!,"PLEASE NOTIFY YOUR SITE MANAGER!"
.S Y=-1
.H 5
;
I $P(^AFSLPRM(1,2),U,4)="" D Q
.W !!,"SORRY...OPERATING SYSTEM FIELD IN PARAMETERS FILE NOT SET"
.W !!,"PLEASE NOTIFY YOUR SITE MANAGER!"
.S Y=-1
.H 5
S Y=$P(^AFSLPRM(1,2),U,4)
I Y=1!(Y=2)!(Y=4) S X=$$TERMINAL^%HOSTCMD(AFSLCMD) ;Blanket Exception
Q
SELDIR(PATH,OUT) ;EP
;----- SELECT UNIX DIRECTORY
;
; RETURNS: PATH IF VALID
; OUT = 1 IF INVALID
ASK ;
N DIR,Y
S OUT=0
S DIR(0)="F^3:300"
S DIR("A")="Select DIRECTORY "
S DIR("B")=PATH
D ^DIR
I $D(DTOUT)!($D(DUOUT))!($D(DIRUT)) S OUT=1 Q
S PATH=Y
D JCMD^ACRFUTL("cd "_PATH,.Y)
I Y D G ASK
. W !,"No such directory "_PATH
Q
ASKPATHO(ACRPATH,ACROK) ;EP;
;----- ASK IF DEFAULT PATH IS OK
;
N DIR,DIRUT,DTOUT,DUOUT
S ACROK=0
I ACRPATH']"" Q
W !,"The file will be put into directory ",ACRPATH
S DIR(0)="Y"
S DIR("A")="Is this OK"
S DIR("B")="YES"
D ^DIR
Q:$D(DTOUT)!($D(DUOUT))!($D(DIRUT))
S ACROK=Y
Q
LIST(ZISH1,ZISH2,ZISH3) ;EP
; CALLS %ZISH TO CREATE A LOCAL ARRAY HOLDING FILE NAMES
; ENTERS WITH: ZISH1 = PATH
; ZISH2= FILENAME
; RETURNS: ZISH3= ARRAY
;
Q $$LIST^%ZISH(ZISH1,ZISH2,.ZISH3)
;
PWD(X) ;EP; Print working directory
Q $$PWD^%ZISH(.X)
;
STATUS() ;EP;
Q $$STATUS^%ZISH
;
CLOSE(X) ;EP;TO CLOSE DEVICE
;X= HANDLE or NULL
D CLOSE^%ZISH(X)
K IOP,IOPAR,%ZIS,ZTSK,ZTQUEUED,ZTREQ
Q
ACRFZISH ;IHS/OIRM/DSD/AEF/MRS - VARIOUS ZIS/ZISH UTILITY SUBROUTINES [ 10/27/2004 4:18 PM ]
+1 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**13**;NOV 05, 2001
+2 ;NEW ROUTINE; ACR*2.1*13.01 IM13574
+3 ;
HFS(ZISH1,ZISH2,ZISH3,%FILE) ;EP ; VERBOSE & "FILE"
+1 ;----- CREATE AND OPEN UNIX FILE
+2 ; ENTERS WITH: ZISH1= PATH
+3 ; ZISH2= FILENAME
+4 ; ZISH3= "R" OR "W"
+5 ; RETURNS: %FILE = DEVICE NUMBER (or UNDEFINED)
+6 ; NOTE: USE CLOSE^ACRFZISH("FILE"), NOT ^%ZISC
+7 ;
+8 NEW X,Y
+9 DO OPEN^%ZISH("FILE",ZISH1,ZISH2,ZISH3)
+10 IF POP
Begin DoDot:1
+11 USE IO(0)
WRITE !,"CANNOT OPEN FILE "_ZISH1_ZISH2
End DoDot:1
QUIT
+12 SET %FILE=IO
+13 QUIT
DEL(ZISH1,ZISH2) ;EP; CALLS EXTRINSIC FUNCTION TO DELETE FILES
+1 ;
+2 ; ENTERS WITH: ZISH1= PATH
+3 ; ZISH2= FILENAME
+4 ;
+5 NEW Y
+6 SET Y=$$DEL^%ZISH(ZISH1,ZISH2)
+7 QUIT
+8 ;
OPEN(ZISH1,ZISH2,ZISH3,%DEV) ;EP; OPEN UNIX FILES - VERBOSE & NO "FILE"
+1 ;
+2 ; INPUT:
+3 ; ZISH1 = DIRECTORY PATH STRING
+4 ; ZISH2 = FILENAME
+5 ; ZISH3 = OPEN MODE "R" = READ ONLY; "W" = WRITE
+6 ;
+7 ; RETURNS:
+8 ; %DEV = DEVICE NUMBER IF OPEN, UNDEFINED IF NOT
+9 ;
+10 NEW Y
+11 ;ACR*2.1*13.01 IM13574
SET Y=$$OPEN^%ZISH(ZISH1,ZISH2,ZISH3)
+12 IF Y
Begin DoDot:1
+13 WRITE !,"CANNOT OPEN FILE "_ZISH1_ZISH2
End DoDot:1
QUIT
+14 SET %DEV=IO
+15 QUIT
OPEN1166 ;EP; OLD 1166 APPROVALS FOR PAYMENT CHECKS
+1 ;EP entry point for using $$TERMINAL^%HOSTCMD
+2 IF '$DATA(^AFSLPRM(1,2))
Begin DoDot:1
+3 WRITE !!,"SORRY...1166 AFP SYSTEM PARAMETERS FILE NOT COMPLETED"
+4 WRITE !!,"PLEASE NOTIFY YOUR SITE MANAGER!"
+5 SET Y=-1
+6 HANG 5
End DoDot:1
QUIT
+7 ;
+8 IF $PIECE(^AFSLPRM(1,2),U,4)=""
Begin DoDot:1
+9 WRITE !!,"SORRY...OPERATING SYSTEM FIELD IN PARAMETERS FILE NOT SET"
+10 WRITE !!,"PLEASE NOTIFY YOUR SITE MANAGER!"
+11 SET Y=-1
+12 HANG 5
End DoDot:1
QUIT
+13 SET Y=$PIECE(^AFSLPRM(1,2),U,4)
+14 ;Blanket Exception
IF Y=1!(Y=2)!(Y=4)
SET X=$$TERMINAL^%HOSTCMD(AFSLCMD)
+15 QUIT
SELDIR(PATH,OUT) ;EP
+1 ;----- SELECT UNIX DIRECTORY
+2 ;
+3 ; RETURNS: PATH IF VALID
+4 ; OUT = 1 IF INVALID
ASK ;
+1 NEW DIR,Y
+2 SET OUT=0
+3 SET DIR(0)="F^3:300"
+4 SET DIR("A")="Select DIRECTORY "
+5 SET DIR("B")=PATH
+6 DO ^DIR
+7 IF $DATA(DTOUT)!($DATA(DUOUT))!($DATA(DIRUT))
SET OUT=1
QUIT
+8 SET PATH=Y
+9 DO JCMD^ACRFUTL("cd "_PATH,.Y)
+10 IF Y
Begin DoDot:1
+11 WRITE !,"No such directory "_PATH
End DoDot:1
GOTO ASK
+12 QUIT
ASKPATHO(ACRPATH,ACROK) ;EP;
+1 ;----- ASK IF DEFAULT PATH IS OK
+2 ;
+3 NEW DIR,DIRUT,DTOUT,DUOUT
+4 SET ACROK=0
+5 IF ACRPATH']""
QUIT
+6 WRITE !,"The file will be put into directory ",ACRPATH
+7 SET DIR(0)="Y"
+8 SET DIR("A")="Is this OK"
+9 SET DIR("B")="YES"
+10 DO ^DIR
+11 IF $DATA(DTOUT)!($DATA(DUOUT))!($DATA(DIRUT))
QUIT
+12 SET ACROK=Y
+13 QUIT
LIST(ZISH1,ZISH2,ZISH3) ;EP
+1 ; CALLS %ZISH TO CREATE A LOCAL ARRAY HOLDING FILE NAMES
+2 ; ENTERS WITH: ZISH1 = PATH
+3 ; ZISH2= FILENAME
+4 ; RETURNS: ZISH3= ARRAY
+5 ;
+6 QUIT $$LIST^%ZISH(ZISH1,ZISH2,.ZISH3)
+7 ;
PWD(X) ;EP; Print working directory
+1 QUIT $$PWD^%ZISH(.X)
+2 ;
STATUS() ;EP;
+1 QUIT $$STATUS^%ZISH
+2 ;
CLOSE(X) ;EP;TO CLOSE DEVICE
+1 ;X= HANDLE or NULL
+2 DO CLOSE^%ZISH(X)
+3 KILL IOP,IOPAR,%ZIS,ZTSK,ZTQUEUED,ZTREQ
+4 QUIT