× 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: BEGINNER'S QUESTION: How to use CL commands with JAVA?
  • From: dawall@xxxxxxxxxx
  • Date: Tue, 23 Mar 1999 11:43:44 -0600

Joe, please check out the AS/400 Toolbox for Java
(http://www.ibm.com/as400/toolbox).  The Toolbox is a class library
containing Java classes written specifically to get at AS/400 stuff
(database files, data queues, user spaces, call AS/400 commands, call
AS/400 programs/APIs, print stuff (printers, writers, output queues, ...),
files in the integrated file system,  plus a whole lot more!

Here is a short program that calls the AS/400 "crtlib" command.

import java.io.*;
import java.util.*;
import com.ibm.as400.access.*;

public class CommandCallExample extends Object
{
   public static void main(String[] parmeters)
   {

      // Create an AS400 object.  This is the system we send the command to
      AS400 as400 = new AS400("myAS400);

      // Create a command call object specifying the AS/400 that will
      // recieve the command.
      CommandCall command = new CommandCall( as400 );
      try
      {
         // Run the command.
         if (command.run("crtlib newlib"))
             System.out.print( "Command successful" );
         else
             System.out.print( "Command failed" );

         // If messages were produced from the command, print them
         AS400Message[] messagelist = command.getMessageList();

         for (int i=0; i < messagelist.length; i++)
         {
            System.out.print  ( messagelist[i].getID() );
            System.out.print  ( ": " );
            System.out.println( messagelist[i].getText() );
         }
      }
      catch (Exception e)
      {
         System.out.println("unexpected exception:");
         e.printStackTrace();
      }

      System.exit(0);
   }
}

David Wall
AS/400 Toolbox for Java


---------- Forwarded message begins here ----------

From: Ioachim@aol.com
Date: Mon, 22 Mar 1999 11:12:21 EST
To: JAVA400-L@midrange.com
Subject: BEGINNER'S QUESTION: How to use CL commands with JAVA?
Content-Type: text/plain; charset=US-ASCII
Sender: owner-java400-l@midrange.com

Hello,

I would really appreciate if somebody writes for me a short program that
shows
how to use AS400 commands with JAVA. I think,  a program that would answer
most of my questions would be one that check all output queues, finds the
files with names starting with a specified prefix and sends them to a
specified output queue.

The obvious acompanying question is whether there are special classes which
do
the same as the AS400 commands.

Joe
+---
| This is the Midrange System 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/operator:
david@midrange.com
+---
+---
| This is the Midrange System 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/operator: david@midrange.com
+---


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.