Mel's service program includes several
data conversion functions
you may take advantage from.
- char2hex
converts a character string to its hexadecimal
representation
- hex2char
converts a character string in hexadecimal format to its
character representation
- chknbr
accepts a character string and an optional parameter
specifying the maximum number of digits to the left of the decimal point.
Additional optional parameters are available to request that any errors
found should be formatted as messages and added to the service program's
message arrays, the text that should be used to describe the field in the messages,
and whether a message should be sent if the field's value is less than zero.
Chknbr returns a structure containing seven indicators. The indicators and
their meaning when *on are:
- one or more errors occurred
- non-numeric characters (includes minus sign in wrong place)
- multiple decimal points
- multiple signs (both leading and trailing)
- zero length input or no numeric characters
- too many digits to the left of the decimal point
- no errors, but value is less than 0.
- c2n
converts a character string to a floating point number. It is
recommended that you check the string with chknbr before calling c2n.
- c2n2
converts a character string to a packed 30.9 number. c2n2
performs faster than c2n and has none of c2n's floating point precision problems.
Therefore, it is recommended that you use c2n2 instead of c2n. It is recommended that
you check the string with chknbr before calling c2n2.
- xlatWCCSIDs
uses CCSIDs to translate variable length strings up to 32767 characters in
length.
If optional parameters fromCCSID and toCCSID are specified, they are used
for the translation.
Otherwise, translation between ASCII and EBCDIC
is performed using the CCSIDs found in the CGI_EBCDIC_CCSID and
CGI_ASCII_CCSID environment variables. Input parameter, toebcdic,
is used to determine whether translation is from ASCII to EBCDIC (*on) or
from EBCDIC to ASCII (*off).
- uppify
converts all the characters in a string to upper case.
|