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



Hi All,

I think there is some awareness of the AS400's DBU command .
This command takes file name as parameter and displays
the description.

I tried to execute this command using IBM Toolkit by the following Program

 try{
  //Constructs a AS400 objects with the given login details
  AS400 system = new AS400("IP","user","pwd"); 
  
  //Creating a CommandCall object with the parameter 'sys' whis tells the 
  //command will have to run.
  CommandCall cc = new CommandCall(system);
  cc.run("ADDLIBLE DBU60 *LAST");  
  AS400Message []ml = cc.getMessageList(); 
  for( int i=0; i<ml.length; i++){
   System.out.println(ml[i].getText());
  }
  cc.run("ADDLIBLE COMMDUP *LAST");  
  
  ml = cc.getMessageList(); 
  for( int i=0; i<ml.length; i++){
   System.out.println(ml[i].getText());
  }

  if (cc.run("DBU DBTRTT") != true){    // DBTRTT is the filename

         // If the iSeries cannot run the
         // program, look at the message list
         // to find out why it didn't run.
   System.out.println("Inside the false block");
   AS400Message[] messageList = cc.getMessageList();
   for( int i=0; i<messageList.length; i++){
    System.out.println(messageList[i].getText());
   }

   }else{
   System.out.println("2");
   System.out.println("Inside the true block");
   }
    } catch(Exception exp){
  exp.printStackTrace();
    }


Result:
The first 2 statements are getting printed on the console but I am not able to 
run the command "DBU DBTRTT" 
the program is getting hanged after printing the 2 statements.

The two statements that are showing up on the console are 
Library DBU60 added to library list.
Library COMMDUP added to library list.

I even tried in the below manner i.e, using ProgramCall 

    try{
  //Constructs a AS400 objects with the given login details
  AS400 system = new AS400("IP","user","pwd"); 
  
  ProgramCall pgm = new ProgramCall(system);
  ProgramParameter parameterList[] = new ProgramParameter[2];

  AS400Text biteArray = new AS400Text(14);
  parameterList[0] = new 
ProgramParameter(biteArray.toBytes("/QSYS.LIB/COMMDUP.LIB/DBTRTT.FILE"));
  parameterList[1] = new ProgramParameter(100);

  pgm.setProgram("/QSYS.LIB/DBU60.LIB/DBU.CMD",parameterList);
  
  System.out.println("1");
   if (pgm.run() != true){
     AS400Message[] messageList = pgm.getMessageList();
     for( int i=0; i<messageList.length; i++){
       System.out.println(messageList[i].getText());
     }
   }else{
     AS400ByteArray byteArray = new AS400ByteArray(100);
     byte[] data = parameterList[1].getOutputData();
     System.out.println("The output is "+byteArray.toObject(data).toString());
   }
  //Any message from AS400 system as a result of running the above command is 
stored.    
   } catch(IllegalPathNameException e) {
     System.out.println(e.getReturnCode());
        System.out.println(e.getMessage());
   } catch(ExtendedIllegalArgumentException ee) {
        System.out.println(ee.getReturnCode());
        System.out.println(ee.getMessage());
   } catch(Exception exp){
       exp.printStackTrace();
   }
    System.exit(0);
 }

  The result is an exception saying:
  /QSYS.LIB/DBU60.LIB/DBU.CMD The Object type is not valid.

Please let me know where I am going wrong , can I get the output of the 
DBU command.

Thanks in advance.

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.