Consultor Eletrônico



Kbase P167753: 4GL/ABL: How to generate a report of the connected database data table names, data tables numbers, d
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/06/2010
Status: Unverified

GOAL:

4GL/ABL: How to generate a report of the connected database data table names, data tables numbers, data field names and data field SQL widths?

GOAL:

How to obtain the data table number required by dbtool when running dbtool against a specific set of tables using 4GL/ABL?

GOAL:

How to programmatically access the SQL Widths of all data fields of the data tables of a specific database when multiple databases are connected?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x

FIX:

The following 4GL/ABL procedure generates a report that lists all the data table names, data tables numbers, data field names and data field SQL widths of a specific named. The code works the same whether one or more databases are connected to the 4GL/ABL client. The data table names and data table numbers provide the information needed to run the dbtool against individual data tables. The SQL width information help diagnose SQL width related errors generated when trying to insert or update data with more information that the existing SQL width allows:

OUTPUT TO "TableNumberAndFieldSqlWidthReport.txt".
PUT UNFORMATTED
FILL("=", 70) SKIP.
FOR EACH mydbname._File NO-LOCK WHERE mydbname._File._Tbl-Type = "T" AND mydbname._File._Owner = "PUB" BREAK BY mydbname._File._File-Name :
IF FIRST-OF(mydbname._File._File-Name) THEN DO:
PUT UNFORMATTED
"Table Name" AT 1
"Table Number" AT 20
"Field Name" AT 36
"Max SQL Width" AT 57 SKIP.
PUT UNFORMATTED
FILL("=", 70) SKIP.
PUT UNFORMATTED
mydbname._File._File-Name AT 1
mydbname._File._File-Number AT 26.
END.
ELSE
PUT UNFORMATTED
mydbname._File._File-Name AT 1
mydbname._File._File-Number AT 26 SKIP.

FOR EACH mydbname._Field NO-LOCK OF mydbname._File BREAK BY mydbname._Field._Field-Name :
IF LAST(mydbname._Field._Field-Name) THEN DO:
PUT UNFORMATTED
mydbname._Field._Field-Name AT 36
mydbname._Field._Width AT 62 SKIP.
PUT UNFORMATTED
FILL("=", 70) SKIP.
END.
ELSE
PUT UNFORMATTED
mydbname._Field._Field-Name AT 36
mydbname._Field._Width AT 62 SKIP.
END.
END.