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




Hi Marty,

I didn't spend a lot of time checking, but *FCFC is only the first
character, right? If so, then you want

string.substring(1)

not

string.substring(2)

to get everything after the *first* character. Remember, except for JDBC
and some Calendar craziness, Java indexes begin at zero.

CCSID 65535 has caused more grief, time, money and productivity in
certain areas than probably any other single thing I can imagine. I've
mentioned, here and other places quite a while back, my discussions with
the IBM guy in charge of I18N (Java or not) at COMMON, San Antonio (1997, I
think) about 65535 and how (to put it mildly) undesirable it was to have
that as the *default*. Obviously, I got no joy. While things have finally
changed, it was mostly dumped in our laps.

JTOpen has classes to convert EBCDIC to ASCII and vice-versa. See:
Data conversion and description at:

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rzahh/dtad.htm

While they are very helpful even when the AS/400 is not involved (like
mainframe to PC,) it's only fun the first time you do it purely for data
passing purposes.


Joe Sam

Joe Sam Shirah - http://www.conceptgo.com
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International? http://www.jguru.com/faq/I18N
Que Java400? http://www.jguru.com/faq/Java400

----- Original Message ----- From: "Urbanek, Marty" <Marty_Urbanek@xxxxxxxxxxxx>
To: <java400-l@xxxxxxxxxxxx>
Sent: Friday, November 09, 2007 11:55 AM
Subject: Re: Reading spool file with Java


Joe,

I ended up using string.startsWith to interrogate the FCFC character (I
tried doing it as a Character and a char but never got that stuff to
work) and then using string.substring(2) to send the remainder of the
string to my output.

Another problem I had was that the input data is coming from a physical
file (output from CPYSTMF) with CCSID 65535, so Java can't tell that it
is EBCDIC characters and the output is garbled. I found that by setting
file.encoding=Cp037 I can get it to work. I am reading the file using
JDBC.

I am probably doing everything in a horribly inefficient way but this
program will only run once per week to process a couple hundred lines of
print data.

Thanks,
-Marty

----------------------------------------------------------------------

date: Thu, 8 Nov 2007 18:44:01 -0500
from: "Joe Sam Shirah" <joe_sam@xxxxxxxxxxxxx>
subject: Re: Reading spool file with Java


Hi Marty,

but trying to manipulate simple bits & bytes like I do in every other
language is like pulling teeth.

Yup, with Java I can do the miraculous in half an hour, the simple
in several days. I think it has something to do with the mindset of the
PC (not exactly right but a similar group) crowd as opposed to the
midrange.
Just another piece of evidence, in my mind anyway, that PC, midrange,
mainframe all have a lot to learn from each other.

Enough philosophy, though. I think the problem of bypassing the
first character (you may actually want to bypass the first four) is
pretty simple:
use String.substring(). So:

String s2 = s1.substring( 1 );

or

String s2 = s1.substring( 3 );

and work with s2.

It's also pretty efficient because substring uses the same backing
array as the original String. Other solutions will probably create an
entirely new one, using nearly twice the memory.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.