Convert Table Numbers to Table Names

All of the tbstat outputs refer to tables by tb1num, which is a hex number. In true, user-friendly fashion, OnLine uses an integer number to identify the tables in the systables system table. To convert between the two, you need to use the following SQL conversion:

SELECT tabname, hex(partnum) FROM systables;

This will give you a list of table names and tblnums (as used in tbstat) for all of your tables. The OnLine manual recommends that you keep a hard copy of this list available to use for debugging.

A somewhat better approach is to create the following script, table in your $INFORMIXLOCALBIN directory:

joe 67> cat table
#!/bin/csh
set search = $2
set SEARCH = 'echo $2 | tr "[a-f]" "[A-F]" '
$INFORMIXDIR/bin/isql $1 << EOF
OUTPUT TO PIPE cat WITHOUT HEADINGS SELECT "$1" as database,tabname , hex(partnum) as tablenumber
from systables WHERE hex(partnum) MATCHES "*$SEARCH*" or tabnarae MATCHES "*$search*";
EOF

The table program is invoked as :

table database_name tblnum_fragraent
table database_name table_name_fragment
table database_name

The tb1num as used in the tbstat outputs is a seven-digit hex number, and it's sometimes possible to make an error in entering it. That's why the table script does a MATCH and not an equals. If you see a tblnum of 30002le, you can just enter the fragment 21e and you'll get a listing of all matching tables. You can also enter either the complete table name or a fragment of the name and receive all matching table names and their tblnum equivalent IDs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.162.87