XTLATSET ;SF/RWF - BUILD SITE LT_LOAD.COM, LTPROT, and LT_PTR.DAT FILEs ;07/28/2005 16:41
;;7.3;TOOLKIT;**11,75,90**;Apr 25, 1995
A ;This routine sets up the files for LAT device setup
N EXIT,OS,DIR,XTWHEN,TX,XFIO,NODE,PORT,SPEED,Q,Y,DA,XTRM,DEV,FN,VAH
N CMDFN,DI,I,QUE,T,XTIO
I '$D(DT) S DT=$$DT^XLFDT
S EXIT=1 D
. S OS=^%ZOSF("OS")
. I OS["DSM" S EXIT=0 Q
. I OS["OpenM",$$OS^%ZOSV["VMS" S EXIT=0 Q
. I OS["GT.M",OS["VMS" S EXIT=0 Q
. Q
I EXIT W !!,"Not running on a VAX. Not a valid routine to run." G EXIT
;
W !!,"This routine will build new LT_LOAD.COM, LT_PTR.DAT, TSC_LOAD.COM files"
S DIR(0)="Y",DIR("A")="Want to proceed",DIR("A",1)="Do not use unless you are in the startup account",DIR("A",2)="where the correct VMS files are present!",DIR("B")="No",DIR("?")="See option description"
D ^DIR G EXIT:Y'=1!$D(DIRUT)
S IO=$I,U="^",X=$S($D(DUZ)[0:"Unknown",$D(^VA(200,DUZ,0)):$P(^(0),U,1),1:"Unknown"),XTWHEN="$! This version made on "_$$NOW^XLFDT()_", by "_X
D GETENV^%ZOSV S VAH=$P(Y,"^",1) ;Get UCI name
;Open files
F X=1,2,4 S FN=$P($T(OP+X),";;",2) D
. I VAH'="VAH" S FN=$P(FN,"]",1)_"]"_VAH_"_"_$P(FN,"]",2)
. S XFIO(X)=FN,TX="TX"_X
. D OPEN(XFIO(X))
. U IO
. D TX
;Build files
S XTIO="_"
F DI=0:0 S XTIO=$O(^%ZIS(1,"C",XTIO)) Q:XTIO="" D
. F DA=0:0 S DA=$O(^%ZIS(1,"C",XTIO,DA)) D:DA>0 Q:DA'>0
. . S X=$S($D(^%ZIS(1,DA,0)):^(0),1:""),Y=$S($D(^("VMS")):^("VMS"),1:"")
. . I $D(^%ZIS(1,DA,90)),^(90)>0,DT'>^(90) Q ;OutOfService
. . D FILE
. . Q
. Q
;Finish up and close
U 0 W !!,"The following files have been updated:",!!
F X=1,2,4 D
.W !?2,XFIO(X)
.D @("CL"_X)
.X "C XFIO(X)"
W !!,"To update the VMS configuration, the following COM"
W !,"procedures must be run on your cluster:"
W !!?2,"DO @"_XFIO(1) ; SYS$MANAGER:[VAH_]LT_LOAD.COM
W !?2,"DO @SYS$MANAGER:SYSPRINT.COM",!
S DIR(0)="Y",DIR("A")="Want to run them now",DIR("B")="Yes" D ^DIR
I Y=1 D RUN
;
EXIT K DIR,XTWHEN,TX,XFIO,NODE,PORT,SPEED,Q,Y,DA,XTRM,DEV,OS Q
;
RUN ;Run the com files
S CMDFN="SYS$MANAGER:LT_EXECUTE.COM" D OPEN(CMDFN)
U CMDFN
W "$! Run LT_LOAD and SYSPRINT on the cluster"
W !,"MCR SYSMAN"
W !,"SET E/C"
W !,"DO @"_XFIO(1) ; SYS$MANAGER:[VAH_]LT_LOAD.COM
W !,"DO @SYS$MANAGER:SYSPRINT.COM"
W !,"EXIT"
W !,"$EXIT",!
X "C CMDFN"
D DOCMD("PURGE "_CMDFN) ;Purge the COM file
D DOCMD("@"_CMDFN) ;Run the COM file
Q
;
OPEN(FN) ;Open file for write
I OS["DSM" X "O FN:NEWVERSION"
I OS["OpenM" X "O FN:(""NWS""):1"
I OS["GT.M" X "O FN:(newversion)"
Q
DOCMD(CMD) ;Do a VMS command
W !,"Execute command: "_CMD
I OS["OpenM" X "S X=$ZF(-1,CMD)" Q
I OS["DSM" X "S X=$ZC(%SPAWN,CMD)" Q
I OS["GT.M" X "ZSYSTEM CMD" Q
Q
;
FILE ;write data for this device
S DEV=$P(X,U,2),NODE=$P(Y,U,1),PORT=$P(Y,U,2),SPEED=$S($P(Y,U,4)]"":$P(Y,U,4),1:9600)
Q:(NODE="")!(PORT="") U IO W !," setup "_$P(X,U)
S QUE=$S($P(Y,U,3)]"":$P(Y,U,3),1:"n")
S XTRM=$S($D(^%ZIS(1,DA,"SUBTYPE")):^("SUBTYPE"),1:0),XTRM=$S($D(^%ZIS(2,+XTRM,1)):+^(1),1:80) ;Get value from TT file
S XTRM=$S(XTRM<1:80,XTRM>511:511,1:XTRM),XTRM=$E(1000+XTRM,2,4) ;Check range 80-511
S XTRM=255 ;Force value
1 ;Write to LT_LOAD
U XFIO(1) W "create port "_DEV_" /nolog ! "_$P(X,U),!
W "set port "_DEV_" /app /queue /nolog /node="_NODE_" /port="_PORT,!
2 ;Write to LT_PTR
U XFIO(2) W QUE_XTRM_$E(DEV_" ",1,9)_$E(SPEED_" ",1,5)_" ! "_$P(X,U),!
3 ;U XFIO(3) W "$ prot "_$P(X,U,2),!
4 ;TSC_LOAD
U XFIO(4) W "@PR "_NODE_" "_PORT_" "_SPEED,!
S DA=0 Q ;Force end of loop on DA
;
OP ;File names to open
;;SYS$COMMON:[SYSMGR]LT_LOAD.COM
;;SYS$COMMON:[SYSMGR]LT_PTR.DAT
;;place holder
;;SYS$COMMON:[DECSERVER]TSC_LOAD.COM
CL1 U XFIO(1) W "exit",!,"$ EXIT 1" Q
CL2 U XFIO(2) W "$ EXIT" Q
CL3 U XFIO(3) W "$ EXIT" Q
CL4 U XFIO(4) W "$ EXIT" Q
;
TX U XFIO(X) W XTWHEN,! F I=0:1 S T=$T(@TX+I),T=$P(T,";;",2,9) Q:T="" W T,!
Q
TX1 ;;$! Create and set DECserver ports
;;$ SET NOON
;;$ RUN SYS$SYSTEM:LATCP
;;
TX2 ;;$ This file is used as input to SYSPRINT.com
;;
TX3 ;;$ prot:= set prot=(O:rwlp,G:rwlp,W:rwlp)/device/owner=[100,1]/nolog
;;$! set device protection
;;
TX4 ;;$! Create file to set DECservers for printers
;;$ tsc:= run DS5CFG
;;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXTLATSET 4277 printed Oct 16, 2024@18:41:55 Page 2
XTLATSET ;SF/RWF - BUILD SITE LT_LOAD.COM, LTPROT, and LT_PTR.DAT FILEs ;07/28/2005 16:41
+1 ;;7.3;TOOLKIT;**11,75,90**;Apr 25, 1995
A ;This routine sets up the files for LAT device setup
+1 NEW EXIT,OS,DIR,XTWHEN,TX,XFIO,NODE,PORT,SPEED,Q,Y,DA,XTRM,DEV,FN,VAH
+2 NEW CMDFN,DI,I,QUE,T,XTIO
+3 IF '$DATA(DT)
SET DT=$$DT^XLFDT
+4 SET EXIT=1
Begin DoDot:1
+5 SET OS=^%ZOSF("OS")
+6 IF OS["DSM"
SET EXIT=0
QUIT
+7 IF OS["OpenM"
IF $$OS^%ZOSV["VMS"
SET EXIT=0
QUIT
+8 IF OS["GT.M"
IF OS["VMS"
SET EXIT=0
QUIT
+9 QUIT
End DoDot:1
+10 IF EXIT
WRITE !!,"Not running on a VAX. Not a valid routine to run."
GOTO EXIT
+11 ;
+12 WRITE !!,"This routine will build new LT_LOAD.COM, LT_PTR.DAT, TSC_LOAD.COM files"
+13 SET DIR(0)="Y"
SET DIR("A")="Want to proceed"
SET DIR("A",1)="Do not use unless you are in the startup account"
SET DIR("A",2)="where the correct VMS files are present!"
SET DIR("B")="No"
SET DIR("?")="See option description"
+14 DO ^DIR
if Y'=1!$DATA(DIRUT)
GOTO EXIT
+15 SET IO=$IO
SET U="^"
SET X=$SELECT($DATA(DUZ)[0:"Unknown",$DATA(^VA(200,DUZ,0)):$PIECE(^(0),U,1),1:"Unknown")
SET XTWHEN="$! This version made on "_$$NOW^XLFDT()_", by "_X
+16 ;Get UCI name
DO GETENV^%ZOSV
SET VAH=$PIECE(Y,"^",1)
+17 ;Open files
+18 FOR X=1,2,4
SET FN=$PIECE($TEXT(OP+X),";;",2)
Begin DoDot:1
+19 IF VAH'="VAH"
SET FN=$PIECE(FN,"]",1)_"]"_VAH_"_"_$PIECE(FN,"]",2)
+20 SET XFIO(X)=FN
SET TX="TX"_X
+21 DO OPEN(XFIO(X))
+22 USE IO
+23 DO TX
End DoDot:1
+24 ;Build files
+25 SET XTIO="_"
+26 FOR DI=0:0
SET XTIO=$ORDER(^%ZIS(1,"C",XTIO))
if XTIO=""
QUIT
Begin DoDot:1
+27 FOR DA=0:0
SET DA=$ORDER(^%ZIS(1,"C",XTIO,DA))
if DA>0
Begin DoDot:2
+28 SET X=$SELECT($DATA(^%ZIS(1,DA,0)):^(0),1:"")
SET Y=$SELECT($DATA(^("VMS")):^("VMS"),1:"")
+29 ;OutOfService
IF $DATA(^%ZIS(1,DA,90))
IF ^(90)>0
IF DT'>^(90)
QUIT
+30 DO FILE
+31 QUIT
End DoDot:2
if DA'>0
QUIT
+32 QUIT
End DoDot:1
+33 ;Finish up and close
+34 USE 0
WRITE !!,"The following files have been updated:",!!
+35 FOR X=1,2,4
Begin DoDot:1
+36 WRITE !?2,XFIO(X)
+37 DO @("CL"_X)
+38 XECUTE "C XFIO(X)"
End DoDot:1
+39 WRITE !!,"To update the VMS configuration, the following COM"
+40 WRITE !,"procedures must be run on your cluster:"
+41 ; SYS$MANAGER:[VAH_]LT_LOAD.COM
WRITE !!?2,"DO @"_XFIO(1)
+42 WRITE !?2,"DO @SYS$MANAGER:SYSPRINT.COM",!
+43 SET DIR(0)="Y"
SET DIR("A")="Want to run them now"
SET DIR("B")="Yes"
DO ^DIR
+44 IF Y=1
DO RUN
+45 ;
EXIT KILL DIR,XTWHEN,TX,XFIO,NODE,PORT,SPEED,Q,Y,DA,XTRM,DEV,OS
QUIT
+1 ;
RUN ;Run the com files
+1 SET CMDFN="SYS$MANAGER:LT_EXECUTE.COM"
DO OPEN(CMDFN)
+2 USE CMDFN
+3 WRITE "$! Run LT_LOAD and SYSPRINT on the cluster"
+4 WRITE !,"MCR SYSMAN"
+5 WRITE !,"SET E/C"
+6 ; SYS$MANAGER:[VAH_]LT_LOAD.COM
WRITE !,"DO @"_XFIO(1)
+7 WRITE !,"DO @SYS$MANAGER:SYSPRINT.COM"
+8 WRITE !,"EXIT"
+9 WRITE !,"$EXIT",!
+10 XECUTE "C CMDFN"
+11 ;Purge the COM file
DO DOCMD("PURGE "_CMDFN)
+12 ;Run the COM file
DO DOCMD("@"_CMDFN)
+13 QUIT
+14 ;
OPEN(FN) ;Open file for write
+1 IF OS["DSM"
XECUTE "O FN:NEWVERSION"
+2 IF OS["OpenM"
XECUTE "O FN:(""NWS""):1"
+3 IF OS["GT.M"
XECUTE "O FN:(newversion)"
+4 QUIT
DOCMD(CMD) ;Do a VMS command
+1 WRITE !,"Execute command: "_CMD
+2 IF OS["OpenM"
XECUTE "S X=$ZF(-1,CMD)"
QUIT
+3 IF OS["DSM"
XECUTE "S X=$ZC(%SPAWN,CMD)"
QUIT
+4 IF OS["GT.M"
XECUTE "ZSYSTEM CMD"
QUIT
+5 QUIT
+6 ;
FILE ;write data for this device
+1 SET DEV=$PIECE(X,U,2)
SET NODE=$PIECE(Y,U,1)
SET PORT=$PIECE(Y,U,2)
SET SPEED=$SELECT($PIECE(Y,U,4)]"":$PIECE(Y,U,4),1:9600)
+2 if (NODE="")!(PORT="")
QUIT
USE IO
WRITE !," setup "_$PIECE(X,U)
+3 SET QUE=$SELECT($PIECE(Y,U,3)]"":$PIECE(Y,U,3),1:"n")
+4 ;Get value from TT file
SET XTRM=$SELECT($DATA(^%ZIS(1,DA,"SUBTYPE")):^("SUBTYPE"),1:0)
SET XTRM=$SELECT($DATA(^%ZIS(2,+XTRM,1)):+^(1),1:80)
+5 ;Check range 80-511
SET XTRM=$SELECT(XTRM<1:80,XTRM>511:511,1:XTRM)
SET XTRM=$EXTRACT(1000+XTRM,2,4)
+6 ;Force value
SET XTRM=255
1 ;Write to LT_LOAD
+1 USE XFIO(1)
WRITE "create port "_DEV_" /nolog ! "_$PIECE(X,U),!
+2 WRITE "set port "_DEV_" /app /queue /nolog /node="_NODE_" /port="_PORT,!
2 ;Write to LT_PTR
+1 USE XFIO(2)
WRITE QUE_XTRM_$EXTRACT(DEV_" ",1,9)_$EXTRACT(SPEED_" ",1,5)_" ! "_$PIECE(X,U),!
3 ;U XFIO(3) W "$ prot "_$P(X,U,2),!
4 ;TSC_LOAD
+1 USE XFIO(4)
WRITE "@PR "_NODE_" "_PORT_" "_SPEED,!
+2 ;Force end of loop on DA
SET DA=0
QUIT
+3 ;
OP ;File names to open
+1 ;;SYS$COMMON:[SYSMGR]LT_LOAD.COM
+2 ;;SYS$COMMON:[SYSMGR]LT_PTR.DAT
+3 ;;place holder
+4 ;;SYS$COMMON:[DECSERVER]TSC_LOAD.COM
CL1 USE XFIO(1)
WRITE "exit",!,"$ EXIT 1"
QUIT
CL2 USE XFIO(2)
WRITE "$ EXIT"
QUIT
CL3 USE XFIO(3)
WRITE "$ EXIT"
QUIT
CL4 USE XFIO(4)
WRITE "$ EXIT"
QUIT
+1 ;
TX USE XFIO(X)
WRITE XTWHEN,!
FOR I=0:1
SET T=$TEXT(@TX+I)
SET T=$PIECE(T,";;",2,9)
if T=""
QUIT
WRITE T,!
+1 QUIT
TX1 ;;$! Create and set DECserver ports
+1 ;;$ SET NOON
+2 ;;$ RUN SYS$SYSTEM:LATCP
+3 ;;
TX2 ;;$ This file is used as input to SYSPRINT.com
+1 ;;
TX3 ;;$ prot:= set prot=(O:rwlp,G:rwlp,W:rwlp)/device/owner=[100,1]/nolog
+1 ;;$! set device protection
+2 ;;
TX4 ;;$! Create file to set DECservers for printers
+1 ;;$ tsc:= run DS5CFG
+2 ;;