Decimal to String

ttobba

New Member
I tried searching but i didnt find anything that would help me with my situation so here is my question...

I am outputing data to a txt file and the file not delimilited. Basically the user is just going to read in a certain amount of characters for a specfic field.

I want to convert a decimal value to string to be displayed. I do not want the '-' sign and no leading 0's. Basically in this format of lenght 12 this format -->
"->>>>>>>>9.99". I use a replace to get rid of the negitive sign. Is this the right way to go about it. I read in other posts to basic math operations to get the correct display value. I dont really want the overhead because the files I am sending are quite large.

Some code....

def var a as char.

a = REPLACE(STRING(ap_amt,"->>>>>>>>9.99"),'-','').

disp a format 'x(12).


The format in the display overrides the format in the assign statment. When I dont use the format option the value appears correctly but the lenght of the line in the txt file is one character to long. When i add the format statement in the display, their is only one value on the right side of the decimal (example - 123.1). Where is this extra char being assigned.

My Answer...

I am assuming that the problem is because of the decimal value is max of 10? if i restrict the decimal value to only 10 chars of course it works fine. So i am kindof answering my own question. I just started out with progress and would like any clarification, still learning. I just want to know why it is doing what it is doin.

Does max value of 10 for a decimal mean 10 places to the right and left of decimal point or just 10 decimal places total?

Thankz in advance.
 

ttobba

New Member
Ahhh.. I need to type out my question first and then answer them myself before posting. Sorry Scratch this post.
 
Top