Feedback
Did this article resolve your question/issue?

   

Article

How to programmatically dump and load database definitions (.df's) and data (.d's) files using Data Administration routines ?

« Go Back

Information

 
TitleHow to programmatically dump and load database definitions (.df's) and data (.d's) files using Data Administration routines ?
URL Name15884
Article Number000120727
EnvironmentProduct: OpenEdge
Version: All Ssupported Versions
OS: All Supported Platforms
Question/Problem Description
How to programmatically dump and load database definitions (.df's) and data (.d's) files?
How to load a .df file without going through the Data Administration Tool?
How to use prodict/dump_d.p, prodict/dump_df.p, prodict/load_d.p, prodict/load_df.p?
How to dump and load tables using ABL code ?
How to dump data definitions outside the dictionary?
Sample code to dump and load .df and .d using Data Dictionary routines
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
There are 4 routines the Data Dictionary / Data Administration relies on, that can be called from other programs as well.
Following are basic samples on how to invoke these to dump a .df file (prodict/dump_df.p), dump .d files (prodict/dump_d.p), and to load them again (prodict/load_df.pprodict/load_d.p respectively).

These sample programs consider the case of multiple databases connected by the PROGRESS session, by setting the DICTDB alias to point to the desired database. Delete of the ALIAS at the end is only required if dump/load of other databases follow the code.

    /* dump.p */
CREATE ALIAS DICTDB FOR DATABASE sports.
DISPLAY LDBNAME("DICTDB").

RUN prodict/dump_df.p   ("ALL",
                         "sports.df",
                          "").
/*
Input parameters:
    file-name                : "ALL" or "<file-name> [,<filename>] ..." -> comma-delimited list of table names
    df-file-name             : Name of file to dump to
    code-page                : ?, "", "<code-page>"
               ?             = no conversion
               ""            = default conversion (SESSION:STREAM)
               "<code-page>" =  convert to <code-page>

*/

RUN prodict/dump_d.p ("ALL",".","").
/*
    Input parameters:
    file-name                : "ALL" or "<file-name>"
    dot-d-dir                : directory relative to working-directory
    code-page                : ?, "", "<code-page>"
               ?             = no conversion
               ""            = default conversion (SESSION:STREAM)
               "<code-page>" =  convert to <code-page>
*/

DELETE ALIAS DICTDB. /* Optional */

    /* load.p */
CREATE ALIAS DICTDB FOR DATABASE sports.
DISPLAY LDBNAME("DICTDB").

RUN prodict/load_df.p ("sports.df").
/*
Input Parameters:
    df-file-name             : The name of the .df file to be loaded into DICTDB
*/

RUN prodict/load_d.p ("ALL",".").
/*
Input Parameters:
    file-name                : "ALL" or "<file-name>"
    dot-d-dir                : location of files to load; directory relative to working-directory

*/

DELETE ALIAS DICTDB. /* Optional */

Further documentation is included in the source code for the programs.

The source code of the Data Dictionary routines to dump/load data and definitions are located in dlc/src/prodict, or dlc/src/prodict.pl
Before using these code samples the procedure library named 'prodict.pl' must be extracted following these steps:

1) Make sure the DLC/bin directory is in the path.
2) Default to the SRC directory
3) Run the command extractpl prodict.pl
4) Run the command extractpl adecomm.pl

This will create a prodict and an adecomm directory with these files.
 
Progress does not provide support for the modification and/or use of these modules outside of the Data Dictionary.

OpenEdge 10.0 introduced improved support for online schema changes.
The load_df.p procedure provides access to this functionality, with the ability of passing additional parameters in a commma separated string stored in df-file-name. 

The string entry definitions are: "df-file-name,<commit>,<session parameter>". 

Examples:

1. The following code will fail if there are errors in the .df:
       RUN prodict/load_df.p ("sports.df").

2. The following code will ignore any errors and commit the loading of the .df:
       RUN prodict/load_df.p ("sports.df,yes").

3. The following code will allow the loading of new tables/sequences:
       RUN prodict/load_df.p ("sports.df,,NEW OBJECTS").

4. The following code will allow the loading of new tables/sequences AND ignore any errors and commit the loading of the .df:
       RUN prodict/load_df.p ("sports.df,yes,NEW OBJECTS").

If you do not have a Development license, you will need to use the -rx to launch the procedure editor and allow schema changes online (Article How to perform a schema upgrade with a runtime license). 
Workaround
Notes
References to Other Documentation:
Progress Article(s):
How to extract source codes of data dictionary
 
Last Modified Date10/8/2020 5:17 PM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.