ADSM-L

Re: Redirecting select statement output from a script

2005-06-02 10:12:30
Subject: Re: Redirecting select statement output from a script
From: Andrew Raibeck <storman AT US.IBM DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Thu, 2 Jun 2005 07:11:57 -0700
I don't think that redirection is supported during the execution of a
script, which is why Matthew's original error occurred.

Yes, the issues regarding redirection from within the Admin CLI are that
it is not easy to distinguish when '>' is for redirection versus "greater
than". When redirecting from the Admin CLI, you need one or more spaces
before and after the '>'. Using a trivial example:

INCORRECT:
   select node_name from nodes>sel.out
   select node_name from nodes >sel.out
   select node_name from nodes> sel.out

CORRECT:
   select node_name from nodes > sel.out

You need to be careful when mixing "greater than" with redirection:

INCORRECT:
   select node_name from nodes where client_version > 3 > sel.out

CORRECT:
   select node_name from nodes where client_version>3 > sel.out
   select node_name from nodes where client_version >3 > sel.out
   select node_name from nodes where client_version> 3 > sel.out

When you intend to use '>' to mean "greater than" while running in batch
mode, i.e.:

   dsmadmc -id=blah -pa=blech <select statement>

then you might run into operating system command line interpreter issues,
where the interpreter wants to always view the '>' as redirection. In this
case, put quotes around the entire statement:

   dsmadmc -id=blah -pa=blech "select node_name from nodes where
client_version>3"

And to redirect to a file:

   dsmadmc -id=blah -pa=blech "select node_name from nodes where
client_version>3" > sel.out

Regards,

Andy

Andy Raibeck
IBM Software Group
Tivoli Storage Manager Client Development
Internal Notes e-mail: Andrew Raibeck/Tucson/IBM@IBMUS
Internet e-mail: storman AT us.ibm DOT com

The only dumb question is the one that goes unasked.
The command line is your friend.
"Good enough" is the enemy of excellence.

"ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU> wrote on 2005-06-02
06:28:39:

> Hi Matthew
>
>
> I notice you have a space after the '>'.  I remember a discussion on how
> the
> '> redirect' gets confused with '> greater than'  and the (rather vague)
> solution
> was to interpret the space after the '>' as an indicator that this was a
>
> greater than, and not a redirect... hence the illegal sql operator
> message.
>
> Try dropping the space.. maybe.
>
>
> Someone who recognises this 'feature' could possibly correct me on its
> actual
> usage.
>
>
> Regards,
>
> David le Blanc
>
> --
> Senior Technical Specialist
> I d e n t i t y   S o l u t i o n s
>
> Level 1, 369 Camberwell Road, Melbourne, Vic 3124
> Ph 03 9813 1388 Fax 03 9813 1688 Mobile 0417 595 550
> Email david.leblanc AT identity-solutions.com DOT au
>
> -----Original Message-----
> From: Matthew Large [mailto:Matthew.Large AT AVIVA DOT COM]
> Sent: Thursday, 2 June 2005 9:21 PM
> To: ADSM-L AT VM.MARIST DOT EDU
> Subject: [ADSM-L] Redirecting select statement output from a script
>
> Hi chaps/chappesses,
>
> I've had a look in the archives, and there doesn't seem to be an
> immediate solution to this one, so please help!
> I'm trying to redirect the output of a script containing select
> statements to a file in the file system. I can see that the redirect
> works from the command line but from within scripts I just get errors.
>
> tsm: TSML003A>run large_monitor
> ANR2907E Unexpected SQL operator token - '>'.
>
>                                                            |
>          ..................................................V............
>          from occupancy where stgpool_name='APPS_DISKPOOL' > stgdisk.txt
>
> ANR2907E Unexpected SQL operator token - '>'.
>
> I've also tried with double right-angled bracket, without success.
> The Quickfacts state there is no escape character to render it
> 'unspecial', but that was written a while ago, perhaps there is now a
> way?
>
>
> Thanks
> Matthew
>
>
>
>
> Aviva plc
> Registered Office: St. Helen's, 1 Undershaft, London EC3P 3DQ Registered
> in England Number 02468686 www.aviva.com
>
> This message and any attachments are confidential.
> If you are not the intended recipient, please telephone or e-mail the
> sender and delete this message and any attachment from your system.
> Also, if you are not the intended recipient you must not copy this
> message or attachment or disclose the contents to any other person.