Greetings Oh Gurus of TSMness,
I have a question with quotes in a script I am trying to define.
This works:
tsm: TSMES>define script tapeuse "select v2.stgpool_name, count(*) as
Vols_Used, (select s1.maxscratch from stgpools s1 where s1.devclass='3590K'
and s1.stgpool_name=v2.stgpool_name) as MaxScratch from volumes v2 where
v2.devclass_name='3590K' group by v2.stgpool_name" descr='Tape pool
utilization'
ANR1454I DEFINE SCRIPT: Command script TAPEUSE defined.
tsm: TSMES>run tapeuse
STGPOOL_NAME VOLS_USED MAXSCRATCH
------------------ ----------- -----------
AR_LONG_OFF 1 40
AR_LONG_TAPE 3 40
AR_SHORT_OFF 34 50
AR_SHORT_TAPE 37 50
BACKUP_OFF 148 150
BACKUP_TAPE 211 225
STATIC_OFF 8 40
STATIC_TAPE 33 40
ANR1462I RUN: Command script TAPEUSE completed successfully.
</quote>
But Vols_Used and MaxScratch come out upper case.
This works and preserves the case:
tkxh05a@ibm41:/home/tkxh05a> dsmadmc -id=my -pass=mypass select
"v2.stgpool_name, count(*) as \"Vols Used\", (select s1.maxscratch from
stgpools s1 where s1.devclass='3590K' and s1.stgpool_name=v2.stgpool_name)
as \"MaxScratch\" from volumes v2 where v2.devclass_name='3590K' group by
v2.stgpool_name"
Tivoli Storage Manager
Command Line Administrative Interface - Version 4, Release 2, Level 2.1
(C) Copyright IBM Corporation, 1990, 2001, All Rights Reserved.
Session established with server TSMES: AIX-RS/6000
Server Version 4, Release 2, Level 2.5
Server date/time: 11/08/02 12:20:55 Last access: 11/08/02 12:18:28
ANS8000I Server command: 'select v2.stgpool_name, count(*) as "Vols Used" ,
(select s1.maxscratch from stgpools s1 where s1.devclass
='3590K' and s1.stgpool_name=v2.stgpool_name) as "MaxScratch" from volumes
v2 where v2.devclass_name='3590K' group by v2.stgpool_name'
STGPOOL_NAME Vols Used MaxScratch
------------------ ----------- -----------
AR_LONG_OFF 1 40
AR_LONG_TAPE 3 40
AR_SHORT_OFF 34 50
AR_SHORT_TAPE 37 50
BACKUP_OFF 149 150
BACKUP_TAPE 211 225
STATIC_OFF 8 40
STATIC_TAPE 33 40
ANS8002I Highest return code was 0.
tkxh05a@ibm41:/home/tkxh05a>
</quote>
But I have to run it from a unix command line. Fortunately I can pull it
from my history, but I can't share it easily.
This acts like it is going to work, but when I try to run it, it fails:
tkxh05a@ibm41:/home/tkxh05a> dsmadmc -id=me -pass=mypass define script
tapeuse "\"select v2.stgpool_name, count(*) as 'Vols Used', (select
s1.maxscratch from stgpools s1 where s1.devclass='3590K' and
s1.stgpool_name=v2.stgpool_name) as 'MaxScratch' from volumes v2 where
v2.devclass_name='3590K' group by v2.stgpool_name\" descr='Show tape pool
usage'"
Tivoli Storage Manager
Command Line Administrative Interface - Version 4, Release 2, Level 2.1
(C) Copyright IBM Corporation, 1990, 2001, All Rights Reserved.
Session established with server TSMES: AIX-RS/6000
Server Version 4, Release 2, Level 2.5
Server date/time: 11/08/02 12:27:50 Last access: 11/08/02 12:18:28
ANS8000I Server command: 'define script tapeuse "select v2.stgpool_name,
count(*) as 'Vols Used', (select s1.maxscratch from stgpool
s s1 where s1.devclass='3590K' and s1.stgpool_name=v2.stgpool_name) as
'MaxScratch' from volumes v2 where v2.devclass_name='3590K' g
roup by v2.stgpool_name" descr='Show tape pool usage''
ANR1454I DEFINE SCRIPT: Command script TAPEUSE defined.
ANS8002I Highest return code was 0.
tkxh05a@ibm41:/home/tkxh05a> dsmadmc -id=me -pass=mypass run tapeuse
Tivoli Storage Manager
Command Line Administrative Interface - Version 4, Release 2, Level 2.1
(C) Copyright IBM Corporation, 1990, 2001, All Rights Reserved.
Session established with server TSMES: AIX-RS/6000
Server Version 4, Release 2, Level 2.5
Server date/time: 11/08/02 12:30:13 Last access: 11/08/02 12:18:28
ANS8000I Server command: 'run tapeuse'
ANR2906E Unexpected SQL literal token - 'Vols Used'.
|
....................................V..........................
select v2.stgpool_name, count(*) as 'Vols Used', (select s1.max
ANR1463E RUN: Command script TAPEUSE completed in error.
ANS8001I Return code 4.
ANS8002I Highest return code was 4.
tkxh05a@ibm41:/home/tkxh05a>
</quote>
Trying to type the same thing inside dsmadmc fails in the same way:
tsm: TSMES>define script tapeuse "select v2.stgpool_name, count(*) as 'Vols
Used', (select s1.maxscratch from stgpools s1 where s1
.devclass='3590K' and s1.stgpool_name=v2.stgpool_name) as
'MaxScratch' from volumes v2 where v2.devclass_name='3590K' gro
up by v2.stgpool_name" descr='Show tape pool usage'
ANR1454I DEFINE SCRIPT: Command script TAPEUSE defined.
tsm: TSMES>run tapeuse
ANR2906E Unexpected SQL literal token - 'Vols Used'.
|
.....................................V.........................
select v2.stgpool_name, count(*) as 'Vols Used', (select s1.ma
ANR1463E RUN: Command script TAPEUSE completed in error.
ANS8001I Return code 4.
</quote>
If I try to backslash double quotes it fails entirely:
tsm: TSMES>define script tapeuse "select v2.stgpool_name, count(*) as \"Vols
Used\", (select s1.maxscratch from stgpols s1 where s1.
devclass='3590K' and s1.stgpool_name=v2.stgpool_name) as
\"MaxScratch\" from volumes v2 where v2.devclass_name='3590K' gr
oup by v2.stgpool_name" descr='Show tape pool usage'
ANR2023E DEFINE SCRIPT: Extraneous parameter - Vols.
ANS8001I Return code 3.
</quote>
I tried pulling it into a macro hoping to avoid some of the quoting issues
but that didn't help much either:
tkxh05a@ibm41:/home/tkxh05a> cat t
define script tapeuse "select v2.stgpool_name, count(*) as \"Vols Used\",
(select s1.maxscratch from stgpools s1 where s1.devclass='
3590K' and s1.stgpool_name=v2.stgpool_name) as \"MaxScratch\" from volumes
v2 where v2.devclass_name='3590K' group by v2.stgpool_nam
e" descr='Tape pool utilization'
tkxh05a@ibm41:/home/tkxh05a> dsmadmc -id=me -pass=mypass macro t
Tivoli Storage Manager
Command Line Administrative Interface - Version 4, Release 2, Level 2.1
(C) Copyright IBM Corporation, 1990, 2001, All Rights Reserved.
Session established with server TSMES: AIX-RS/6000
Server Version 4, Release 2, Level 2.5
Server date/time: 11/08/02 12:41:48 Last access: 11/08/02 12:30:13
ANS8000I Server command: 'define script tapeuse "select v2.stgpool_name,
count(*) as \"Vols Used\", (select s1.maxscratch from stgpo
ols s1 where s1.devclass='3590K' and s1.stgpool_name=v2.stgpool_name) as
\"MaxScratch\" from volumes v2 where v2.devclass_name='3590
K' group by v2.stgpool_name" descr='Tape pool utilization''
ANS8001I Return code 3.
ANS8029E Macro processing terminated.
ANS8002I Highest return code was 3.
</quote>
But at least it was easier to edit to get rid of the label quotes entirely
so that I could define the uppercased version.
OS is AIX 4.3.3
Server Version is 4.2.2.5
Client version is 4.2.2.1
Any suggestions on how I can define a script and keep the case?
Thanks,
Kai.
|