neeraj430 wrote:Thnx for the reply billy...
I will go with the manual method for now. Please suggest if the below code is same as what you have explained.(define an OCCURS so you can loop from the start to the first non-zero character, or the digit in front of the decimal point, setting zeros to space.)
WS-amount W 01 A OCCURS 9
DEFINE ws-amount-1 01 A OCCURS 9 INDEX ONE-IX
NAME-SUB = 1
ONE-IX = 0
DO UNTIL WS-amount EQ 10
IF WS-amount (NAME-SUB) E '0'
WS-amount (NAME-SUB) = ' '
ONE-IX = ONE-IX + 1
NAME-SUB = NAME-SUB + 1
ELSE
NAME-SUB = 9
END-IF
ONE-IX = ONE-IX + 1
ws-amount-1 = ws-amount
.
Well, I can't see an END-DO and I don't think you mean WS-amount EQ 10 at the top of the DO.
I'd start like this:
W-SPLIT-NUMBER W 11 N 2
W-SN-INTEGER W-SPLIT-NUMBER 9 A
W-SN-DECIMAL W-SPLIT-NUMBER +9 2 N 0
W-EDITED-NUMBER W 12 A
W-EN-INTEGER W-EDITED-NUMBER 9 A
W-EN-DECIMAL-POINT W-EDITED-NUMBER +9 1 A
W-EN-DECIMAL W-EDITED-NUMBER +10 2 N
W-SPLIT-NUMBER = source-number
W-EN-INTEGER = W-SN-INTEGER
W-EN-DECIMAL-POINT = "."
W-EN-DECIMAL = W-EDITED-NUMBER
Then you can redefine the W-EN-INTEGER with the OCCURS.
Your DO wants to go for a max of eight, probably, as it is more usual to have "0.xx" than ".xx", but I don't know what you need.
You need to stop your DO when you hit a value of 1 through 9, otherwise you'll be changing significant zeros to space.
Note the way I've done the redefine of the decimal part as numeric. This is important as for Easytrieve anything with decimal places is "signed". If you did it as A straight away, it would run the risk of a non-number appearing in your output, representing the sign. So, defined as two with zero decimal places first, so it is signed. Then assigned to two with no decimal places, so any sign disappears, becoming the "F" in the sign "zone".
If your numbers can be signed, just increase the edited field to the right for the sign, and test original for LT ZERO.
EDIT: I wouldn't assign the decimal-point each time, personally, I'd do it in a START proc.