Midrange News for the IBM i Community


Posted by: John Dowling
Milford, Ma
Data conversion
has no ratings.
Published: 01 Aug 2012
Revised: 23 Jan 2013 - 2185 days ago
Last viewed on: 15 Jan 2019 (3258 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Data conversion Published by: John Dowling on 01 Aug 2012 view comments(4)

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Data conversion
Posted: 6 years 5 months 17 days 9 hours 51 minutes ago

The decimal point is not implied, if it's not there then the assumption is that the data is an integer representation.  You either need to scan/check the input field for the decimal point and insert it yourself.  OR monitor with on-error trap to catch the garbage and then do something to audit that you could not handle that piece of data.

Posted by: BrianR
Premium member *
Green Bay, WI
Comment on: Data conversion
Posted: 6 years 5 months 17 days 9 hours 17 minutes ago

You don't need arrays to handle the conversion.  If the decimal point is never present in the source field (always implied), then this should also work (numberfield is defined as dec(9,2)):

Monitor;

numberfield = %dec(alphafield:9:0) / 100;

Endmon;

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Data conversion
Posted: 6 years 5 months 16 days 18 hours 36 minutes ago

The only reason I can see for needing arrays is that there are 24 values per input record that need to be converted in this way.

Posted by: BrianR
Premium member *
Green Bay, WI
Comment on: Data conversion
Posted: 6 years 5 months 16 days 14 hours 48 minutes ago
Edited: Thu, 02 Aug, 2012 at 10:47:38 (2359 days ago)

Oops, I didn't read the post closely enough.  For some reason, I thought the arrays were used to break up a single value into individual digits, so never mind about the array comment.