| 1 | %ZUCI   ; IHS/ADC/GTH - SWAP UCI BETWEEN VOLUME SETS FOR MSM-UNIX ; [ 10/29/2002   7:42 AM ] | 
|---|
| 2 | ;;4.0;XB;;Jul 20, 2009;Build 2 | 
|---|
| 3 | ; | 
|---|
| 4 | ; SAVE THIS ROUTINE AS %ZUCI IN THE MGR UCI | 
|---|
| 5 | ; | 
|---|
| 6 | ; This utility permits switching between UCIs and Volume | 
|---|
| 7 | ; Groups when run in programmer mode.  D ^%ZUCI | 
|---|
| 8 | ; | 
|---|
| 9 | ; If switching to a UCI in a Volume Group other than the | 
|---|
| 10 | ; System Volume Group (0), you must enter either the Volume | 
|---|
| 11 | ; Group Number or Volume Group Name along with the UCI Number | 
|---|
| 12 | ; or Name.  A 'help' display identifies all UCIs and Volume | 
|---|
| 13 | ; Groups that are currently mounted.  Use a '?' for 'help'. | 
|---|
| 14 | ; | 
|---|
| 15 | ; A routine may be tied to the UCI,VOL switch.  This routine | 
|---|
| 16 | ; will be called immediately after the UCI,VOL switch occurs. | 
|---|
| 17 | I $$VERSION^%ZOSV(1)["Cache" D ^%CD Q  ; IHS/SET/GTH XB*3*9 10/29/2002 | 
|---|
| 18 | ; | 
|---|
| 19 | EN      ; ENTRY - Ask for [UCI,VOL] | 
|---|
| 20 | W !,"SWITCH TO NEW UCI",! | 
|---|
| 21 | S $P(%ZIB("DASHES"),"-",81)="" | 
|---|
| 22 | ASK     ; Get new UCI name or number. | 
|---|
| 23 | F %ZIB("ASK")=0:0:0 D | 
|---|
| 24 | . S %ZIB("ZT")=0 ; Set DSM error flag for <NOUCI> or <NOSYS> | 
|---|
| 25 | . S %ZIB("VERIFY UCI")=0 ; Verify UCI flag set to NO. | 
|---|
| 26 | . W !,"You are now in ",$ZU(0) | 
|---|
| 27 | . W !!,"Enter new UCI: " | 
|---|
| 28 | . ; If read timesout or a "^" or <RET> is entered then set the | 
|---|
| 29 | . ; loop at ASK+1 to quit | 
|---|
| 30 | . R %ZIB("%"):45 E  W *7,"**Timeout**",!!,"You are still in ",$ZU(0) S %ZIB("ASK")=1 Q | 
|---|
| 31 | . I "^"[%ZIB("%") W *7,"  No action taken!",!!,"You are still in ",$ZU(0) S %ZIB("ASK")=1 Q | 
|---|
| 32 | . S %ZIB("VERIFY UCI")=1 ; Verify UCI flag set to YES. | 
|---|
| 33 | ED      . ; Edit input from user. | 
|---|
| 34 | . D  ; Edit input. | 
|---|
| 35 | .. S %ZIB("ASK")=1 ; Set loop at ASK+1 to QUIT. | 
|---|
| 36 | .. Q:%ZIB("%")?3A | 
|---|
| 37 | .. Q:%ZIB("%")?3A1":"1.17E | 
|---|
| 38 | .. Q:%ZIB("%")?3A1","3A | 
|---|
| 39 | .. Q:%ZIB("%")?3A1","3A1":"1.17E | 
|---|
| 40 | .. Q:%ZIB("%")?2N | 
|---|
| 41 | .. Q:%ZIB("%")?2N1":"1.17E | 
|---|
| 42 | .. Q:%ZIB("%")?2N1","1N | 
|---|
| 43 | .. Q:%ZIB("%")?2N1","1N1":"1.17E | 
|---|
| 44 | .. Q:%ZIB("%")?1N | 
|---|
| 45 | .. Q:%ZIB("%")?1N1":"1.17E | 
|---|
| 46 | .. Q:%ZIB("%")?1N1","1N | 
|---|
| 47 | .. Q:%ZIB("%")?1N1","1N1":"1.17E | 
|---|
| 48 | .. I %ZIB("%")'["?" D | 
|---|
| 49 | ... W "  ??   **Incorrect input**",*7 | 
|---|
| 50 | ... W !,%ZIB("DASHES") | 
|---|
| 51 | ... W !,"Enter ""?"" to get help or" | 
|---|
| 52 | ... W !,"Enter {UCI} {UCI:ROUTINE} {UCI,VOL} {UCI,VOL:ROUTINE}" | 
|---|
| 53 | ... W !,%ZIB("DASHES") | 
|---|
| 54 | .. S %ZIB("ASK")=0 ; Continue the loop at ASK+1. | 
|---|
| 55 | .. S %ZIB("VERIFY UCI")=0 ; Set verify UCI flag to NO. | 
|---|
| 56 | HLP     .. ; Display UCI list. | 
|---|
| 57 | .. I %ZIB("%")?1"?" D | 
|---|
| 58 | ... W !,%ZIB("DASHES") | 
|---|
| 59 | ... W !,"UCIs and VOLume groups are identified by either a name or number." | 
|---|
| 60 | ... W !,"Use the name or number identification when selecting a UCI." | 
|---|
| 61 | ... W !!,"Enter ""??"" to get a list of UCIs and VOLume sets." | 
|---|
| 62 | ... W !,"      ""???"" to get examples." | 
|---|
| 63 | ... W !!,"Enter {UCI} {UCI,VOL} {UCI:ROUTINE} {UCI,VOL:ROUTINE}." | 
|---|
| 64 | ... W !,%ZIB("DASHES") | 
|---|
| 65 | .. I %ZIB("%")?1"??" D | 
|---|
| 66 | ... W !!,"Select from any UCI,VOL from this list:" | 
|---|
| 67 | ... S %ZIB("NO SYS")=0 ; Set no more VOLUME SETs for MSM. | 
|---|
| 68 | ... F %ZIB("VOL NBR")=0:1 D  Q:%ZIB("NO SYS") | 
|---|
| 69 | .... S $ZT="ZT^%ZIBZUCI" ; Set DSM error trap for <NOSYS>. | 
|---|
| 70 | .... I $ZU(1,%ZIB("VOL NBR"))="" S %ZIB("NO SYS")=1 Q  ; DSM gets a <NOSYS> error if end of VOLUME SETs. | 
|---|
| 71 | .... W !,%ZIB("DASHES") | 
|---|
| 72 | .... W !,"UCIs in Volume Group Number ",%ZIB("VOL NBR")," . . . Volume Group Name is ",$P($ZU(1,%ZIB("VOL NBR")),",",2),! | 
|---|
| 73 | .... S %ZIB("NO UCI")=0 ; Set no more UCI flag for MSM. | 
|---|
| 74 | .... F %ZIB("UCI NBR")=1:1 D  Q:%ZIB("NO UCI") | 
|---|
| 75 | ..... S $ZT="ZT^%ZIBZUCI" ; Set DSM error trap for <NOUCI> error. | 
|---|
| 76 | ..... I $ZU(%ZIB("UCI NBR"),(%ZIB("VOL NBR")))="" S %ZIB("NO UCI")=1 Q  ; End of UCIs for this VOLUME SET. | 
|---|
| 77 | ..... S %ZIB("UCI,VOL","NAME")=$ZU(%ZIB("UCI NBR"),%ZIB("VOL NBR")) | 
|---|
| 78 | ..... S %ZIB("UCI,VOL","NBR")=%ZIB("UCI NBR")_","_%ZIB("VOL NBR") | 
|---|
| 79 | ..... W:'((%ZIB("UCI NBR")-1)#3) ! | 
|---|
| 80 | ..... W "UCI ",%ZIB("UCI,VOL","NBR")," is ",%ZIB("UCI,VOL","NAME") | 
|---|
| 81 | ..... W $J("",25-($L(%ZIB("UCI,VOL","NBR"))+$L(%ZIB("UCI,VOL","NAME"))+8)) | 
|---|
| 82 | ... W !,%ZIB("DASHES") | 
|---|
| 83 | EXAMP   .. ; | 
|---|
| 84 | .. I %ZIB("%")?1"???" D | 
|---|
| 85 | ... W !!,"Examples for switching UCIs",?53,"NAME SYNTAX",?67,"NUMBER SYNTAX" | 
|---|
| 86 | ... W !,%ZIB("DASHES") | 
|---|
| 87 | ... W !," Switch to DEV on default volume group (0)",?55,"DEV",?72,"3" | 
|---|
| 88 | ... W !," Switch to DEV on the volume group AAA (1)",?55,"DEV,AAA",?72,"3,1" | 
|---|
| 89 | ... W !,%ZIB("DASHES") | 
|---|
| 90 | ... W !,"Examples of switching UCIs and running a routine" | 
|---|
| 91 | ... W ?55,"DEV:%SY",?72,"3:%SY" | 
|---|
| 92 | ... W !?55,"DEV,AAA:%SY",?72,"3,1:%SY" | 
|---|
| 93 | ... W !?55,"DEV:P^DI",?72,"3:P^DI" | 
|---|
| 94 | ... W !,%ZIB("DASHES") | 
|---|
| 95 | ... W !,"NOTE: Name,Number combinations for UCI,VOL syntax are mutually exclusive." | 
|---|
| 96 | ... W !,"If you select a UCI in a Volume Group greater than 0 -" | 
|---|
| 97 | ... W !,"Then you must enter the Volume Group Name or Number!" | 
|---|
| 98 | ... W !,%ZIB("DASHES") | 
|---|
| 99 | VER     .. ; Verify if UCI,VOL exists. | 
|---|
| 100 | . Q:'%ZIB("VERIFY UCI")  ; Stop if verify UCI flag set to NO. | 
|---|
| 101 | . S %ZIB("NEW UCI")=$P($P(%ZIB("%"),","),":") | 
|---|
| 102 | . S %ZIB("NEW VOL")=$P($P(%ZIB("%"),",",2),":") | 
|---|
| 103 | . I %ZIB("NEW VOL")="" D | 
|---|
| 104 | .. 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 | 
|---|
| 105 | .. E  S %ZIB("NEW VOL")=$P($ZU(0),",",2) | 
|---|
| 106 | . S $ZT="ZT^%ZIBZUCI" ; Set DSM error trap for <NOSYS> or <NOUCI> | 
|---|
| 107 | . I $ZU(%ZIB("NEW UCI"),%ZIB("NEW VOL"))="" S %ZIB("ZT")=1 Q | 
|---|
| 108 | SW      . ; SWITCH TO NEW UCI | 
|---|
| 109 | . I %ZIB("NEW UCI")?3A S %ZIB("UCI,VOL")=$ZU(%ZIB("NEW UCI"),%ZIB("NEW VOL")) | 
|---|
| 110 | . E  S %ZIB("UCI,VOL")=%ZIB("NEW UCI")_","_%ZIB("NEW VOL") | 
|---|
| 111 | . I $ZV["DSM" V 148:$J:$V(148,$J)#256+($P(%ZIB("UCI,VOL"),",",2)*32+$P(%ZIB("UCI,VOL"),",")*256) | 
|---|
| 112 | . E  V 2:$J:$P(%ZIB("UCI,VOL"),",",2)*32+$P(%ZIB("UCI,VOL"),","):2 | 
|---|
| 113 | . W !!,*7,"You have switched to ",$ZU(0),"  {",%ZIB("UCI,VOL"),"}" | 
|---|
| 114 | . S %ZIB("ASK")=1 ; Set loop at ASK+1 to QUIT. | 
|---|
| 115 | I %ZIB("ZT") W !!,*7,"Sorry - ",%ZIB("NEW UCI"),",",%ZIB("NEW VOL")," does not exist!",!,"** NO ACTION TAKEN**!",! G ASK | 
|---|
| 116 | EX      ; EXIT | 
|---|
| 117 | KILL % ; Remove the call routine variable. | 
|---|
| 118 | I ""'[$P(%ZIB("%"),":",2) D | 
|---|
| 119 | . S %=$P(%ZIB("%"),":",2) | 
|---|
| 120 | . I $E(%)="^" S %=$E(%,1,9) | 
|---|
| 121 | . E  I %["^" | 
|---|
| 122 | . E  S %="^"_$E(%,1,8) | 
|---|
| 123 | KILL %ZIB ; Remove symbol table entries. | 
|---|
| 124 | S $ZT="ZT^%ZIBZUCI" ; Set error trap for <NOPGM> or <LINER> | 
|---|
| 125 | G:$D(%) @% ; GO TO routine if requested. | 
|---|
| 126 | Q  ; UCI switch completed | 
|---|
| 127 | ; | 
|---|
| 128 | ZT      ; Error trap for DSM. | 
|---|
| 129 | I $ZE?1"<NOSY".E!($ZE?1"<NOUC".E) D  Q | 
|---|
| 130 | . S %ZIB("ZT")=1 ; Set for UCI,VOL does not exist. | 
|---|
| 131 | . S %ZIB("VERIFY UCI")=0 ; Set verify UCI flag to NO. | 
|---|
| 132 | . I $ZE?1"<NOSY".E S %ZIB("NO SYS")=1 ; Set for VOL loop to QUIT. | 
|---|
| 133 | . E  S %ZIB("NO UCI")=1 ; Set for UCI loop to QUIT. | 
|---|
| 134 | I $ZE?1"<NOPGM".E D  Q | 
|---|
| 135 | . W *7,!!,"Routine ",$P(%,"^",2)," is not in ",$ZU(0),"'s ",$S(%["%":"Library or MGR UCI ",1:""),"routine directory!!",! | 
|---|
| 136 | . KILL % | 
|---|
| 137 | I $ZE?1"<LINER".E D  Q | 
|---|
| 138 | . W *7,!!,"Label ",$P(%,"^")," is missing in routine ",$P(%,"^",2),"!!",! | 
|---|
| 139 | . KILL % | 
|---|
| 140 | ZQ | 
|---|
| 141 | ; | 
|---|