Consultor Eletrônico



Kbase P19726: How to get a schema (table & field) report of connected DB's using 4GL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/01/2010
Status: Verified

GOAL:

How to get a schema (table & field) report of connected DB's using 4GL?

GOAL:

How to generate a schema report for all the currently connected databases

GOAL:

How to get the list of databases connected

FACT(s) (Environment):

All Supported Operating Systems
Progress/OpenEdge Product Family

FIX:

Save the following two 4GL procedures as PROGRAM1.P and PROGRAM1.P. Run PROGRAM1.P to generate a schema report for all the currently connected databases.

/* PROGRAM1.P */

DEF VAR x AS CHAR.
DEF VAR i AS INTEGER.

DO i = 1 TO NUM-DBS:
x = LDBNAME (i).
CREATE ALIAS "DICTDB" FOR DATABASE VALUE (x).
DISPLAY x LABEL "Database name: ".
RUN PROGRAM2.P.
END.


/* PROGRAM2.P: get all the tables/fields name */

FOR EACH dictdb._field, EACH dictdb._file
WHERE RECID (_file) = _field._fil BREAK BY (_file-name):

IF SUBSTRING (_file-name,1,1) = "_" THEN NEXT.
ELSE DO:
IF FIRST-OF (_file-name) THEN
DISPLAY _file-name FORMAT "X(20)" _field-name.
ELSE DISPLAY _field-name.
END.
END.