× 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.



I've solved this with this not so elegant solution: As you can see, I
basically reading the data as ByteArray and does the EBCDIC coversion if
the os.name = OS/400.

private static List<String> readStdio(InputStream is) throws
Exception {

BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
List<String> rs = null;

int result = bis.read();
while(result != -1) {
byte b = (byte)result;
bao.write(b);
result = bis.read();
}

String str;
if (System.getProperty("os.name").equals("OS/400"))
str = bao.toString("Cp037");
else
str = bao.toString();

rs = new ArrayList<String>(Arrays.asList(str.split("\n")));

return rs;
}


"hockchai Lim" <lim.hock-chai@xxxxxxxxxxxxxxx> wrote in message
news:<mailman.3218.1253552449.1811.java400-l@xxxxxxxxxxxx>...
I've created a class that will use the Runtime.getRuntime().exec to
execute
a command on iseries when instantiated. Once the command is
sucessfully
executed, it then reads the Process.getInputStream() to get the
result.

I've found that reading of the Process.getInputStream() works fine if
the
class is instatiated from a PC. However, it failed to read
Process.getInputStream() data correctly when the class is instatiated
from
iseries. I then added some codes the print the read result in hex and,

appearantly, when the class is instantiate from iseries, the result is
sent
back in EBCDIC encoding format and the BufferedReader is attempting to
read
it as ASCII. Well, that ain't going to work :(.

Has anyone encountered this problem before? How can I resolve this so
that
this class can be run on both iseries and PC?







As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.