Consultor Eletrônico



Kbase P84277: How to export quoted numeric and date fields to an ASCII file?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   09/08/2004
Status: Unverified

GOAL:

How to export quoted numeric and date fields to an ASCII file?

FACT(s) (Environment):

Progress 7.x

FACT(s) (Environment):

Progress 8.x

FACT(s) (Environment):

Progress 9.x

FIX:

To have the numeric and / or date fields 'quoted' in the output file when using the Progress 4GL EXPORT statement, use the STRING function. For example:

The following code exports two customer records to a file. Notice that the cusnum (INTEGER) and the balance (DECIMAL) are not quoted in the output file:

OUTPUT TO Unquoted.cvs.
FOR EACH customer WHERE custnum < 3:
EXPORT DELIMITER ","
custnum NAME balance.
END.
OUTPUT CLOSE.

The resulting output file:

1,"Lift Tours",903.64
2,"Urpon Frisbee",437.63


The following code exports the same customer records to another file. Notice that the STRING function was used with all the non CHARACTER fields; cusnum (INTEGER) and the balance (DECIMAL); to ensure that their values are output as quoted strings:

OUTPUT TO Quoted.cvs.
FOR EACH customer WHERE custnum < 3:
EXPORT DELIMITER ","
STRING(custnum) NAME STRING(balance).
END.
OUTPUT CLOSE.

The resulting output file:

"1","Lift Tours","903.64"
"2","Urpon Frisbee","437.63"