List and count all tables

PJan8724

New Member
Hey all,

Need a little help since I don't know the progress 4GL language. Can anyone give me some code that will list out all the table with in my Progress 9.1c DB and a total count. I'm working on a new stroage are schema and I've got a VB script that is going to create my binary dump and load file but I want to make sure that all my tables are accounted for.

Thanks,

Pete J.
 

Casper

ProgressTalk.com Moderator
Staff member
Hi PJan8724,,

I think you're looking for the proutil utility:

proutil <dbname> -C tabanalys (you could also use dbanalys)

Casper.
 

ron

Member
Display all tables.

You can use this code to list all the user tables:

/* ================================= */
/* Display all Tables sorted by Area */
/* ================================= */

FOR EACH _StorageObject NO-LOCK
WHERE _StorageObject._Object-type = 1
AND _StorageObject._Area-number > 6 /* ignore system tables */
BY _StorageObject._Area-number:
FIND _Area NO-LOCK
WHERE _Area._Area-number = _StorageObject._Area-number NO-ERROR.
FIND _File NO-LOCK
WHERE _File._File-number = _StorageObject._Object-number NO-ERROR.
DISPLAY
_StorageObject._Area-number
FORMAT ">>9" COLUMN-LABEL "Area"
_Area._Area-name
FORMAT "x(15)" COLUMN-LABEL "Area!Name"
_File._File-nam WHEN AVAIL(_File)
FORMAT "x(15)" COLUMN-LABEL "Table Name".
END.


If you want the details output to a file, change it like this:

/* ================================= */
/* Display all Tables sorted by Area */
/* ================================= */

OUTPUT TO /tmp/filenames.

FOR EACH _StorageObject NO-LOCK
WHERE _StorageObject._Object-type = 1
AND _StorageObject._Area-number > 6 /* ignore system tables */
BY _StorageObject._Area-number:
FIND _Area NO-LOCK
WHERE _Area._Area-number = _StorageObject._Area-number NO-ERROR.
FIND _File NO-LOCK
WHERE _File._File-number = _StorageObject._Object-number NO-ERROR.
DISPLAY
_StorageObject._Area-number
FORMAT ">>9" COLUMN-LABEL "Area"
_Area._Area-name
FORMAT "x(15)" COLUMN-LABEL "Area!Name"
_File._File-nam WHEN AVAIL(_File)
FORMAT "x(15)" COLUMN-LABEL "Table Name".
END.


This code does not show numbers of records. If you want all the table names plus record counts you are better-off using the _proutil utility to produce a table analysis report -- it runs faster than if you do it yourself.

I can give you a program that compares two tabanalys reports that have been written to disc (one before a reorg or dump/load -- and the other after).

Hope that helps,
Ron.
 
Top