Consultor Eletrônico



Kbase P105543: 4GL/ABL: How to output the table field names when using theEXPORT statement?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   26/11/2008
Status: Verified

GOAL:

4GL/ABL: How to output the table field names when using the EXPORT statement to dump a database table?

GOAL:

How to output the table field names as the first row of the output file when using the EXPORT statement to dump a database table?

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

The following code outputs the Customer table's field names as the first row of the output file Customer.d before exporting the actual data using the EXPORT statement:
DEFINE VARIABLE hBufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE hFieldHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE iCounter AS INTEGER NO-UNDO.
DEFINE VARIABLE cFieldNameList AS CHARACTER NO-UNDO.
ASSIGN
hBufferHandle = BUFFER Customer:HANDLE.
DO iCounter = 1 TO hBufferHandle:NUM-FIELDS:
hFieldHandle = hBufferHandle:BUFFER-FIELD(iCounter).
cFieldNameList = cFieldNameList + CHR(32) + hFieldHandle:NAME.
END.
cFieldNameList = LEFT-TRIM(cFieldNameList, CHR(32)).
OUTPUT TO customer.d.
PUT UNFORMATTED cFieldNameList SKIP.
FOR EACH Customer NO-LOCK:
EXPORT Customer.
END.
OUTPUT CLOSE.