Giovanni's logo
Data conversione functions
questo significa Versione 2
indice analitico
M
power search
blue line
Mel's service program includes several data conversion functions you may take advantage from.

  1. char2hex converts a character string to its hexadecimal representation
  2. hex2char converts a character string in hexadecimal format to its character representation
  3. 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:
    1. one or more errors occurred
    2. non-numeric characters (includes minus sign in wrong place)
    3. multiple decimal points
    4. multiple signs (both leading and trailing)
    5. zero length input or no numeric characters
    6. too many digits to the left of the decimal point
    7. no errors, but value is less than 0.
  4. c2n converts a character string to a floating point number. It is recommended that you check the string with chknbr before calling c2n.
  5. 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.
  6. 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).
  7. uppify converts all the characters in a string to upper case.