Subject: RE: Best way to convert numeric with Decimals From: "Haas, Matt (CL Tech Sv)" Date: Thu, 21 Aug 2008 16:24:08 -0400 List-archive: List-help: List-id: RPG programming on the AS400 / iSeries List-post: List-subscribe: , List-unsubscribe: ,

Scott,

You've never worked with JDE World, have you? I can't say that this is what he's dealing with for sure but World does this. I think the idea is to be able to change decimal places by making data dictionary changes but somehow, I don't see it being that simple.

World also has other fun stuff like right justified data as part of file keys and some general stupidity with starting and ending date ranges in some files (basically, for things like customer's addresses that can change on certain dates, if you just have one record, it has no start or end date).

Matt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Thursday, August 21, 2008 3:49 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Best way to convert numeric with Decimals

You can do this:

evalr char = %triml(%editc(number:'X'): '0');

Though, I can't for the life of me understand why you'd want to strip
out the decimal point. Now you're going to rely on the program that
receives the variable to assume a certain number of decimal points -- so
the number of decimal points has to be defined in two places, the one
who creates the parm, and the one who receives the parm.

Wouldn't it make more sense to leave the decimal point in the code so
the decimal places from the caller/callee don't have to match? Instead,
they calculate the number of decimals in the parm based on the position
of the decimal point? i.e. self-describing data.

It's also a lot easier for a human-being to read that way.