Scenario:
ColumnA is a varchar field (eg. value=A).
ColumnB is a decimal[10,0] field (eg. value=76543210).
ColumnC is a varchar field (eg. value=X).
Requirement:
Write to a comma-delimited sequential file. ColumnB is not to have a leading space or decimal point.
eg. the record should be: A,76543210,X
Problems:
1. By default, the record is written as: A, 76543210.,X
2. Using "AsInteger(ColumnA) function produces: A,76540000,X
3. Using DecimalToString(ColumnA) function produces: A, 007654321,X
4. The out format can only be specified for integer types, but 10-digits can cause an overflow in an integer data type.
Solution:
One solution is to use a bunch of nested Trim statements (both inefficient and inelegant):
Trim(Trim(TrimF(DecimalToString(ColumnA,"fix_zero")),".","T"),"0","L")
Does anyone know of a better solution to produce the required output?
Need to write decimal(10) column to sequential file
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 353
- Joined: Wed Apr 06, 2005 8:45 am