Title: Message
The following will convert it to digit only, removing $, periods and commas, and also zero fill the number for mainframes.
I can also give you the code for IBM signed digits
 
 
-- set up and set to text string←
-- input v$ currency  and returns s$ text as cleaned value←
set var len int = 0←
SET VAR s$ TEXT TO ''←
SET VAR v$ CURRENCY = .%1←

SET VAR vlen int  = .%2←
if vlen fails or vlen = 0 then←
set var vlen = 10←
endif←

SET VAR s$ = (CTXT(.v$))←

-- strip out anything not number or decminal←
SET VAR v4= 1←
SET VAR v5 = ''←
SET VAR v1 = (SLEN(.s$))←
WHILE v4 <= .v1 THEN←
  SET VAR v3 = (SGET(.s$,1,.v4))←
  SET VAR v4 = (.v4 + 1)←

  IF v3 IN (0 1 2 3 4 5 6 7 8 9 ) THEN←
    SET VAR v5 TEXT = (.v5 + .v3)←
  ENDIF←
ENDWHILE←
SET VAR s$ = .v5←
CLEAR VAR v1 v3 v4 v5←
SET VAR s$ TEXT =  ('000000000000000' + .s$)←
SET VAR v1 = (SLEN(.s$))←
SET VAR s$ = (SGET(.s$,11,.v1-10))←
--SHOW VAR s$←


 
Mark Lindner
Lindner & Associates PC
254 Second Ave
Needham  MA   02494
781 247 1100   Fax  781 247 1143
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Larry Wilson
Sent: Wednesday, September 14, 2005 10:51 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Removinf Decimal point from double or currency data types

Hello List:

 

I have an application that is sending data to a mainframe and the data includes a currency data type.

 

I need to strip out the decimal point from the currency value but still keep the cents

 

Example  $25.45 needs to be 2545

 

Any Ideas or suggestion would be greatly appreciated.

 

TIA

 

Larry Wilson

 

 

Reply via email to