Consultor Eletrônico



Kbase 17335: Exporting data in DIF format from the 4GL
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/10/2006
Status: Verified

GOAL:

How to export DIF data from the Progress 4GL.

FIX:

INTRODUCTION:
=============

The DIF format (Data Interchange Format) is a standard text format that allows data to be loaded into MS Excel, Lotus 123 and any other application that supports this format.

The Progress Data Administration supports to Exporting/Importing DIF files. This Progress Solutions entry describes how to use the same procedures to export data from the Progress 4GL.

The procedure that the Data Administration uses is prodict/dump/_dmpdiff.p.

The following example is customizable to fit individual needs.

EXAMPLE USING THE STATE TABLE:

If user_env[7] is set to unknown value(?) the program will be interactive and will export the data in DIF format. If user_env[7] is set to a program name, _dmpdiff.p will create a Progress procedure that can be run after to
export the data, in this case defining the shared variable totrecs is required.

/* *** e-diff.p *** */


DEFINE NEW SHARED VARIABLE totrecs AS INTEGER NO-UNDO.

DEFINE NEW SHARED VARIABLE drec_db AS RECID NO-UNDO.
DEFINE NEW SHARED VARIABLE user_dbname AS CHAR NO-UNDO.
DEFINE NEW SHARED VARIABLE user_env AS CHAR EXTENT 35 NO-UNDO.
DEFINE NEW SHARED STREAM logfile.

FIND FIRST _Db.
drec_db = RECID(_Db).

ASSIGN
   user_dbname = "SPORTS"
                                /* Database Name */
   user_env[ 1] = "State"
                                /* Table Name    */
   user_env[ 2] = "WHERE Region = 'West'"  
                                /* WHERE clause or "" */
   user_env[ 3] = "BY State"               
                                /* BY clause or "" */
   user_env[ 4] = "sports.dif"             
                                /* DIF filename */
   user_env[ 5] = "3"                      
                                /* Number of exported fields */
   user_env[ 6] = "State,State-Name,Region"
                                /* Comma separated field lists */
   user_env[ 7] = "statedif.p"          
                                /* Program name or ? unknown value */
   user_env[ 9] = "State"               
                                /* Format name for message */
   user_env[14] = "n".                   
                                /* Disable triggers for dump y
? */

   /* Notice: user_env[8] and others are not required */

RUN prodict/dump/_dmpdiff.p.

/* *** END OF e-diff.p ***/

NOTES:


- DDE (Dynamic Data Exchange) is available in MS-Windows to exchange data without temporary files, using dynamic interprocess communications statements.