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