Just to be complete on this, the conversion api's are:
numeric to base n where n is 2-36
itoa Int(5) ExtProc('__itoa')
ltoa Int(10) ExtProc('__ltoa')
ultoa Uns(10) ExtProc('__ultoa')
base n to numeric where n is 2-36
strtol Int(10) ExtProc('strtol')
strtoul Uns(10) ExtProc('strtoul')
strtoll Int(20) ExtProc('strtoll')
Note they don't match up exactly. There is no strtoi, and there is no lltoa. These will produce numbers corresponding to the example data provided by the OP, but will not have leading zeros as hypothesized by John. Numbers produced in this way will not sort as expected because EBCDIC sorts alphas before numerics, unless they are downloaded to a spreadsheet and sorted there because ASCII sorts numbers before alphas, and even then the sort order may not be as expected because leading zeros are not prodeuced by these functions.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----"Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx> wrote: -----
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
From: "Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx>
Date: 06/18/2015 12:39PM
Subject: Re: Re: The case of outnumbered numerator
itoa follows the format used by hexadecimal notation. That is the typical numerical notation. In either case he won't be able to maintain numerical sequence as you would expect since the sequence would be a, b, ..., z, aa, ab, ..., az, ..., za, zb, ..., zz, aaa, aab, ..., aaz, ..., but the sorted sequence would be a, aa, aaa, ..., unless you made leading blanks significant, and then you would always have an issue with how the keys were typed for searching.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----Ken Sims <mdrg8066@xxxxxxxxxxx> wrote: -----
To: midrange-l@xxxxxxxxxxxx
From: Ken Sims <mdrg8066@xxxxxxxxxxx>
Date: 06/18/2015 10:50AM
Subject: Re: The case of outnumbered numerator
On Thu, 18 Jun 2015 09:06:43 -0400, "Mark Murphy/STAR BASE Consulting
Inc." <mmurphy@xxxxxxxxxxxxxxx> wrote:
I have done this using the C library function itoa() pass in an integer value and a base (base 36 will give 0-9 and A-Z). You can search google for usage documentation.
Does this function do 0-9 followed by A-Z or A-Z followed by 0-9?
I suspect that it is likely to be the former, but Gad needs the latter
to maintain the current ordering.
Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.
As an Amazon Associate we earn from qualifying purchases.