How to display the queries' header on top with IDS2000?
Posted in 2000
Topics: Stored Procedures & SPL, Server Administration
Hi all,
I tried IDS2000 9.20.UC3 for UW7.1.1 today.
The select output results from dbaccess is not the same as the
previous version:
For example the output of the command:
echo 'select name from sysdatabases order by name'|dbaccess
sysmaster 2> /dev/null
in 7.x:
name
sysmaster
sysutils
in IDS2000:
name sysmaster
name sysutils
Can I setup IDS2000's dbaccess to display the output as in IDS
7.x to avoid rewrite the shell scripts which were written for
7.x?
Thanks in advance for any advise.
DH.
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
DH wrote:
> I tried IDS2000 9.20.UC3 for UW7.1.1 today.
>
> The select output results from dbaccess is not the same as the
> previous version:
>
> For example the output of the command:
>
> echo 'select name from sysdatabases order by name'|dbaccess
> sysmaster 2> /dev/null
>
> in 7.x:
>
> name
>
> sysmaster
> sysutils
>
> in IDS2000:
>
> name sysmaster
>
> name sysutils
>
> Can I setup IDS2000's dbaccess to display the output as in IDS
> 7.x to avoid rewrite the shell scripts which were written for
> 7.x?
The trouble is that the maximum lengths of those names has grown,
so the display no longer automatically fits across the page.
DB-Access won't change its mind. In general, I'd advocate using
SQLCMD from the IIUG web site (http://www.iiug.org), but it doesn't
handle user-defined data types yet, so it may not be the best tool
for messing around with the 9.2x system catalog. OTOH, it is probably
better than the majority of the alternatives.
You are in for some rewriting in some shape or form. The only question
is how much.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"
DH wrote:
>
> Hi all,
>
> I tried IDS2000 9.20.UC3 for UW7.1.1 today.
>
> The select output results from dbaccess is not the same as the
> previous version:
>
> For example the output of the command:
>
> echo 'select name from sysdatabases order by name'|dbaccess
> sysmaster 2> /dev/null
>
> in 7.x:
>
> name
>
> sysmaster
> sysutils
>
> in IDS2000:
>
> name sysmaster
>
> name sysutils
>
> Can I setup IDS2000's dbaccess to display the output as in IDS
> 7.x to avoid rewrite the shell scripts which were written for
> 7.x?
Dbaccess did not change, the definition of the name column did. In
7.xx object names are limited to 18 characters in 9.2x that is lifted
to meet new ANSI requirements to 128 characters. Dbaccess always
changes to one column per line if the output is greater than 80
characters. Try this:
echo 'SELECT name(1:70) from sysdatabases order by name'|dbaccess sysmaster
2>/dev/null
Or get my listdb utility in the package utils2_ak which prints out
such a report and more (however I have not updated that to 128 byte
names either so you may have to make changes or wait for the next
release, oops).
Art S. Kagel
dbaccess's behaviour under IDS2000 is related to two things
1. IDS2000 database (and a lot of other entities) name length limitation
is now 128 bytes (AFAIK) as against 18 bytes under 7.x.
2. Dbaccess's display switches when the return columns exceed 80 chars
in length.
The best best, AFAICS, is to change your design to unload SQL results
and parse that file. e.g
echo "unload to $TMP_FILE select ...."
awk -F "|" $TMP_FILE ....
OR,
modify your code (this could lead to truncations) to
echo 'select name[1,18] from ...'
Rudy
DH wrote:
> For example the output of the command:
>
> echo 'select name from sysdatabases order by name'|dbaccess
> sysmaster 2> /dev/null
>
> in 7.x:
>
> name
>
> sysmaster
> sysutils
>
> in IDS2000:
>
> name sysmaster
>
> name sysutils
>
> Can I setup IDS2000's dbaccess to display the output as in IDS
> 7.x to avoid rewrite the shell scripts which were written for
> 7.x?
Ouch syntax alert, syntax alert!
"Art S. Kagel" wrote:
>
> DH wrote:
> >
> > Hi all,
> >
> > I tried IDS2000 9.20.UC3 for UW7.1.1 today.
> >
> > The select output results from dbaccess is not the same as the
> > previous version:
> >
> > For example the output of the command:
> >
> > echo 'select name from sysdatabases order by name'|dbaccess
> > sysmaster 2> /dev/null
> >
> > in 7.x:
> >
> > name
> >
> > sysmaster
> > sysutils
> >
> > in IDS2000:
> >
> > name sysmaster
> >
> > name sysutils
> >
> > Can I setup IDS2000's dbaccess to display the output as in IDS
> > 7.x to avoid rewrite the shell scripts which were written for
> > 7.x?
>
> Dbaccess did not change, the definition of the name column did. In
> 7.xx object names are limited to 18 characters in 9.2x that is lifted
> to meet new ANSI requirements to 128 characters. Dbaccess always
> changes to one column per line if the output is greater than 80
> characters. Try this:
>
That should be name[1,70] below. Arrgghh.
> echo 'SELECT name(1:70) from sysdatabases order by name'|dbaccess sysmaster
> 2>/dev/null
> Or get my listdb utility in the package utils2_ak which prints out
> such a report and more (however I have not updated that to 128 byte
> names either so you may have to make changes or wait for the next
> release, oops).
>
> Art S. Kagel
It requires 'order by name[1,18]' exactly to be able work under both IDS
7.x and IDS 2000.
I tried to modify another script. It requires exactly 'name[1,15]' to work
as below:
echo "set isolation to dirty read; select sysdatabases.name[1,15] database,
sysdbspaces.name[1,15] dbspace
from sysdatabases, sysdbspaces where sysdbspaces.dbsnum =
round(sysdatabases.partnum / ( 1048576),0)
order by 1" | dbaccess sysmaster 2> /dev/null | grep -Ev "^database |^$" >
${TMPFILE}
Thanks again.
DH.
"Art S. Kagel" <kagel@bloomberg.net> wrote in message
news:39883D67.261C586C@bloomberg.net...
> Ouch syntax alert, syntax alert!
>
> "Art S. Kagel" wrote:
> >
> > DH wrote:
> > >
> > > Hi all,
> > >
> > > I tried IDS2000 9.20.UC3 for UW7.1.1 today.
> > >
> > > The select output results from dbaccess is not the same as the
> > > previous version:
> > >
> > > For example the output of the command:
> > >
> > > echo 'select name from sysdatabases order by name'|dbaccess
> > > sysmaster 2> /dev/null
> > >
> > > in 7.x:
> > >
> > > name
> > >
> > > sysmaster
> > > sysutils
> > >
> > > in IDS2000:
> > >
> > > name sysmaster
> > >
> > > name sysutils
> > >
> > > Can I setup IDS2000's dbaccess to display the output as in IDS
> > > 7.x to avoid rewrite the shell scripts which were written for
> > > 7.x?
> >
> > Dbaccess did not change, the definition of the name column did. In
> > 7.xx object names are limited to 18 characters in 9.2x that is lifted
> > to meet new ANSI requirements to 128 characters. Dbaccess always
> > changes to one column per line if the output is greater than 80
> > characters. Try this:
> >
>
> That should be name[1,70] below. Arrgghh.
>
> > echo 'SELECT name(1:70) from sysdatabases order by name'|dbaccess
sysmaster
> > 2>/dev/null
>
> > Or get my listdb utility in the package utils2_ak which prints out
> > such a report and more (however I have not updated that to 128 byte
> > names either so you may have to make changes or wait for the next
> > release, oops).
> >
> > Art S. Kagel