| 
 | 
I have an application where I am reading a spooled file.  When I read the
spooled file, there is a problem with the conversion from EBCDIC to ASCII.
The problem is that there are some characters at the beginning that I do not
know why they are there.  Right now, I delete these characters manually.
The characters are in the first 23 positions.  Does anyone know of a better
way (i.e.: is there a method in a class that will take care of this)?
The way I complete the conversion is to set the system property as follows:
        System.setProperty("file.encoding", "Cp037");
I then read the spooled file and print it out to the stdout on the PC.  I
will be processing the lines later, but for now I am only writing it to the
stdout.  The method to read and write the is as follows:
    public void printSpooledFile() {
        InputStreamReader isr = new
InputStreamReader(this.getSpooledFileBufferedInputStream());
        BufferedReader br = new BufferedReader(isr);
        String readline;
        try {
            while ( (readline = br.readLine()) != null) {
                String printline = null;
                // delete characters in the beginning
                if (readline.length() > 22) {
                    printline = readline.substring(22, readline.length());
                } else {
                    printline = readline;
                }
                System.out.println("Line: " + printline);
            }
        } catch (IOException e) {
        }
    }
Thanks!!
Mike
=======================================
Mike Silvers
Senior Programmer/Analyst
IBM Certified Expert
Hainey Business Systems
Main Office:  (717) 718-9601 ext 237
Branch Office:  (410) 901-9015
http://www.hbs-inc.com
=======================================
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.