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


  • Subject: Re: Dealing with AS/400 text file io
  • From: MaradyPrak@xxxxxxxxxxxx
  • Date: Thu, 10 May 2001 06:13:54 -0400


Thank you


Marady Prak - Technical Support Specialist
300 Phillipi Road
P.O. Box 28512
Columbus, OH 43228
Phone: 614-278-7186
Fax: 614-278-4769
Email: mprak@biglots.com
Pager: 877-282-3426 PIN 6143956967



                                                                                
                                        
                    "Dave Wall"                                                 
                                        
                    <dawall@us.ibm.com        To:     JAVA400-L@midrange.com    
                                        
                    >                         cc:                               
                                        
                    Sent by:                  Subject:     Re: Dealing with 
AS/400 text file io                         
                    owner-java400-l@mi                                          
                                        
                    drange.com                                                  
                                        
                                                                                
                                        
                                                                                
                                        
                    05/09/2001 11:21                                            
                                        
                    AM                                                          
                                        
                    Please respond to                                           
                                        
                    JAVA400-L                                                   
                                        
                                                                                
                                        
                                                                                
                                        





Note IFSFileInputStream and IFSFileOutputStream extend their java.io
counterparts.  This makes it possible to use java.io buffers and readers
with Toolbox classes.  For example,

         AS400 system = new AS400();
         IFSFileOutputStream outputStream = new IFSFileOutputStream(system,
"/daw.temp");
         PrintWriter writer = new PrintWriter(outputStream);

         for (int i=0; i<10; i++)
         {
            writer.println("Hello Java");
         }
         writer.flush();

         IFSFileInputStream inputStream = new IFSFileInputStream(system,
"/daw.temp");
         InputStreamReader  inReader = new InputStreamReader(inputStream);
         BufferedReader reader = new BufferedReader(inReader);

         String text = reader.readLine();
         while (text != null)
         {
            System.out.println(text);
            text = reader.readLine();
         }


But, there is one hole in our support that we have on our todo list to fix.
We have InputStream and OutputStream objects that convert text between the
ccsid of data stored in the file and Unicode.  For example, if the file
contains ebcdic data you can use IFSTextFileInputStream to read that file.
The class will automatically convert data from ebcdic to unicode and stuff
the data in a String object.  Don't see an obvious way to hook up an
IFSTextFileOutputStream with a buffered reader.  It will compile but I
think the reader will call the method that gets bytes, not Strings.
Getting bytes will get the raw ebcdic data, not the converted unicode
strings.  Maybe your text is not in ebcdic so you don't care but I wanted
to point this out just in case.  A way around this problem (if the file is
small) is to read the entire file into a single String object, then create
a StringReader over the String.  Hope this helps,

David Wall
AS/400 Toolbox for Java


MaradyPrak@cnstores.com@midrange.com on 05/09/2001 06:10:42 AM

Please respond to JAVA400-L@midrange.com

Sent by:  owner-java400-l@midrange.com


To:   JAVA400-L@midrange.com
cc:
Subject:  Re: Dealing with AS/400 text file io




It is a text file on IFS.  I tried to use IFSFile,IFSFileInputStream,
IFSFileOutputStream, etc. but there isn't a readLine() method in these
classes.  I want to be able to read one line at a time.  With IFS file
access classes above, you can only read for a specific amount of byte at a
time not per line basis.


Marady Prak - Technical Support Specialist
300 Phillipi Road
P.O. Box 28512
Columbus, OH 43228
Phone: 614-278-7186
Fax: 614-278-4769
Email: mprak@biglots.com
Pager: 877-282-3426 PIN 6143956967




                    "Dave Wall"
                    <dawall@us.ibm.com        To:
JAVA400-L@midrange.com
                    >                         cc:
                    Sent by:                  Subject:     Re: Dealing with
AS/400 text file io
                    owner-java400-l@mi
                    drange.com


                    05/08/2001 01:50
                    PM
                    Please respond to
                    JAVA400-L







What type of file are you reading from?

(1) If from a stream file in the integrated file system and on the AS/400
use java.io.*.  If on a client try the Toolbox IFS classes (IFSFile,
IFSFileInputStream, IFSFileOutputStream, etc.).  They work just like the
java.io classes.

(2) If reading from a database file use JDBC or Toolbox record-level
database access.

David Wall
AS/400 Toolbox for Java


MaradyPrak@cnstores.com@midrange.com on 05/08/2001 11:58:42 AM

Please respond to JAVA400-L@midrange.com

Sent by:  owner-java400-l@midrange.com


To:   JAVA400-L@midrange.com
cc:
Subject:  Dealing with AS/400 text file io



What is the equivalent technique to read a record in AS400 Toolbox like the
java.io. readLine() method?


Marady Prak - Technical Support Specialist
300 Phillipi Road
P.O. Box 28512
Columbus, OH 43228
Phone: 614-278-7186
Fax: 614-278-4769
Email: mprak@biglots.com
Pager: 877-282-3426 PIN 6143956967


+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---



+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---




+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---



+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---




+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.