%ZUCI ; IHS/ADC/GTH - SWAP UCI BETWEEN VOLUME SETS FOR MSM-UNIX ; [ 10/29/2002 7:42 AM ]
;;3.0;IHS/VA UTILITIES;**9**;FEB 07, 1997
;
; SAVE THIS ROUTINE AS %ZUCI IN THE MGR UCI
;
; This utility permits switching between UCIs and Volume
; Groups when run in programmer mode. D ^%ZUCI
;
; If switching to a UCI in a Volume Group other than the
; System Volume Group (0), you must enter either the Volume
; Group Number or Volume Group Name along with the UCI Number
; or Name. A 'help' display identifies all UCIs and Volume
; Groups that are currently mounted. Use a '?' for 'help'.
;
; A routine may be tied to the UCI,VOL switch. This routine
; will be called immediately after the UCI,VOL switch occurs.
I $$VERSION^%ZOSV(1)["Cache" D ^%CD Q ; IHS/SET/GTH XB*3*9 10/29/2002
;
EN ; ENTRY - Ask for [UCI,VOL]
W !,"SWITCH TO NEW UCI",!
S $P(%ZIB("DASHES"),"-",81)=""
ASK ; Get new UCI name or number.
F %ZIB("ASK")=0:0:0 D
. S %ZIB("ZT")=0 ; Set DSM error flag for <NOUCI> or <NOSYS>
. S %ZIB("VERIFY UCI")=0 ; Verify UCI flag set to NO.
. W !,"You are now in ",$ZU(0)
. W !!,"Enter new UCI: "
. ; If read timesout or a "^" or <RET> is entered then set the
. ; loop at ASK+1 to quit
. R %ZIB("%"):45 E W *7,"**Timeout**",!!,"You are still in ",$ZU(0) S %ZIB("ASK")=1 Q
. I "^"[%ZIB("%") W *7," No action taken!",!!,"You are still in ",$ZU(0) S %ZIB("ASK")=1 Q
. S %ZIB("VERIFY UCI")=1 ; Verify UCI flag set to YES.
ED . ; Edit input from user.
. D ; Edit input.
.. S %ZIB("ASK")=1 ; Set loop at ASK+1 to QUIT.
.. Q:%ZIB("%")?3A
.. Q:%ZIB("%")?3A1":"1.17E
.. Q:%ZIB("%")?3A1","3A
.. Q:%ZIB("%")?3A1","3A1":"1.17E
.. Q:%ZIB("%")?2N
.. Q:%ZIB("%")?2N1":"1.17E
.. Q:%ZIB("%")?2N1","1N
.. Q:%ZIB("%")?2N1","1N1":"1.17E
.. Q:%ZIB("%")?1N
.. Q:%ZIB("%")?1N1":"1.17E
.. Q:%ZIB("%")?1N1","1N
.. Q:%ZIB("%")?1N1","1N1":"1.17E
.. I %ZIB("%")'["?" D
... W " ?? **Incorrect input**",*7
... W !,%ZIB("DASHES")
... W !,"Enter ""?"" to get help or"
... W !,"Enter {UCI} {UCI:ROUTINE} {UCI,VOL} {UCI,VOL:ROUTINE}"
... W !,%ZIB("DASHES")
.. S %ZIB("ASK")=0 ; Continue the loop at ASK+1.
.. S %ZIB("VERIFY UCI")=0 ; Set verify UCI flag to NO.
HLP .. ; Display UCI list.
.. I %ZIB("%")?1"?" D
... W !,%ZIB("DASHES")
... W !,"UCIs and VOLume groups are identified by either a name or number."
... W !,"Use the name or number identification when selecting a UCI."
... W !!,"Enter ""??"" to get a list of UCIs and VOLume sets."
... W !," ""???"" to get examples."
... W !!,"Enter {UCI} {UCI,VOL} {UCI:ROUTINE} {UCI,VOL:ROUTINE}."
... W !,%ZIB("DASHES")
.. I %ZIB("%")?1"??" D
... W !!,"Select from any UCI,VOL from this list:"
... S %ZIB("NO SYS")=0 ; Set no more VOLUME SETs for MSM.
... F %ZIB("VOL NBR")=0:1 D Q:%ZIB("NO SYS")
.... S $ZT="ZT^%ZIBZUCI" ; Set DSM error trap for <NOSYS>.
.... I $ZU(1,%ZIB("VOL NBR"))="" S %ZIB("NO SYS")=1 Q ; DSM gets a <NOSYS> error if end of VOLUME SETs.
.... W !,%ZIB("DASHES")
.... W !,"UCIs in Volume Group Number ",%ZIB("VOL NBR")," . . . Volume Group Name is ",$P($ZU(1,%ZIB("VOL NBR")),",",2),!
.... S %ZIB("NO UCI")=0 ; Set no more UCI flag for MSM.
.... F %ZIB("UCI NBR")=1:1 D Q:%ZIB("NO UCI")
..... S $ZT="ZT^%ZIBZUCI" ; Set DSM error trap for <NOUCI> error.
..... I $ZU(%ZIB("UCI NBR"),(%ZIB("VOL NBR")))="" S %ZIB("NO UCI")=1 Q ; End of UCIs for this VOLUME SET.
..... S %ZIB("UCI,VOL","NAME")=$ZU(%ZIB("UCI NBR"),%ZIB("VOL NBR"))
..... S %ZIB("UCI,VOL","NBR")=%ZIB("UCI NBR")_","_%ZIB("VOL NBR")
..... W:'((%ZIB("UCI NBR")-1)#3) !
..... W "UCI ",%ZIB("UCI,VOL","NBR")," is ",%ZIB("UCI,VOL","NAME")
..... W $J("",25-($L(%ZIB("UCI,VOL","NBR"))+$L(%ZIB("UCI,VOL","NAME"))+8))
... W !,%ZIB("DASHES")
EXAMP .. ;
.. I %ZIB("%")?1"???" D
... W !!,"Examples for switching UCIs",?53,"NAME SYNTAX",?67,"NUMBER SYNTAX"
... W !,%ZIB("DASHES")
... W !," Switch to DEV on default volume group (0)",?55,"DEV",?72,"3"
... W !," Switch to DEV on the volume group AAA (1)",?55,"DEV,AAA",?72,"3,1"
... W !,%ZIB("DASHES")
... W !,"Examples of switching UCIs and running a routine"
... W ?55,"DEV:%SY",?72,"3:%SY"
... W !?55,"DEV,AAA:%SY",?72,"3,1:%SY"
... W !?55,"DEV:P^DI",?72,"3:P^DI"
... W !,%ZIB("DASHES")
... W !,"NOTE: Name,Number combinations for UCI,VOL syntax are mutually exclusive."
... W !,"If you select a UCI in a Volume Group greater than 0 -"
... W !,"Then you must enter the Volume Group Name or Number!"
... W !,%ZIB("DASHES")
VER .. ; Verify if UCI,VOL exists.
. Q:'%ZIB("VERIFY UCI") ; Stop if verify UCI flag set to NO.
. S %ZIB("NEW UCI")=$P($P(%ZIB("%"),","),":")
. S %ZIB("NEW VOL")=$P($P(%ZIB("%"),",",2),":")
. I %ZIB("NEW VOL")="" D
.. I %ZIB("NEW UCI")?1N.E F %=0:1:20 I $P($ZU(0),",",2)=$P($ZU(1,%),",",2) S %ZIB("NEW VOL")=% I 1 Q
.. E S %ZIB("NEW VOL")=$P($ZU(0),",",2)
. S $ZT="ZT^%ZIBZUCI" ; Set DSM error trap for <NOSYS> or <NOUCI>
. I $ZU(%ZIB("NEW UCI"),%ZIB("NEW VOL"))="" S %ZIB("ZT")=1 Q
SW . ; SWITCH TO NEW UCI
. I %ZIB("NEW UCI")?3A S %ZIB("UCI,VOL")=$ZU(%ZIB("NEW UCI"),%ZIB("NEW VOL"))
. E S %ZIB("UCI,VOL")=%ZIB("NEW UCI")_","_%ZIB("NEW VOL")
. I $ZV["DSM" V 148:$J:$V(148,$J)#256+($P(%ZIB("UCI,VOL"),",",2)*32+$P(%ZIB("UCI,VOL"),",")*256)
. E V 2:$J:$P(%ZIB("UCI,VOL"),",",2)*32+$P(%ZIB("UCI,VOL"),","):2
. W !!,*7,"You have switched to ",$ZU(0)," {",%ZIB("UCI,VOL"),"}"
. S %ZIB("ASK")=1 ; Set loop at ASK+1 to QUIT.
I %ZIB("ZT") W !!,*7,"Sorry - ",%ZIB("NEW UCI"),",",%ZIB("NEW VOL")," does not exist!",!,"** NO ACTION TAKEN**!",! G ASK
EX ; EXIT
KILL % ; Remove the call routine variable.
I ""'[$P(%ZIB("%"),":",2) D
. S %=$P(%ZIB("%"),":",2)
. I $E(%)="^" S %=$E(%,1,9)
. E I %["^"
. E S %="^"_$E(%,1,8)
KILL %ZIB ; Remove symbol table entries.
S $ZT="ZT^%ZIBZUCI" ; Set error trap for <NOPGM> or <LINER>
G:$D(%) @% ; GO TO routine if requested.
Q ; UCI switch completed
;
ZT ; Error trap for DSM.
I $ZE?1"<NOSY".E!($ZE?1"<NOUC".E) D Q
. S %ZIB("ZT")=1 ; Set for UCI,VOL does not exist.
. S %ZIB("VERIFY UCI")=0 ; Set verify UCI flag to NO.
. I $ZE?1"<NOSY".E S %ZIB("NO SYS")=1 ; Set for VOL loop to QUIT.
. E S %ZIB("NO UCI")=1 ; Set for UCI loop to QUIT.
I $ZE?1"<NOPGM".E D Q
. W *7,!!,"Routine ",$P(%,"^",2)," is not in ",$ZU(0),"'s ",$S(%["%":"Library or MGR UCI ",1:""),"routine directory!!",!
. KILL %
I $ZE?1"<LINER".E D Q
. W *7,!!,"Label ",$P(%,"^")," is missing in routine ",$P(%,"^",2),"!!",!
. KILL %
ZQ
;
%ZUCI ; IHS/ADC/GTH - SWAP UCI BETWEEN VOLUME SETS FOR MSM-UNIX ; [ 10/29/2002 7:42 AM ]
+1 ;;3.0;IHS/VA UTILITIES;**9**;FEB 07, 1997
+2 ;
+3 ; SAVE THIS ROUTINE AS %ZUCI IN THE MGR UCI
+4 ;
+5 ; This utility permits switching between UCIs and Volume
+6 ; Groups when run in programmer mode. D ^%ZUCI
+7 ;
+8 ; If switching to a UCI in a Volume Group other than the
+9 ; System Volume Group (0), you must enter either the Volume
+10 ; Group Number or Volume Group Name along with the UCI Number
+11 ; or Name. A 'help' display identifies all UCIs and Volume
+12 ; Groups that are currently mounted. Use a '?' for 'help'.
+13 ;
+14 ; A routine may be tied to the UCI,VOL switch. This routine
+15 ; will be called immediately after the UCI,VOL switch occurs.
+16 ; IHS/SET/GTH XB*3*9 10/29/2002
IF $$VERSION^%ZOSV(1)["Cache"
DO ^%CD
QUIT
+17 ;
EN ; ENTRY - Ask for [UCI,VOL]
+1 WRITE !,"SWITCH TO NEW UCI",!
+2 SET $PIECE(%ZIB("DASHES"),"-",81)=""
ASK ; Get new UCI name or number.
+1 FOR %ZIB("ASK")=0:0:0
Begin DoDot:1
+2 ; Set DSM error flag for <NOUCI> or <NOSYS>
SET %ZIB("ZT")=0
+3 ; Verify UCI flag set to NO.
SET %ZIB("VERIFY UCI")=0
+4 WRITE !,"You are now in ",$ZU(0)
+5 WRITE !!,"Enter new UCI: "
+6 ; If read timesout or a "^" or <RET> is entered then set the
+7 ; loop at ASK+1 to quit
+8 READ %ZIB("%"):45
IF '$TEST
WRITE *7,"**Timeout**",!!,"You are still in ",$ZU(0)
SET %ZIB("ASK")=1
QUIT
+9 IF "^"[%ZIB("%")
WRITE *7," No action taken!",!!,"You are still in ",$ZU(0)
SET %ZIB("ASK")=1
QUIT
+10 ; Verify UCI flag set to YES.
SET %ZIB("VERIFY UCI")=1
ED ; Edit input from user.
+1 ; Edit input.
Begin DoDot:2
+2 ; Set loop at ASK+1 to QUIT.
SET %ZIB("ASK")=1
+3 IF %ZIB("%")?3A
QUIT
+4 IF %ZIB("%")?3A1"
QUIT
+5 IF %ZIB("%")?3A1","3A
QUIT
+6 IF %ZIB("%")?3A1","3A1"
QUIT
+7 IF %ZIB("%")?2N
QUIT
+8 IF %ZIB("%")?2N1"
QUIT
+9 IF %ZIB("%")?2N1","1N
QUIT
+10 IF %ZIB("%")?2N1","1N1"
QUIT
+11 IF %ZIB("%")?1N
QUIT
+12 IF %ZIB("%")?1N1"
QUIT
+13 IF %ZIB("%")?1N1","1N
QUIT
+14 IF %ZIB("%")?1N1","1N1"
QUIT
+15 IF %ZIB("%")'["?"
Begin DoDot:3
+16 WRITE " ?? **Incorrect input**",*7
+17 WRITE !,%ZIB("DASHES")
+18 WRITE !,"Enter ""?"" to get help or"
+19 WRITE !,"Enter {UCI} {UCI:ROUTINE} {UCI,VOL} {UCI,VOL:ROUTINE}"
+20 WRITE !,%ZIB("DASHES")
End DoDot:3
+21 ; Continue the loop at ASK+1.
SET %ZIB("ASK")=0
+22 ; Set verify UCI flag to NO.
SET %ZIB("VERIFY UCI")=0
HLP ; Display UCI list.
+1 IF %ZIB("%")?1"?"
Begin DoDot:3
+2 WRITE !,%ZIB("DASHES")
+3 WRITE !,"UCIs and VOLume groups are identified by either a name or number."
+4 WRITE !,"Use the name or number identification when selecting a UCI."
+5 WRITE !!,"Enter ""??"" to get a list of UCIs and VOLume sets."
+6 WRITE !," ""???"" to get examples."
+7 WRITE !!,"Enter {UCI} {UCI,VOL} {UCI:ROUTINE} {UCI,VOL:ROUTINE}."
+8 WRITE !,%ZIB("DASHES")
End DoDot:3
+9 IF %ZIB("%")?1"??"
Begin DoDot:3
+10 WRITE !!,"Select from any UCI,VOL from this list:"
+11 ; Set no more VOLUME SETs for MSM.
SET %ZIB("NO SYS")=0
+12 FOR %ZIB("VOL NBR")=0:1
Begin DoDot:4
+13 ; Set DSM error trap for <NOSYS>.
SET $ZT="ZT^%ZIBZUCI"
+14 ; DSM gets a <NOSYS> error if end of VOLUME SETs.
IF $ZU(1,%ZIB("VOL NBR"))=""
SET %ZIB("NO SYS")=1
QUIT
+15 WRITE !,%ZIB("DASHES")
+16 WRITE !,"UCIs in Volume Group Number ",%ZIB("VOL NBR")," . . . Volume Group Name is ",$PIECE($ZU(1,%ZIB("VOL NBR")),",",2),!
+17 ; Set no more UCI flag for MSM.
SET %ZIB("NO UCI")=0
+18 FOR %ZIB("UCI NBR")=1:1
Begin DoDot:5
+19 ; Set DSM error trap for <NOUCI> error.
SET $ZT="ZT^%ZIBZUCI"
+20 ; End of UCIs for this VOLUME SET.
IF $ZU(%ZIB("UCI NBR"),(%ZIB("VOL NBR")))=""
SET %ZIB("NO UCI")=1
QUIT
+21 SET %ZIB("UCI,VOL","NAME")=$ZU(%ZIB("UCI NBR"),%ZIB("VOL NBR"))
+22 SET %ZIB("UCI,VOL","NBR")=%ZIB("UCI NBR")_","_%ZIB("VOL NBR")
+23 IF '((%ZIB("UCI NBR")-1)#3)
WRITE !
+24 WRITE "UCI ",%ZIB("UCI,VOL","NBR")," is ",%ZIB("UCI,VOL","NAME")
+25 WRITE $JUSTIFY("",25-($LENGTH(%ZIB("UCI,VOL","NBR"))+$LENGTH(%ZIB("UCI,VOL","NAME"))+8))
End DoDot:5
IF %ZIB("NO UCI")
QUIT
End DoDot:4
IF %ZIB("NO SYS")
QUIT
+26 WRITE !,%ZIB("DASHES")
End DoDot:3
EXAMP ;
+1 IF %ZIB("%")?1"???"
Begin DoDot:3
+2 WRITE !!,"Examples for switching UCIs",?53,"NAME SYNTAX",?67,"NUMBER SYNTAX"
+3 WRITE !,%ZIB("DASHES")
+4 WRITE !," Switch to DEV on default volume group (0)",?55,"DEV",?72,"3"
+5 WRITE !," Switch to DEV on the volume group AAA (1)",?55,"DEV,AAA",?72,"3,1"
+6 WRITE !,%ZIB("DASHES")
+7 WRITE !,"Examples of switching UCIs and running a routine"
+8 WRITE ?55,"DEV:%SY",?72,"3:%SY"
+9 WRITE !?55,"DEV,AAA:%SY",?72,"3,1:%SY"
+10 WRITE !?55,"DEV:P^DI",?72,"3:P^DI"
+11 WRITE !,%ZIB("DASHES")
+12 WRITE !,"NOTE: Name,Number combinations for UCI,VOL syntax are mutually exclusive."
+13 WRITE !,"If you select a UCI in a Volume Group greater than 0 -"
+14 WRITE !,"Then you must enter the Volume Group Name or Number!"
+15 WRITE !,%ZIB("DASHES")
End DoDot:3
VER ; Verify if UCI,VOL exists.
End DoDot:2
+1 ; Stop if verify UCI flag set to NO.
IF '%ZIB("VERIFY UCI")
QUIT
+2 SET %ZIB("NEW UCI")=$PIECE($PIECE(%ZIB("%"),","),":")
+3 SET %ZIB("NEW VOL")=$PIECE($PIECE(%ZIB("%"),",",2),":")
+4 IF %ZIB("NEW VOL")=""
Begin DoDot:2
+5 IF %ZIB("NEW UCI")?1N.E
FOR %=0:1:20
IF $PIECE($ZU(0),",",2)=$PIECE($ZU(1,%),",",2)
SET %ZIB("NEW VOL")=%
IF 1
QUIT
+6 IF '$TEST
SET %ZIB("NEW VOL")=$PIECE($ZU(0),",",2)
End DoDot:2
+7 ; Set DSM error trap for <NOSYS> or <NOUCI>
SET $ZT="ZT^%ZIBZUCI"
+8 IF $ZU(%ZIB("NEW UCI"),%ZIB("NEW VOL"))=""
SET %ZIB("ZT")=1
QUIT
SW ; SWITCH TO NEW UCI
+1 IF %ZIB("NEW UCI")?3A
SET %ZIB("UCI,VOL")=$ZU(%ZIB("NEW UCI"),%ZIB("NEW VOL"))
+2 IF '$TEST
SET %ZIB("UCI,VOL")=%ZIB("NEW UCI")_","_%ZIB("NEW VOL")
+3 IF $ZV["DSM"
VIEW 148:$JOB:$VIEW(148,$JOB)#256+($PIECE(%ZIB("UCI,VOL"),",",2)*32+$PIECE(%ZIB("UCI,VOL"),",")*256)
+4 IF '$TEST
VIEW 2:$JOB:$PIECE(%ZIB("UCI,VOL"),",",2)*32+$PIECE(%ZIB("UCI,VOL"),","):2
+5 WRITE !!,*7,"You have switched to ",$ZU(0)," {",%ZIB("UCI,VOL"),"}"
+6 ; Set loop at ASK+1 to QUIT.
SET %ZIB("ASK")=1
End DoDot:1
+7 IF %ZIB("ZT")
WRITE !!,*7,"Sorry - ",%ZIB("NEW UCI"),",",%ZIB("NEW VOL")," does not exist!",!,"** NO ACTION TAKEN**!",!
GOTO ASK
EX ; EXIT
+1 ; Remove the call routine variable.
KILL %
+2 IF ""'[$PIECE(%ZIB("%"),":",2)
Begin DoDot:1
+3 SET %=$PIECE(%ZIB("%"),":",2)
+4 IF $EXTRACT(%)="^"
SET %=$EXTRACT(%,1,9)
+5 IF '$TEST
IF %["^"
+6 IF '$TEST
SET %="^"_$EXTRACT(%,1,8)
End DoDot:1
+7 ; Remove symbol table entries.
KILL %ZIB
+8 ; Set error trap for <NOPGM> or <LINER>
SET $ZT="ZT^%ZIBZUCI"
+9 ; GO TO routine if requested.
IF $DATA(%)
GOTO @%
+10 ; UCI switch completed
QUIT
+11 ;
ZT ; Error trap for DSM.
+1 IF $ZE?1"<NOSY".E!($ZE?1"<NOUC".E)
Begin DoDot:1
+2 ; Set for UCI,VOL does not exist.
SET %ZIB("ZT")=1
+3 ; Set verify UCI flag to NO.
SET %ZIB("VERIFY UCI")=0
+4 ; Set for VOL loop to QUIT.
IF $ZE?1"<NOSY".E
SET %ZIB("NO SYS")=1
+5 ; Set for UCI loop to QUIT.
IF '$TEST
SET %ZIB("NO UCI")=1
End DoDot:1
QUIT
+6 IF $ZE?1"<NOPGM".E
Begin DoDot:1
+7 WRITE *7,!!,"Routine ",$PIECE(%,"^",2)," is not in ",$ZU(0),"'s ",$SELECT(%["%":"Library or MGR UCI ",1:""),"routine directory!!",!
+8 KILL %
End DoDot:1
QUIT
+9 IF $ZE?1"<LINER".E
Begin DoDot:1
+10 WRITE *7,!!,"Label ",$PIECE(%,"^")," is missing in routine ",$PIECE(%,"^",2),"!!",!
+11 KILL %
End DoDot:1
QUIT
+12
*** ERROR ***
+13 ;