× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The array is zero based so it's 0-499 with a length of 500.

What if you try this way:

//Fill w/random values
new Random().NextBytes(ebcdicBytes);

//Set some specific values...
ebcdicBytes[22] = 0; //null
ebcdicBytes[23] = 0x40; //space
ebcdicBytes[24] = 0xf1; //#1
ebcdicBytes[25] = 0xd9; //letter 'R'
ebcdicBytes[26] = 0x6f; //question mark '?'
ebcdicBytes[115] = 0; //another null
ebcdicBytes[116] = 0x97; //letter 'p'

//Convert to ascii
byte[] asciiBytes = Encoding.Convert(
Encoding.GetEncoding(37),
Encoding.ASCII,
ebcdicBytes);

Encoding source = Encoding.GetEncoding(37)'///EBCDIC encoding.
Encoding path = Encoding.ASCII
Byte[] b = ebcdicBytes
Byte[] aB = Encoding.Convert(source, path, b)

Console.WriteLine(path.GetString(aB))



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Walden H. Leverich
Sent: Friday, June 26, 2009 9:19 AM
To: Midrange Systems Technical Discussion
Subject: RE: API: cwbOBJ_ReadSplF

Been a (long) while since I dealt w/VB or unmanaged, but in
iSeriesDotNet.TryObjList() why do you size bbBuffer to chunkToRead-1
instead of chunkToRead? Doesn't that result in a 499 byte array? Don't
think that would cause the problem, but maybe? Are you getting back all
500 bytes in the array from the i?

As for the convert, it definitely has no problem w/nulls. Try this:

static void Main(string[] args)
{
byte[] ebcdicBytes = new byte[200];

//Fill w/random values
new Random().NextBytes(ebcdicBytes);

//Set some specific values...
ebcdicBytes[22] = 0; //null
ebcdicBytes[23] = 0x40; //space
ebcdicBytes[24] = 0xf1; //#1
ebcdicBytes[25] = 0xd9; //letter 'R'
ebcdicBytes[26] = 0x6f; //question mark '?'
ebcdicBytes[115] = 0; //another null
ebcdicBytes[116] = 0x97; //letter 'p'

//Convert to ascii
byte[] asciiBytes = Encoding.Convert(
Encoding.GetEncoding(37),
Encoding.ASCII,
ebcdicBytes);

Debug.Assert((char)asciiBytes[23] == ' ');
Debug.Assert((char)asciiBytes[24] == '1');
Debug.Assert((char)asciiBytes[25] == 'R');
Debug.Assert((char)asciiBytes[26] == '?');
Debug.Assert((char)asciiBytes[116] == 'p');

}


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.