Consultor Eletrônico



Kbase 21762: How To Convert Database Schema File (.df) from V9 to V8
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/02/2002
SUMMARY:

This Solution applies to Progress versions 8.x and 9.x. It shows you how to programmatically convert a database definitions file (.df) generated from a Progress version 9.x database to a Progress version 8.x database definitions file (.df) for database schema loading purposes.

SOLUTION:

As described in Progress Solution 19006, it is necessary to remove the AREA, POSITION, and SQL-WIDTH lines from a Progress version 9.x database schema or definitions file (.df) before loading it into a Progress version 8.x database via the Progress Data Dictionary Tool.
Instead of manually removing those lines from the .df file via a text editor or some other similar software, you can run this code to facilitate and automate that process:

DEFINE VARIABLE vcFileName AS CHARACTER NO-UNDO.
DEFINE VARIABLE vcStrLine AS CHARACTER NO-UNDO.

IF OPSYS = "WIN32":U THEN
SYSTEM-DIALOG GET-FILE vcFileName
TITLE
"Choose database definitions file to convert from V9 to V8...":U
FILTERS "Database Definitions Files (*.df)":U "*.df":U
MUST-EXIST.
ELSE
UPDATE vcFileName FORMAT "X(40)":U
LABEL "Database Definitions File Name":U
WITH FRAME fUpdate VIEW-AS DIALOG-BOX WIDTH 80 SIDE-LABELS TITLE
"Type in database definitions file name to convert from V9 to V8...":U.

IF vcFileName <> "":U AND
vcFileName <> ? AND
SUBSTRING(vcFileName,R-INDEX(vcFileName,".":U)) = ".df":U THEN
DO:
OS-COMMAND SILENT
VALUE("quoter ":U + vcFileName + " > ":U +
SUBSTRING(vcFileName,1,R-INDEX(vcFileName,".":U) - 1) +
"v9.df":U).
INPUT FROM
VALUE(SUBSTRING(vcFileName,1,R-INDEX(vcFileName,".":U) - 1) +
"v9.df":U).
OUTPUT TO
VALUE(SUBSTRING(vcFileName,1,R-INDEX(vcFileName,".":U) - 1) +
"v8.df":U) PAGE-SIZE 0.
REPEAT:
IMPORT vcStrLine.
IF TRIM(vcStrLine) BEGINS "AREA":U OR
TRIM(vcStrLine) BEGINS "POSITION":U OR
TRIM(vcStrLine) BEGINS "SQL-WIDTH":U THEN
NEXT.
PUT UNFORMATTED (IF vcStrline = "":U THEN
CHR(32)
ELSE
vcStrLine) SKIP.
END.
OUTPUT CLOSE.
INPUT CLOSE.
MESSAGE
"The":U SUBSTRING(vcFileName,1,R-INDEX(vcFileName,".":U) - 1) +
"v8.df was successfully generated!":U
VIEW-AS ALERT-BOX INFORMATION.
END.


References to Written Documentation:

Progress Knowledge Base Solutions:
19006, "Loading a Version 9.x .df File into Version 8.x"
20013, "How to Load a V8 Schema (.df file) in a V9 Database"