Focal Point
[SOLVED] Help with Reformatting Packed-Decimal Format

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/965104661

June 29, 2009, 02:44 PM
<akilayko>
[SOLVED] Help with Reformatting Packed-Decimal Format
Hello. I would really appreciate any assistance I can get from this forum. There is this variable XYZ/P11.2. I want to display it without the decimal point. Say 599.95 will come out as 59995. I read through a lot of discussions but usually the topic is about truncating the decimal values and not about removing the decimal point Frowner

Thank you for taking the time.

This message has been edited. Last edited by: Kerry,
June 29, 2009, 02:59 PM
GinnyJakes
DEFINE FILE CAR
PFLD/P11.2=599.95;
PFLD2/P11=PFLD*100;
END
TABLE FILE CAR
PRINT COUNTRY PFLD PFLD2 
IF READLIMIT EQ 1
END


Multiply it by 100. Basic arithmetic.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
June 29, 2009, 03:32 PM
<akilayko>
Of course. I was bent on converting to an alpha then extracting and stripping. Thank you much. Can I ask another question, please?

So now that I have 59995, I also have 4210 and 100170. I need to have them printed onto a text file where total num of chars in a string is 6. Meaning 599.95=059995, 42.10=004210 and 1001.70=100170. Is there a function to count number of digits like ARGLEN is to an alphanumeric? This way I can just concatenate with either '0' or '00'?

Thank you very much.
June 29, 2009, 04:24 PM
GinnyJakes
After you do the multiplication, can't you just convert them to an I6 format with leading zeros displayed. I think the format for that is I6L. You can then hold as FORMAT ALPHA. See what that does for you.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
June 29, 2009, 04:43 PM
<akilayko>
Oh wow. Worked like a charm. Thank you so very much, GinnyJakes.