Skip to main content

Problem:

Visual Studio 2005

How to convert a character string of numeric digits into its equivalent numeric value - not as simple as moving the value of an alphanumeric data-item to a numeric (floating-point) data-item, as the decimal point may be lost.

Resolution:

Attached is a structured COBOL approach to converting the string to its numeric decimal equivalent.

It splits the string on the decimal point into its integer and fractional parts; then performs a COMPUTE to work out the numeric decimal equivalent and store it in a numeric data item.

This is just one approach.

Attachments:

testStrtoDec.cbl

Old KB# 1263