export delimited decimal fields

gracera

New Member
I'm trying to build a delimited text file to feed someone else's (non-Progress) program and they need the leading and trailing zeroes displayed in the decimal fields.

I tried formats on the variable definition and export. Is there an easy way to do this? (This is just simple logic to test, the real table has a many decimal and character fields) I don't want the number quoted.

OUTPUT TO test.txt.
DEF VAR igr AS DECI FORMAT "999.999".
DEF VAR txt AS CHAR FORMAT "x(20)".
ASSIGN igr = 1.1 txt = "yack, yack, yack".
export DELIMITER ";" igr FORMAT "999.999" txt.

I want the output to be:
001.100;"yack, yack, yack"
but I get
1.1;"yack, yack, yack"

Thanks in advance.
 

KrisM

Member
This is from the documentation on the 'export' statement :

A Format phrase with an EXPORT statement is ignored.


Maybe you should use the 'put' statement in stead of the 'export' statement.
 

sphipp

Member
If you want more control over the output then use PUT UNFORMATTED rather than EXPORT.

Code:
PUT UNFORMATTED igr FORMAT "999.999" ";" txt FORMAT "X(20)" SKIP.

Don't worry about using UNFORMATTED and FORMAT together - it allows you absolute control over what you are outputting.
 

sunilnair

Member
Code:
PUT UNFORMATTED igr FORMAT "999.999" ";" txt FORMAT "X(20)" SKIP.

but with this , it will become unmanageable if there are lots and lots of fields .....

I think the export with string as suggested by Balwinder above will be most beneficial ...
 
Top