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

ACRFZISH.m

Go to the documentation of this file.
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