Purpose
Translates ASCII numeric data to EBCDIC
zoned decimal format. This function can be used for translating ASCII text
data for use on the iSeries™ server.
Unicode version
cwbDT_WideToZoned
Syntax
unsigned int CWB_ENTRY cwbDT_ASCIIToZoned(
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 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. Valid formats for the ASCII numeric data are as follows:
- [blankspaces][sign][blankspaces][digits] or
- [sign][blankspaces][digits][blankspaces] or
- [sign][digits][.digits][blankspaces] or
- [blankspaces][sign][digits][.digits][blankspaces]
Examples:
" + 123\0"
"- 123 \0"
" +123 \0"
" 123\0"
" -12.3\0"
"+1.23 \0"