Re: Schema Printing Help
Posted in 1997
------ =_NextPart_000_01BC199C.C355BD60
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Don James wrote:
>
> I hate to ask this here but I can not find it anywhere else. I have
> checked the manual and the FAQ's and will check anywhere someone can
> point me.
>
> I need to print the schema for my entire database. The format I need
> is:
>
> Table Name
> Field Name
> Field Type
> Field Size
>
> I think this should be easy to do, but have not had success. If you
> have an answer or can tell me where to find one please e-mail me at
> donj@lca.com
>
> TIA,
>
> Don
Hi Don!
The following 4gl program was written by Mario Estrada, you can use it to print
the schema in the way you are asking.
Hope this helps,
--------------------------------------------------
Carlos Santizo / Sisteco, S.A.
Departamento de / Phone(502) 3340214
Soporte de Informix / Fax(502) 3344837
--------------------------------------------------
------ =_NextPart_000_01BC199C.C355BD60
Content-Type: application/octet-stream; name="makedic.4gl"
Content-Transfer-Encoding: base64
####################################################################
#
# Program: makedic.4gl
# Author : Mario Estrada
# Date : Sept. 18 1994
#
# Sintax : <makedic> <database-name> <Project-name> <output-file>
#
# Comments:
# Generates a Dictionary File, for a better presentation
# in your documentation.
#
# You can compile it: c4gl makedic.4gl -o makedic.4ge and then run it
# as follows:
# makedic.4ge <database-name> <Project-name> <output-file>
#
# Or compile it with: fglpc makedic.4gl and then run it as follows:
#
# fglgo makedic <database-name> <Project-name> <output-file>
#
GLOBALS
DEFINE g_tabname CHAR(20),
g_dbname CHAR(20),
g_tabid INTEGER,
g_trans SMALLINT,
g_numparam INTEGER,
g_param1 CHAR(02),
g_param3 CHAR(02),
g_tecla_val INTEGER,
g_tecla_nom CHAR(10),
g_coltype CHAR(05),
g_nomemp CHAR(40),
g_output CHAR(40),
gr_systables RECORD
tabname char(18),
owner char(8),
dirpath char(64),
tabid integer,
rowsize smallint,
ncols smallint,
nindexes smallint,
nrows integer,
created date,
version integer,
tabtype char(1),
audpath char(64)
END RECORD,
gr_syscolumns RECORD
colname char(18),
tabid integer,
colno smallint,
coltype smallint,
collength smallint
END RECORD,
gr_sysindexes RECORD
idxname char(18),
owner char(8),
tabid integer,
idxtype char(1),
clustered char(1),
part1 smallint,
part2 smallint,
part3 smallint,
part4 smallint,
part5 smallint,
part6 smallint,
part7 smallint,
part8 smallint
END RECORD
END GLOBALS
DEFINE
V RECORD
tabid INTEGER,
tabname CHAR(18),
tabtype CHAR(15),
sequence SMALLINT,
colname CHAR(18),
colType CHAR(10),
collength INTEGER,
colScale INTEGER,
AllowNull CHAR(01)
END RECORD
MAIN
LET g_dbname = Arg_Val(1)
DATABASE g_dbname
LET g_nomemp = Arg_val(2)
LET g_output = Arg_val(3)
DECLARE SysTab SCROLL CURSOR FOR
SELECT * INTO gr_systables.*
FROM SYSTABLES
WHERE TABID > 99
ORDER BY TABNAME
DECLARE SysIndex SCROLL CURSOR FOR
SELECT * INTO gr_sysindexes.*
FROM SYSINDEXES
WHERE TABID > 99
DECLARE ColTab SCROLL CURSOR FOR
SELECT * INTO gr_syscolumns.*
FROM SYSCOLUMNS
WHERE TABID = gr_systables.tabid
{ ENTITIES }
START REPORT SysTabRep TO g_output
FOREACH SysTab
LET V.sequence = 0
FOREACH ColTab
LET v.tabid = gr_systables.tabid
LET v.tabname = UPSHIFT(gr_systables.tabname)
LET v.tabtype = TABTYPE(gr_systables.tabtype)
LET v.sequence = v.sequence + 1
LET v.colname