www.krengeltech.com

RXS_charToNbr

From Wiki

User Guide

Contents

Description

XML data is passed as strings. If your system needs to store it as decimal or numeric data, you will need to convert it. Versions of the RPG ILE compiler newer than V5R1 allow programmers to convert strings to number using the %INT (Convert to Integer Format) RPG BIF or %DEC (Convert to Packed Decimal Format) RPG BIF built-in functions. This subprocedure simplifies character to numeric conversion on a V5R1 system.

Prototype

     D RXS_charToNbr   pr            30P 9
     D  pStr                         50A   varying const
     D  pDft                         30P 9 value

Parameters

pStr
Pass the string value to convert. If this function encounters a non-numeric character (i.e. only a decimal point and 0-9 are allowed), the conversion will stop at that point and return the value converted to that point.
pDft
Pass a default value to be used if the string can not be converted for any reason. (A common value used here is zero)
Return Parameter
Returns the numerical representation of the string passed in.

Return value

None.

Notes / Examples

  CM.CUSTNBR = RXS_charToNbr(pData: 0);