| 
 | 
Can anybody suggest, what modifications I need to make to the following
program so that it works.
Please help.
Sandeep.
*************** QSYSTest.java ********************
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.Thread.*;
import com.ibm.as400.access.*;
public class QSYSTest extends Object
{
   public static void main(String[] parameters)
   {
                System.out.println( " " );
                Trace.setTraceErrorOn(true);          // Enable error
messages
                Trace.setTraceWarningOn(true);        // Enable warning
messages
                Trace.setTraceOn(true);               // Turn trace on for
all
                // if a system was not specified, display help text and
exit.
                if (parameters.length >= 1)
                {
                 try
                 {
                        // Create an AS400 object for the server that
contains the
                        // program.  Assume the first parameter is the
system name.
                        AS400 as400 = new AS400(parameters[0],
parameters[1], parameters[2]);
                                    System.out.println("parameters[0] :" +
parameters[0]);
                                    System.out.println("parameters[1] :" +
parameters[1]);
                                    System.out.println("parameters[2] :" +
parameters[2]);
                        /*
                        if (as400.authenticate(parameters[1],
parameters[2]))
                        System.out.println("Authenticated");
                        else
                        System.out.println("Could not Authenticate");
                        */
                        // Create the path to the program.
                        QSYSObjectPathName programName = new
QSYSObjectPathName("QSYS",
        
"QWCRSSTS",
        
"PGM");
                        String ifsfileformat = programName.getPath();
                        System.out.println(ifsfileformat);
                        IFSFile mfile = new IFSFile(as400, ifsfileformat);
                        //String directory = file.getParent();
                        String name = mfile.getName();
                        System.out.println(name);
                        // Determine the parent directory of the file.
                        String directory = mfile.getParent();
                        System.out.println("dir is : " + directory);
                        // Determine the file size.
                        long length = mfile.length();
                        System.out.println("length is : " + length);
                        if (mfile.exists())
                        System.out.println("File exists");
               // This program is done running program so disconnect from
               // the command server on the server.  Program call and
command
               // call use the same server on the server.
            as400.disconnectService(AS400.COMMAND);
         }
         catch (Exception e)
         {
            // If any of the above operations failed say the program failed
            // and output the exception.
            System.out.println("Program call failed");
            System.out.println(e);
         }
      } // if
      System.exit(0);
   }
}
************* Program Output ***********************
Toolbox for Java - Open Source Software, JTOpen 4.1, codebase 5722-JC1
V5R3M0
parameters[0] :10.10.10.188
parameters[1] :antonio
parameters[2] :dao30dao
/QSYS.LIB/QWCRSSTS.PGM
QWCRSSTS.PGM
dir is : /QSYS.LIB
Fri Dec 05 15:13:24 PST 2003  Signon server exchange client/server
attributes fa
iled:
java.net.SocketException: Connection aborted by peer: JVM_recv in socket
input s
tream read
        at java.net.SocketInputStream.socketRead(Native Method)
        at java.net.SocketInputStream.read(Unknown Source)
        at
com.ibm.as400.access.DataStream.readFromStream(DataStream.java:48)
        at
com.ibm.as400.access.SignonExchangeAttributeRep.read(SignonExchangeAt
tributeRep.java:83)
        at
com.ibm.as400.access.AS400ImplRemote.signonConnect(AS400ImplRemote.ja
va:1859)
        at
com.ibm.as400.access.AS400ImplRemote.signon(AS400ImplRemote.java:1747
)
        at com.ibm.as400.access.AS400.sendSignonRequest(AS400.java:2492)
        at com.ibm.as400.access.AS400.promptSignon(AS400.java:1938)
        at com.ibm.as400.access.AS400.signon(AS400.java:3159)
        at com.ibm.as400.access.AS400.connectService(AS400.java:783)
        at com.ibm.as400.access.IFSFile.chooseImpl(IFSFile.java:485)
        at com.ibm.as400.access.IFSFile.length0(IFSFile.java:1660)
        at com.ibm.as400.access.IFSFile.length(IFSFile.java:1686)
        at QSYSTest.main(QSYSTest.java:55)
Program call failed
java.net.SocketException: Connection aborted by peer: JVM_recv in socket
input s
tream read
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.