Truncates a decimal expression to a specified number of decimal places, returning a decimal value.
A decimal expression that you want to truncate.
A non-negative integer expression that indicates the number of decimal places for a truncated expression.
This procedure doubles each Customer's CreditLimit and then truncates that value before rounding it to the nearest $1000:
r-trunc.p
FOR EACH Customer: FORM Customer.CustNum Customer.Name Customer.CreditLimit new-max LIKE Customer.CreditLimit LABEL "New Credit limit". DISPLAY Customer.CustNum Customer.Name Customer.CreditLimit. Customer.CreditLimit = TRUNCATE((Customer.CreditLimit * 2) / 1000 ,0) * 1000. IF Customer.CreditLimit < 15000 THEN Customer.CreditLimit = 15000. DISPLAY Customer.CreditLimit @ new-max. END. |