Problem:
What mechanisms are there to convert strings to numbers in a COBOL Program.
Resolution:
COBOL has the NUMVAL intrinsic function avalable on all platforms. .Net also has available some methods for converting.
On the numeric data classes such as System.Int32 and System.Decimal there is the "Parse" and "TryParse" methods.
Parse will attempt to convert but will throw an exception is the format of the string is not valid.
TryParse will attempt to convert and will return a boolean if the conversion fails. If you expect that a numeric parse will fail then use tryparse as an exception from Parse is expensive in terms of performance in an application.