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



   Dear All,

   I had been trying to work out a code= which will help me extract the spool
   file from a AS/400 and send it to use= rs as an attachement.

   The problem is that I'm not getting = the write input bytes to store in
   human readable format.

   I know I am surely going in wrong di= rection but not able to locate the
   mistake. I am pasting the method code fo= r judging it.

   public String readFile(= String _AS400, String _UserName, String
   _Password, String _SpoolFileName, S= tring _SpoolFileNumber,
         &n= bsp;                     = String _SpoolFileJobName, String
   _SpoolFileUserName, String _SpoolFileJobNu= mber )
         &n= bsp;                     = throws AS400SecurityException,
   AS400Exception,IOException, ErrorCompletingR= equestException,
         &n= bsp;                     =              InterruptedException,
   Reque= stNotSupportedException  {
         &n= bsp;
         &n= bsp; String strConvertedFile="";
         &n= bsp; try{
         &n= bsp;     AS400 objAS400 = new
   AS400(_AS400,_UserName,_Password)= ;
         &n= bsp;     SpooledFile objSpoolFile = new SpooledFile(objAS400,
   &= nbsp;_SpoolFileName,
         &n= bsp;                     =                     &nbsp= ;
             Integer.pa= rseInt(_SpoolFileNumber),  _SpoolFileJobName ,
         &n= bsp;                     =                     &nbsp= ;
          _SpoolFileUserName= ,  _SpoolFileJobNumber );

         &n= bsp;     System.out.println("Got Spool File Object");</= font>
         &n= bsp;     System.out.println("The CCSID : "+ objAS400.ge   
tCcsid()+ "   " + objAS400.getUserId());
         &n= bsp;     System.out.println(">>>Object : "+obj   
SpoolFile.toString());
         &n= bsp;
         &n= bsp;     java.io.InputStream objInputStream =
   objSpoolFile.getI= nputStream();
         &n= bsp;
         &n= bsp;     int intInputStreamSize = objInputStream.available();
   &= nbsp;
         &n= bsp;     byte[] objSpoolByte = new
   byte[intInputStreamSize];</f= ont>
         &n= bsp;     System.out.println("The Spool byte size : "+ i   
ntInputStreamSize);
         &n= bsp;     objInputStream.read(objSpoolByte);
         &n= bsp;
         &n= bsp;     System.out.println("THE CONTENT >>>>&qu= ot;);
         &n= bsp;     for(int i = 0; i < intInputStreamSize; i++){
         &n= bsp;         System.out.print(""+objSpoolByte[i]);</fon= t>
         &n= bsp;     }
         &n= bsp;     System.out.println("<<<<<<<&lt= ;<<<<<<<<<THE
   CONTENT");

         &n= bsp;     System.out.write(objSpoolByte);         </font= >

         &n= bsp;     AS400Text textConverter = new
   AS400Text(intInputStream= Size,objAS400);
         &n= bsp;     strConvertedFile = ((String) textConverter.toObject   
(objSpoolByte));
         &n= bsp;     objInputStream.close();
         &n= bsp;     objAS400.disconnectAllServices();       &= nbsp;
         &n= bsp; }catch(Exception ex){
         &n= bsp;     System.err.println("Exception from ReadFile : &quot   
;+ex.toString());
         &n= bsp; }
         &n= bsp; return st= rConvertedFile;        }
   ____________________________________   
___________________________________________________________________________   
___________

   The outputs are :

   The Spool byte size : 7712

   The output as a result of for= loop:
   THE CONTENT >&= gt;>>
   00000000000000052= -607052-6413-39-55-24-63-60-5664
   - - - - - - More = bytes like the above - - - - - - (So save e-mail size
   removed them )</f= ont>
   6423-560212121052= -649-61-28-390910910912<<<<<<<<<<<<<= <<<<THE CONTENT

   Out put as result of System.out.w= rite() :
   ôkòôókóõ   ùKðô4   
À@@@@@@@@4À@@@@@@@@4À@@@@@@@@4À@@@@@@@@4À   
@@@@@@@@4À@@@@@@@@4À@@@@@@@@4À@@@@@@@@4À   
mmmmmmmm4Àmmmmmmmm4À@@@@@@@@4À@@@@@@@@4À@@@@@@   
@@4Àmmmmmmmm4Àmmmmmmmm4Àmmmmmmmm4Àmmmmmmmm4À   
mmmmmmmm4Àmmmmmmmm4Àmmmmmmmm4ÀmmmmmmmmThe Result
   St= ring is : øKôð4À
   4ÈâÅÒ4ÈókõöôK÷ñ   4À@@@@@@@@   
4À@@@@@@@@4À@@@@@@@@4À@@@@@@@@4À@@@@@@@@4   
À@@@@@@@@4À@@@@@@@@4À@@@@@@@@4Àmmmmmmmm4À   
mmmmmmmm4À@@@@@@@@4À@@@@@@@@4Àmmmmmmmm4Àmmmmmm   
mm4À@@@@@@@@4Àmmmmmmmm4Àmmmmmmmm4Àmmmmmmmm4À   
mmmmmmmm4Àmmmmmmmm4Àmmmmmmmm4Ä4Àm4Àmmmmmmmm4   
Ä4Àmmmmm4Àmmmmmmmm4Àmmmmmmmm4Ä4À

   Out put as result of System.out.p= rintln(strConvertedFile) :
   4,243,359.04????????= ??????????????{             ??{    =         ??{
           = ??{             ??{       &nbs= p;     ??{             ??{   &   
nbsp;         ??{           &n= bsp; ??{     ________?{      ________??{
   &n= bsp;         ??{           &nb= sp; ??{             ??{     _______   
_?{      ________??{     ________?{     =  ________??{     ________?{
    ________??{ =     ________?{      ________?{     &n= bsp;       ??{
             ??{=             ??{         =     ??{             ??{   &nbs   p; 
________?{      ________??{         &= nbsp;   ??{             ??{
   &nbsp= ; ________?{      ________??{         &n= bsp;   ??{     ________?{
        ________??{ &n= bsp;   ________?{      ________??{     ______= __?{
      ________?D?{  ________?D?{  = ________??{     ________?{
      ________?D?{
   ____________________________________   
___________________________________________________________________________   
___________

   Can you please help me.

   I will be very grateful.

   with regards,
   Pratim

   **********************************************************************
   This E-mail is confidential. It may also be legally privileged.
   If you are not the addressee you may not copy, forward, disclose
   or use any part of it. If you have received this message in error,
   please delete it and all copies from your system and notify the
   sender immediately by return E-mail.

   Internet communications cannot be guaranteed to be timely,
   secure, error or virus-free. The sender does not accept liability
   for any errors or omissions.
   **********************************************************************

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.