cwbDT_ASCIIToPacked

Purpose

Translates ASCII numeric data to packed decimal format. This function can be used for translating ASCII text data for use on the iSeries™ server.

Unicode version

cwbDT_WideToPacked

Syntax

 
unsigned int CWB_ENTRY cwbDT_ASCIIToPacked(
                             char         *target,
                             char         *source,
                             unsigned long length,
                             unsigned long decimalPosition);

Parameters

char * target - output
Pointer to the target data.
char * source - input
Pointer to the source data. Must be zero terminated.
unsigned long length - input
Number of bytes of target data to translate.
unsigned long decimalPosition - input
Position of the decimal point.

Return Codes

The following list shows common return values.

CWB_OK
Successful Completion.
CWB_INVALID_POINTER
NULL pointer was passed by caller.
CWB_BUFFER_OVERFLOW
Overflow error.
CWB_NOT_ENOUGH_MEMORY
Unable to allocate temporary memory.
other
Offset of the first untranslated character plus one.

Usage

The caller must make sure that there is adequate space to hold the target information. The sign half-byte will be set to 0xd to indicate a negative number and hex 0xc to indicate a positive number. 0 <= decimalPosition < (length * 2). Valid formats for the ASCII numeric data are as follows:

Examples:

 "   +  123\0"
 "- 123   \0"
 "     +123  \0"
 "    123\0"
 "       -12.3\0"
 "+1.23       \0"