Hi Steven!
Thanks for your reply! As suggested by Martin adding the -tab switch to the
dsmadmc does the trick as well as adding the varchar_format function:
SELECT varchar_format(CAST(round(float(used_space_mb/total_space_mb*100)) AS
int)) FROM log
Kind regards,
Eric van Loon
Air France/KLM Storage Engineering
-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Harris, Steven
Sent: donderdag 26 januari 2017 22:52
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: How to prevent leading spaces in SQL output
Hi Eric
There are also the STRIP and TRIM sql functions - same function for these but
slightly different syntax.
SELECT strip(cast(float(used_space_mb)*100/total_space_mb AS DECIMAL(4,2)))
FROM log
However, when I tested this on a number less than 1, the implicit cast of the
number to a string lost the leading zero. That may or may not suit your use
case.
Regards
Steve
Steven Harris
TSM Consultant
Canberra, Australia
-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Loon, Eric van (ITOPT3) - KLM
Sent: Wednesday, 25 January 2017 11:53 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: [ADSM-L] How to prevent leading spaces in SQL output
Hi Martin!
Again, thank you very much for your help!
Kind regards,
Eric van Loon
Air France/KLM Storage Engineering
-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Martin Janosik
Sent: woensdag 25 januari 2017 11:04
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: How to prevent leading spaces in SQL output
Hi Eric,
'-tab' does the magic:
[~]$ dsmadmc -tab -se=TSM -id=admin -pa=admin -dataonly=yes "SELECT CAST
(float(used_space_mb)*100/total_space_mb AS DECIMAL(4,2)) FROM log"
0.98
[~]$ dsmadmc -se=TSM -id=admin -pa=admin -dataonly=yes "SELECT CAST(float
(used_space_mb)*100/total_space_mb AS DECIMAL(4,2)) FROM log"
0.98
Bye
Martin Janosik
"ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU> wrote on 01/25/2017
10:01:51 AM:
> From: "Loon, Eric van (ITOPT3) - KLM" <Eric-van.Loon AT KLM DOT COM>
> To: ADSM-L AT VM.MARIST DOT EDU
> Date: 01/25/2017 10:06 AM
> Subject: [ADSM-L] How to prevent leading spaces in SQL output Sent by:
> "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
>
> Hi TSM-ers!
> I'm executing the following command in a script:
>
> /usr/bin/dsmadmc -se=$INSTANCE -id=$ID -password=$PASSWORD -
> dataonly=yes "SELECT CAST(float(used_space_mb)*100/total_space_mb AS
> DECIMAL(4,2)) FROM log"
>
> The result is this (without quotes):
>
> ' 0.49'
>
> I'm looking for a way to remove the leading spaces, so the output is
> just '0.49'. I know I can do it in the script itself, but I'm just
> wondering if there is a way to remove all formatting through the SQL
> statement itself.
> Thanks for any help in advance!
> Kind regards,
> Eric van Loon
> Air France/KLM Storage Engineering
>
> ********************************************************
> For information, services and offers, please visit our web site:
> http://www.klm.com. This e-mail and any attachment may contain
> confidential and privileged material intended for the addressee only.
> If you are not the addressee, you are notified that no part of the
> e-mail or any attachment may be disclosed, copied or distributed, and
> that any other action related to this e-mail or attachment is strictly
> prohibited, and may be unlawful. If you have received this e-mail by
> error, please notify the sender immediately by return e-mail, and
> delete this message.
>
> Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/ or
> its employees shall not be liable for the incorrect or incomplete
> transmission of this e-mail or any attachments, nor responsible for
> any delay in receipt.
> Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal
> Dutch Airlines) is registered in Amstelveen, The Netherlands, with
> registered number 33014286
> ********************************************************
>
********************************************************
For information, services and offers, please visit our web site:
http://www.klm.com. This e-mail and any attachment may contain confidential and
privileged material intended for the addressee only. If you are not the
addressee, you are notified that no part of the e-mail or any attachment may be
disclosed, copied or distributed, and that any other action related to this
e-mail or attachment is strictly prohibited, and may be unlawful. If you have
received this e-mail by error, please notify the sender immediately by return
e-mail, and delete this message.
Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its
employees shall not be liable for the incorrect or incomplete transmission of
this e-mail or any attachments, nor responsible for any delay in receipt.
Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch
Airlines) is registered in Amstelveen, The Netherlands, with registered number
33014286
********************************************************
This message and any attachment is confidential and may be privileged or
otherwise protected from disclosure. You should immediately delete the message
if you are not the intended recipient. If you have received this email by
mistake please delete it from your system; you should not copy the message or
disclose its content to anyone.
This electronic communication may contain general financial product advice but
should not be relied upon or construed as a recommendation of any financial
product. The information has been prepared without taking into account your
objectives, financial situation or needs. You should consider the Product
Disclosure Statement relating to the financial product and consult your
financial adviser before making a decision about whether to acquire, hold or
dispose of a financial product.
For further details on the financial product please go to http://www.bt.com.au
Past performance is not a reliable indicator of future performance.
********************************************************
For information, services and offers, please visit our web site:
http://www.klm.com. This e-mail and any attachment may contain confidential and
privileged material intended for the addressee only. If you are not the
addressee, you are notified that no part of the e-mail or any attachment may be
disclosed, copied or distributed, and that any other action related to this
e-mail or attachment is strictly prohibited, and may be unlawful. If you have
received this e-mail by error, please notify the sender immediately by return
e-mail, and delete this message.
Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its
employees shall not be liable for the incorrect or incomplete transmission of
this e-mail or any attachments, nor responsible for any delay in receipt.
Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch
Airlines) is registered in Amstelveen, The Netherlands, with registered number
33014286
********************************************************
|