Consultor Eletrônico



Kbase 16198: SAMPLE CODE TO CREATE DUMP LOAD PROCEDURES run-time runtime
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
SAMPLE CODE TO CREATE DUMP LOAD PROCEDURES run-time runtime

Customers with Run Time Progress licenses can not dump or load
data using the Data Dictionary ion. Dump/load procedures must be
written with a 4GL license to be used at the run-time license site.
Below is a sample program that can be used for this purpose.
For each table of the connected (working) database, it generates
and compiles an export and an import .p file.
The user must make sure that the database the .p's were compiled
against and the database r-code will be run against have the same CRC.

The Developers Toolkit includes a similar procedure (mkdmpld.p) that
creates procedures for dumping and loading database contents. These
procedures can either be compiled in development environment or
encrypted with xcode utility for compilation with runtime product.

For more information on deploying with run-time license as well as
other licenses, refer to the Progress Developer's Toolkit manual.

DEF STREAM ImpStr.
DEF STREAM ExpStr.
DEF VAR cImpFic AS CHAR NO-UNDO.
DEF VAR cExpFic AS CHAR NO-UNDO.
DEF VAR cDotDF AS CHAR NO-UNDO.

FOR EACH _file WHERE _file-num > 0:
cImpFic = SUBSTRING(_file-name,1,5) + "imp.p".
cExpFic = SUBSTRING(_file-name,1,5) + "exp.p".
cDotDf = SUBSTRING(_file-name,1,8). /* This can be _Dump-name */
cDotDf = cDotDf + ".d".

/* Create export file */
/* The customer can check if the file already exists or another*/
/* table can produce the same .p file */
OUTPUT STREAM ExpStr TO VALUE(cExpFic).
PUT STREAM ExpStr UNFORMATTED "OUTPUT TO '" cDotDF "'." SKIP.
PUT STREAM ExpStr UNFORMATTED "FOR EACH " _file-name "
NO-LOCK:" SKIP.
PUT STREAM ExpStr UNFORMATTED " EXPORT" SKIP.

/* Create import file */
OUTPUT STREAM ImpStr TO VALUE(cImpFic).
PUT STREAM ImpStr UNFORMATTED "INPUT FROM '" cDotDF "'." SKIP.
PUT STREAM ImpStr UNFORMATTED "REPEAT: " SKIP.
PUT STREAM ImpStr UNFORMATTED " CREATE " _file-name "." SKIP.

PUT STREAM ImpStr UNFORMATTED " IMPORT" SKIP.

FOR EACH _field of _file:
PUT STREAM ExpStr UNFORMATTED " " _field-name SKIP.
PUT STREAM ImpStr UNFORMATTED " " _field-name SKIP.
END.

PUT STREAM ExpStr UNFORMATTED " ." SKIP.
PUT STREAM ImpStr UNFORMATTED " ." SKIP.
PUT STREAM ExpStr UNFORMATTED "END." SKIP.
PUT STREAM ImpStr UNFORMATTED "END." SKIP.
PUT STREAM ExpStr UNFORMATTED "OUTPUT CLOSE." SKIP.
PUT STREAM ImpStr UNFORMATTED "INPUT CLOSE." SKIP.
OUTPUT STREAM ExpStr CLOSE.
OUTPUT STREAM ImpStr CLOSE.

COMPILE VALUE(cImpFic) SAVE.
COMPILE VALUE(cExpFic) SAVE.
END.

Progress Software Technical Support Note # 16198