Packing/Unpacking Rexx UNICODE strings to a sequence of Bytes.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Packing/Unpacking Rexx UNICODE strings to a sequence of Bytes.

Thomas.Schneider.Wien
Hello there,

for my current efforts to access IBM Datasets (on the Mainframe) thru Java,
I do have the need to PACK/UNPACK so called STRUCTURES (I do call them
RECORDs (Level 1) and GROUPS (Level > 1), from their NetRexx
representation to the more widely used IBM Mainframe representation.

In Order to do so, I did add a class ReyBytes to my run-time package.

Obviously, ReyBytes will transform Rexx Strings to a sequence of ASCII
bytes, occupying only 1 byte by character.

Now, my question:

Has anybody of you already an EBC2ASC (EBCDIC to ASCII) and/or ASC2EBC
(ASCII to EBCDIC) conversion Routine ready, returning also
a return Code>0  when characters NOT representable in a single byte have
been used.

Also, I'm still curios, as Java does have no UNSIGNED BYTE, whether I can
use a NetRexx BYTE to represent an EBCDIC character directly.

Pls. respond directly to me, when this discussion is not wanted/needed
on IBM-NetRexx :-)

Thomas.

--
Thomas Schneider Projects PP, ReyC, and LOGOS on www.KENAI.com
www.thsitc.com
_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)
Reply | Threaded
Open this post in threaded view
|

Re: Packing/Unpacking Rexx UNICODE strings to a sequence of Bytes.

Hugh Sweeney
Hello Thomas,

I don't understand all of your questions exactly, but here are some comments. I hope they are helpful.


On Tue, Dec 14, 2010 at 6:40 PM, Thomas Schneider <[hidden email]> wrote:
Hello there,

for my current efforts to access IBM Datasets (on the Mainframe) thru Java,
I do have the need to PACK/UNPACK so called STRUCTURES (I do call them
RECORDs (Level 1) and GROUPS (Level > 1), from their NetRexx representation to the more widely used IBM Mainframe representation.

In Order to do so, I did add a class ReyBytes to my run-time package.

Obviously, ReyBytes will transform Rexx Strings to a sequence of ASCII
bytes, occupying only 1 byte by character.

Now, my question:

Has anybody of you already an EBC2ASC (EBCDIC to ASCII) and/or ASC2EBC (ASCII to EBCDIC) conversion Routine ready, returning also
a return Code>0  when characters NOT representable in a single byte have been used.

I know that you are aware (more than many on the ibm-netrexx list) of  several natural languages so maybe you are already aware of this fact: there were many different versions called EBCDIC, for different national languages. Do you need to handle all of these? If not, I suppose you are dealing with Code Page 1047, called "de facto EBCDIC". I have some old code that I could dig out that converts between ASCII and CP1047, mostly written in C but also one in Rexx. (None of my code though handles multi-byte characters, as they don't occur in CP1047 or ASCII.) Or you could probably find freely available code elsewhere, such as: https://encrypted.google.com/search?q=rexx+ebcdic+ascii+conversion&btnG=Search&hl=en&biw=1408&bih=873&sa=2.

Also, EBCDIC has a cent sign, which ASCII doesn't, and EBCDIC doesn't have square brackets, which ASCII has.



Also, I'm still curios, as Java does have no UNSIGNED BYTE, whether I can
use a NetRexx BYTE to represent an EBCDIC character directly.

I'm not sure what you mean by "directly", but as the Java byte type can hold any integer from -128 to 127, then any EBCDIC value can be represented by a number in a byte.


Pls. respond directly to me, when this discussion is not wanted/needed
on IBM-NetRexx :-)

Thomas.

I wrote software for IBM mainframes with various operating systems for many years. I'm curious, which type of IBM Datasets on which operating system are you dealing with?

Regards,
Hugh
--

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Packing/Unpacking Rexx UNICODE strings to a sequence of Bytes.

rickmcguire
In reply to this post by Thomas.Schneider.Wien
The String getBytes() method with a code page of "CP1047" will return
the bytes translated to the EBCDIC Latin-1 character set.  The String
class has a constructor that will allow the reverse transformation.
This does not do any validation, however.

The CharsetEncoder and CharsetDecoder classes allow more fine-grained
control over the transformations.

Rick

On Tue, Dec 14, 2010 at 1:40 PM, Thomas Schneider <[hidden email]> wrote:

> Hello there,
>
> for my current efforts to access IBM Datasets (on the Mainframe) thru Java,
> I do have the need to PACK/UNPACK so called STRUCTURES (I do call them
> RECORDs (Level 1) and GROUPS (Level > 1), from their NetRexx representation
> to the more widely used IBM Mainframe representation.
>
> In Order to do so, I did add a class ReyBytes to my run-time package.
>
> Obviously, ReyBytes will transform Rexx Strings to a sequence of ASCII
> bytes, occupying only 1 byte by character.
>
> Now, my question:
>
> Has anybody of you already an EBC2ASC (EBCDIC to ASCII) and/or ASC2EBC
> (ASCII to EBCDIC) conversion Routine ready, returning also
> a return Code>0  when characters NOT representable in a single byte have
> been used.
>
> Also, I'm still curios, as Java does have no UNSIGNED BYTE, whether I can
> use a NetRexx BYTE to represent an EBCDIC character directly.
>
> Pls. respond directly to me, when this discussion is not wanted/needed
> on IBM-NetRexx :-)
>
> Thomas.
>
> --
> Thomas Schneider Projects PP, ReyC, and LOGOS on www.KENAI.com
> www.thsitc.com
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Packing/Unpacking Rexx UNICODE strings to a sequence of Bytes.

Thomas.Schneider.Wien
Hello Rick,

    *many thanks* for your advise :-)

