~Vamsi
3rd December 2001, 21:23
Norbert Wimmer sent this one in. Thanks Norbert.


|******************************************************************************
|* tdzus9400msql 0 VRC B40C c4 RUG
|* Title : Table Loader - Source and Data Generator
|* : Erzeuge Prog. fuer SQL-Export
|* Author : Norbert Wimmer
|* Date : 2001-09-19
|******************************************************************************
|* Main table tdzus900 Historie Schnittstelle Export, Form Type 4
|******************************************************************************
|* Script Type : Type 4 Without Main Table
|* Description : <library description>
|* Category : Utility
|* License :
|* Copyright 2001 by Norbert Wimmer
|*
|* All Rights Reserved
|*
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation.
|*
|* Norbert Wimmer and Baanboard.com DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL Norbert Wimmer nor Baanboard.com BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|******************************************************************************
|* What it does:
|* you enter a table and its PC. A script is produced, which, when compiled and
|* run, produces two files: xxxx.sql contains the SQL statements needed to
|* create this table in a database, xxxx.dat contains the data of this table,
|* ready to be loaded into the new database table.
|*
|* The form is missing, but simple.
|* 7 input fields: 3 for table package/module/name. 3 for package combination
|* like B40C c4 namx and a string containing the directory for the output file.
|* This program creates an ascii file which can be loaded as a source and then
|* be compiled.
|* The only fault it has is that it assumes that the PVRC is derived from
|* B40Uc4stnd, which itself is derived from B40c4. This may have to be changed
|* in the source.
|******************************************************************************
|****************************** declaration section ***************************
declaration:

table tttadv400 | domains
table tttadv401 | enums + constraints
table tttadv402 | enum Description
table tttadv420 | table definitions
table tttadv421 | table indices
table tttadv422 | table fields
table tttadv423 | child fields


extern domain tcmcs.str2 t1
extern domain tcmcs.str3 t2
extern domain tcmcs.str3 t3
extern domain tcmcs.str4 t4
extern domain tcmcs.str2 t5
extern domain tcmcs.str4 t6
extern domain tcmcs.str70 dirnam
domain tcmcs.str2 cpac
domain tcmcs.str12 cdom
domain tcmcs.str4 vers
domain tcmcs.str2 rele
domain tcmcs.str4 cust
string buff(300)
string tabnam(8)
.....................



Please see the attached file for the full code

csekhar
13th March 2002, 22:42
Vamsi,
What is the usage of this script ?? I downloaded the script and from the documentation also it is not clear what this script does. The reason I'm asking is we are planning to move to IVc4. We are right now on Baan IVc. We modified some of the table definitions like making some fields mandatory / adding additional fields etc. Please let me know the usage of this script. Where can I use this script ??
Regards
Chandu

~Vamsi
14th March 2002, 03:32
This was one of the first scripts that got uploaded to this forum. Norbert is the Author. I have not used it and am unable to explain the full use of it. May be Norbert will notice the thread and reply.

norwim
26th February 2003, 14:05
sorry for this VERY late reply.
The idea of this script is the following:
you need to create a seq. dump of table but can't use bdbpre.
So what this script does is:
read in the PVRC and a table name (from a form to be created)
plus a directory-name.

Now the program reads the information about the table from the tools tables (indices, fields, domains etc.) and creates a seq. file:

This (newly created) file is a template ready to be translated with Baan compiler and contains two functions:
1) first function to create a file containing the field descriptions (to be used later to create that table under mysql)
2) second function to write one record of that table

The program created has a select statement that reads the table and calls the second function for each record.

Note that the directoryname passed will be used for the output commands in both functions.

We use this script here from time to time to append an existing program script that dumps a load of tables each night.

hth

Norbert