Release 10.1A: OpenEdge Development:
Progress Dynamics Administration

> ## Writing a dump program

> This is a sample dump program using default code that you can use to export the contents of the `gsm_menu_structure_item` table:

> gsmitout.p sample using the default code
>     /* gsmitout.p */
>     {db/icf/dfd/sitedataprocout.i
>       &OutputFile = "'gsmitout.d'"
>       &OutputTable = "gsm_menu_structure_item"
>       &ObjField = "menu_structure_item_obj"}

> This program assumes that the data to be dumped is from a table that has an object ID field of data type decimal (`ObjField` include file directive). The object ID’s mantissa is used to determine the site number of the data to be dumped. The `OutputFile` include file directive provides a character string name for the file to be dumped. All dumped data is written to the first directory named `sitedatadump` that can be found in the `PROPATH`. The `OutputTable` directive contains the name of the table to be exported.

> Using the default `sitedataprocout.i` include file to provide all of the code is the easiest way to produce a dump program. This code automatically exports the specified data for all sites listed in the `dumpconfig.txt` file to the dump files that are later read by a load program.

> If you must add any special customizations, you can use code based on the following example to dump the data:

> gsmitout.p sample using customized code
>     /* Include the parameters required for this program */
>     {db/icf/dfd/sitedatahdrout.i}
>     /* Find the record in the ttDumpFileLocation table for the output file */
>     FIND ttDumpFileLocation
>       WHERE ttDumpFileLocation.cDumpFile = {&OutputFile}
>       NO-ERROR.
>     /* If no record exists, or the path is ?, we do not need to write this file
>     out. Simply return to the caller. */
>     IF NOT AVAILABLE(ttDumpFileLocation) OR
>        ttDumpFileLocation.cDumpFilePath = ? THEN
>       RETURN.
>     /* Open the stream that we will write the data out on and make sure we APPEND
>     to it. The file may have been created on a previous call to this program. The
>     caller will have ensured that the file was a new file before the first call */
>     OUTPUT TO VALUE(ttDumpFileLocation.cDumpFilePath) APPEND.
>     FOR EACH /* table that we need to dump */
>       WHERE (Table.ObjID - TRUNCATE(Table.ObjID,0)= pdSiteNo):
>     /* This where clause gets us only the records for the site number that was
>     passed into this procedure as a parameter. */
>       EXPORT Table.
>     END.
>     OUTPUT CLOSE.

> The comments in the above code describe what must be in the code. Two parameters defined in `sitedatahdrout.i` are passed to this procedure when it is called. The first is the site number for which data should be dumped in the mantissa of the `pdSiteNo` decimal field. The second is the table containing the dump file locations. It might be that your dump program requires more than one export file. The `dumpconfig.txt` file provides for this by allowing you to refer to the export file by the name you specify. For more information, see the "Creating a dumpconfig.txt file" section.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095