cwbDT_ASCII11ToBin4

Use the cwbDT_ASCII11ToBin4 command.

Purpose

Translates (exactly) 11 ASCII numeric characters to a 4-byte integer stored most significant byte first. (The source string is not expected to be zero-terminated.) This function can be used for translating ASCII numeric data to the IBM i integer format.

Unicode version

cwbDT_Wide11ToBin4

Syntax

 
unsigned int CWB_ENTRY cwbDT_ASCII11ToBin4(
                             char *target,
                             char *source);

Parameters

char * target - output
Pointer to the target (4 byte integer).
char * source - input
Pointer to the source (11 byte ASCII).

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.
other
Offset of the first untranslated character plus one.

Usage

The target data will be stored with the Most Significant Byte first. This is the IBM i format that the system uses and is the opposite of the format that is used by the Intel x86 processors. Valid formats for the ASCII source data are as follows:

  • [blankspaces][sign][blankspaces][digits] or
  • [sign][blankspaces][digits][blankspaces]

Examples:

 "   +    123"
 "-    123   "
 "     +123  "
 "        123"
 "       -123"
 "+123       "