Have a nice X-mas, all of you anyway...

Thomas Schneider.
========================================================
Am 14.12.2010 23:19, schrieb Rick McGuire:

> The String getBytes() method with a code page of "CP1047" will return
> the bytes translated to the EBCDIC Latin-1 character set.  The String
> class has a constructor that will allow the reverse transformation.
> This does not do any validation, however.
>
> The CharsetEncoder and CharsetDecoder classes allow more fine-grained
> control over the transformations.
>
> Rick
>
> On Tue, Dec 14, 2010 at 1:40 PM, Thomas Schneider<[hidden email]>  wrote:
>> Hello there,
>>
>> for my current efforts to access IBM Datasets (on the Mainframe) thru Java,
>> I do have the need to PACK/UNPACK so called STRUCTURES (I do call them
>> RECORDs (Level 1) and GROUPS (Level>  1), from their NetRexx representation
>> to the more widely used IBM Mainframe representation.
>>
>> In Order to do so, I did add a class ReyBytes to my run-time package.
>>
>> Obviously, ReyBytes will transform Rexx Strings to a sequence of ASCII
>> bytes, occupying only 1 byte by character.
>>
>> Now, my question:
>>
>> Has anybody of you already an EBC2ASC (EBCDIC to ASCII) and/or ASC2EBC
>> (ASCII to EBCDIC) conversion Routine ready, returning also
>> a return Code>0  when characters NOT representable in a single byte have
>> been used.
>>
>> Also, I'm still curios, as Java does have no UNSIGNED BYTE, whether I can
>> use a NetRexx BYTE to represent an EBCDIC character directly.
>>
>> Pls. respond directly to me, when this discussion is not wanted/needed
>> on IBM-NetRexx :-)
>>
>> Thomas.
>>
>> --
>> Thomas Schneider Projects PP, ReyC, and LOGOS on www.KENAI.com
>> www.thsitc.com
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>>


--
Thomas Schneider Projects PP, ReyC, and LOGOS on www.KENAI.com
www.thsitc.com
_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)