Using java to add, delete AS400 file members

Caling all Jav/AS400 gurus!! I have developed a J2ee application that goes against the AS400 database. I am able to create and delete physical and logical file members using the following code:
//create new file member
public String addPhysicalMember(
     String fName,
     String member,
     String libName,
     String errMsg,
     String callCommand,
     String vendParm) {
          callCommand = "ORDPMBRJVA";
          fName = "ORDER ";
     CommandCall callComm = new CommandCall();
     AS400 sys = new AS400("AS400", "guest", "guest");
     if (vendParm.equals("9999")) {
          try {
          callComm =
                    new CommandCall(
                         sys,
                         "CALL BIGY/"
                              + callCommand
                              + " PARM('"
                              + fName
                              + "' '"
                              + member
                              + "' '"
                              + libName
                              + "' '"
                              + errMsg
                              + "')");
                                             callComm.run();
               // Show the messages (returned whether or not there was an error)
               AS400Message[] messagelist = callComm.getMessageList();
               for (int i = 0; i < messagelist.length; ++i) {
                    // Show each message
                    System.out.println(messagelist.getText());
          } catch (Exception e) {
               System.out.println("Command " + callComm.getCommand() + " did not run!");
     // done with the system
     sys.disconnectService(AS400.COMMAND);
     return errMsg;
//create new logical member
public String addLogicalMember(
     String fName,
     String member,
     String libName,
     String errMsg,
     String callCommand,
     String vendParm) {
     CommandCall callComm = new CommandCall();
     AS400 sys = new AS400("AS400", "guest", "guest");
     if (vendParm.equals("9999")) {
          try {
               callComm =
                    new CommandCall(
                         sys,
                         "CALL BIGY/"
                              + callCommand
                              + " PARM('"
                              + fName
                              + "' '"
                              + member
                              + "' '"
                              + libName
                              + "' '"
                              + errMsg
                              + "')");
                                             callComm.run();
               // Show the messages (returned whether or not there was an error)
               AS400Message[] messagelist = callComm.getMessageList();
               for (int i = 0; i < messagelist.length; ++i) {
                    // Show each message
                    System.out.println(messagelist[i].getText());
          } catch (Exception e) {
               System.out.println("Command " + callComm.getCommand() + " did not run!");
     // done with the system
     sys.disconnectService(AS400.COMMAND);
     return errMsg;
I delete the file members the same way, basically, I have a similar method that calls a different AS400 command.
I check to AS400 to make sure the members (both physical and logical)have been deleted. The are deleted. However, when I go to use that member name again, my program blows up with the error message "member name already exists." For the user's sake, they need to reuse the member file names over.
When I run the commands on the AS400, they work each time without fail, creating and deleting the same member as often as desired. Is there something missing from my code? Any help you can give me is greatly appreciated.
Thanks, jlav143

I check to AS400 to make sure the members (both physical and logical)have been deleted. The are deleted. However, when I go to use that member name again, my program blows up with the error message "member name already exists." For the user's sake, they need to reuse the member file names over.It looks like your "checking" isn't very accurate, then. But I can't comment on your code for removing members because I can't see the commands you are using -- and it looks sort of like you're calling your own CL program to do that anyway. Why don't you just clear the members instead of deleting them and then adding them back?

Similar Messages

  • Despite my best efforts, I am unable to remove iTunes 11.1.4 from my PC, this being made necessary because the original installation had a flaw and did not load properly. Effor to use the control panel, deleting dll. files, etc. all failed. iTune out??

    Despite my best efforts, I am unable to remove iTunes 11.1.4 from my PC, this being made necessary because the original installation had a flaw and did not load properly. Effor to use the control panel, deleting dll. files, etc. all failed. And, of course, on startup, a window opens with the error and tells me find QTMovie.dll and delete it because this may be the source of the hangup. Also, in trying to delete iTunes, I get the additional message that I must get approval from the System Administrator to take this action. I am the System Administrator.
    Any ideas would be welcomed.
    Thank you.
    James
    <E-mail Edited by Host>

    Thank you for asking this question.  I'm having the same issues. 
    Liz

  • Using java to call a text file

    I am new to java and was wondering if there is a way of using java to call a text file on my server and use it to create a webpage using a template. Namely to click a link to a poem, and have the java automatically create a page from a text file of the poetry. I need to know if this is even possible, what I would need to look into, (IE: which software or applet to look for), and if there are any sites that anyone knows about that I could learn how to do this. currently I am having to create a page for every poem posted on my site, which takes a great deal of time, and I would like to speed the process up a bit if it is possible. Any suggestions would be greatly appreciated.

    Why a text file? I don't think it is a best practice of doing that. Just use a database, keep your poem collections there, and set up a jsp page that seek the database, and then display it on another jsp page. I guess you can find similar application in the sample projects provided by JSC.

  • Drive no longer being used by time machine: delete some files?

    Tried unlocking and allowing myself to read and write.  Nope.  Tried holding down the option key.  Nope.
    This drive is no longer being used by time machine and I want to delete some files on it.
    Is there a way to do it without wiping the entire drive?

    nowsthetime wrote:
    It wasnt a dedicated backup and  there's other material on it that I need to keep.
    That's a problem (as you've discovered).  Time Machine works best if it has it's own, exclusive partition.   See Time Machine - Frequently Asked Question #3 for details.
    Aha!  Just found THIS. I'll post if it works. http://www.celiamania.com/wordpress/?p=1038
    That will let you delete individual backups, or all backups of selected items.
    If you don't have room to copy the "other" stuff elsewhere while you erase the disk, you can delete the Backups.backupdb folder.  Emptying the trash will take a very long time, and may give you permissions and/or locked file problems.  If so, see #E6 in Time Machine - Troubleshooting.

  • Process with RenderPDFForm using Java API not generating output file

    I have a short-lived process that renders a PDF/HTML form based on input parameters. It also takes a .xdp file as input. This works just fine from with
    in Workbench (9.0). I have created a Java client to invoke this process. When I invoke the process from the Java Client,
    it is not creating the output file. When I look at the invocation response, I see the output parameter (output file) name, but it is null.
    Here is my code.
    Properties connectionProps =
    new Properties(); 
    connectionProps.setProperty(
    "DSC_DEFAULT_SOAP_ENDPOINT", "http://hostname:8080");connectionProps.setProperty(
    "DSC_TRANSPORT_PROTOCOL","SOAP"); 
    connectionProps.setProperty(
    "DSC_SERVER_TYPE", "JBoss"); 
    connectionProps.setProperty(
    "DSC_CREDENTIAL_USERNAME", "username"); 
    connectionProps.setProperty(
    "DSC_CREDENTIAL_PASSWORD", "password"); 
    //Create a ServiceClientFactory object
    ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
    //Create a ServiceClient object
    ServiceClient myServiceClient = myFactory.getServiceClient();
    //Create a Map object to store the parameter value
    Map params =
    new HashMap();
    File file =new File("C:/test1/test.xdp");File ofile =
    new File("C:/TestProcess.pdf"); 
    //String formName = "RD410-4.xdp";
    InputStream inFile =new FileInputStream(file);OutputStream oFileStream =
    new FileOutputStream(ofile); 
    byte[] cData = "".getBytes(); 
    Document inputData =
    new Document(inFile); 
    // Document outputData = new Document(oFileStream);
    inputData.passivate();
    params.put("Form", inputData);params.put(
    "FormId", "12");params.put(
    "RevId", "12");params.put(
    "OutputType", "PDF");params.put(
    "targetSubmission", "http://localhost:8090/LCWebProject/HandleData");params.put(
    "param1",1);
    InvocationRequest invokeRequest = myFactory.createInvocationRequest(
    "MyApplication10/Processes/RenderForm", //Specify the short-lived process name
    "invoke", //Specify the operation name
    params,
    //Specify input values
    true); //Create a synchronous request
    InvocationResponse invokeresponse = myServiceClient.invoke(invokeRequest);
    Document encryptDoc = (Document) invokeresponse.getOutputParameter("outputFile"); 
    //Save the encrypted PDF document returned by the process
     //Save the password-encrypted PDF document
    File outFile =new File("C:\\test1.pdf");encryptDoc.copyToFile (outFile);
    I see the output parameter "outputFile" in the invokeresponse object. But it is null.
    Can anyone guide me in the right direction ?
    Thanks,
    Jyothi

    I am not giving the solution, providing you a hint..
    This is the query you need to satisfy,
    SELECT NVL(R.DESCRIPTION ,CP.USER_CONCURRENT_PROGRAM_NAME)
    FROM FND_CONCURRENT_REQUESTS R, FND_CONCURRENT_PROGRAMS_VL CP,XDO_DS_DEFINITIONS_B XDS
    WHERE ( ( FND_PROFILE.VALUE('CONC_REPORT_ACCESS_LEVEL') = 'U'
    AND R.REQUESTED_BY = :$PROFILES$.USER_ID ) or
    ( FND_PROFILE.VALUE('CONC_REPORT_ACCESS_LEVEL') = 'R'
    AND R.RESPONSIBILITY_ID = :$PROFILES$.RESP_ID ) )
    AND R.PROGRAM_APPLICATION_ID = CP.APPLICATION_ID
    AND R.CONCURRENT_PROGRAM_ID = CP.CONCURRENT_PROGRAM_ID
    AND XDS.APPLICATION_SHORT_NAME=
    ( SELECT APPLICATION_SHORT_NAME
    FROM FND_APPLICATION
    WHERE APPLICATION_ID=CP.APPLICATION_ID)
    AND XDS.DATA_SOURCE_CODE = CP.CONCURRENT_PROGRAM_NAME
    AND R.OUTPUT_FILE_TYPE='XML'
    AND R.STATUS_CODE not in ('E', 'D', 'T', 'X')
    ORDER BY R.REQUEST_ID DESC
    Go to system profiles and query for 'Concurrent:Report Access Level', responsibility you need and modify the profile name accordingly....

  • Using Java to display a log file in a browser

    Can anyone advise & provide sample code in order to forfill the above aim?
    The log files would be on a Solaris server, so I guess the strategy would be to run an "rsh 10.1.1.10 -l username cat /errors/log1.log" and put the output to a browser? or not?
    Any suggestions / alternatives will be most helpful. 3 Dukes up for it!
    Thanks.

    Try placing the following in a controler servlet:
    try {
    PrintWriter out = response.getWriter();
    File file = new File("fileName");
    BufferedReader reader = new BufferedReader(new FileReader(file));
    String line = reader.readLine();
    while(line != null) {
    out.println(line);
    line = reader.readLine();
    } catch (FileNotFoundException fnfe) {
    } catch (IOException ioe) {
    }

  • Dynamic file name while using java mapping

    Hi All,
    i need help.
    I am using java mapping to convert xml file in zip file.
    Now i need to set output file name as SiteId_TimeStamp.zip.
    Site id is comping in xml file.
    How can i do this?
    I tried many thing but didnt get the solution..
    As their is no message mapping so I am unable to use ASMA.
    Please help.

    Did you check the wiki? You just need to add the code into you java mapping..
      Map mapParameters = (Map) transformationInput.getInputHeader().getAll();
       // a) Set Output File name
       mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic",
                                                             StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");
       DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
       DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
       //Depending on your requirement edit this logic. Here, NewDynamicName + CurrentDate will be output file name.
       DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
       conf.put(key, ("NewDynamicName_" + dateFormat.format(new Date())) + ".pdf");

  • How to install JAVA API client files :: Using JAVA Proxy & NWDS

    Hi
    I am going to integrate the SAP with one "AB" System which is providing Java API to integrate with their client ( which in turn will connect with AB System ). So AB System is providing JAR files & property files, in order to instantiate objects & call those APIs.
    Now I am going to write the JAVA code in NWDS which is installed on my Laptop so I am sure I need to give this jar files under ::
    <i>Project -> Properties and then Java Build Path -> Libraries.
    Choose Add External JARs</i>
    But where do I need to add property files.
    Also do I need to install the same files on XI Server too & do I need to install the "AB" System Client also on XI Server or it can be installed some place else too.
    Regards
    - Lalit -

    Lalit,
    ><i>But where do I need to add property files</i>
    How are you going to access the properties file? Are you going to use Java IO to read the file or are you dgoing to bundle the property file as a resource and use the getResource() . If you are going to use Java IO then you will have to hard code the property file path in your code and make sure that your Proxy can read the property file.
    If your property file is going to vary across environments, I woudl suggest this approach. Make sure that the property file path will be same in all environments and it will work fine and make sure that your proxy will have OS level IO access as well.
    Another option would be to have the property file bundled as a respurce, but, making changes to the file in this case will be an issue!
    ><i>Also do I need to install the same files on XI Server too & do I need to install the "AB" System Client also on XI Server or it can be installed some place else too.</i>
    When you create the EAR file for your Java Proxy, remove all XI .jar files and just make sure that the Client JAR is available in the EAR file. You need not install the Client JAR file anywhere as long as the jar file is a part of the EAR!
    Regards
    Bhavesh

  • How to get pdf file from sap presentation server using java connector

    Hi Friends,
    with the below code i am able to get po details in pdf in presentation server.
    DATA : w_url TYPE string
           VALUE 'C:\Documents and Settings\1011\Solutions\web\files\podet.pdf'.
    CALL FUNCTION 'ECP_PDF_DISPLAY'
            EXPORTING
              purchase_order       = i_ponum
           IMPORTING
      PDF_BYTECOUNT        =
             pdf                  = file  " data in Xsting format
    *Converting Xstring to binary_tab
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer                = file
      APPEND_TO_TABLE       = ' '
    IMPORTING
      OUTPUT_LENGTH         =
            TABLES
              binary_tab            = it_bin " data in binary format
    **Downloading into PDF file
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
      BIN_FILESIZE                    =
              filename                        = w_url
              filetype                        = 'BIN'
             TABLES
              data_tab                        = it_bin
    when i am using java connector , to retirve the file from presentation server , the follwoing error i am getting...
    init:
    deps-jar:
    compile-single:
    run-single:
    com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Error in Control Framework
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1244)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3842)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3287)
            at PdfGen.<init>(PdfGen.java:35)
            at PdfGen.main(PdfGen.java:78)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)
    i debugged too, problem with <b>gui_download......</b>
    I am very glad to all with your suggestions!!
    Regards,
    Madhu..!!

    Hi
    You can try to create an external command (transaction SM69).......sorry I've forgotten,,,,they works on application
    How do you call CL_GUI_FRONTEND_SERVICES=>EXECUTE?
    Max
    Edited by: max bianchi on Oct 13, 2011 10:27 AM

  • How to check & unzip zip file using java

    Dear friends
    How to check & unzip zip file using java, I have some files which are pkzip or some other zip I want to find out the type of ZIp & then I want to unzip these files, pls guide me
    thanks

    How to check & unzip zip file using java, I have
    ve some files which are pkzip or some other zip I
    want to find out the type of ZIp & then I want to
    unzip these files, pls guide meWhat do you mean "other zip"? Either they're zip archives or not, there are no different types.

  • How to generate reportdesign dynamically using java with out xml file

    hi
    how can i generate a reportdesign dynamically using java with out passing xml file to jasperDesign , i want to create my reportdesign with out xml file
    how can i ,please help
    thanks

    LiveCycle does provide a Java API to forms; LiveCycle is in fact a suite of programs, mostly enterprise level for running on server (next to which the cost of the master suite is a drop in the ocean). LiveCycle Designer is perhaps the only end user tool, and it is not for server use and doesn't have an API.
    Are you looking for a server solution? If so, nothing in the master suite can help, it isn't for server use.

  • Delete IFS file with sql command

    Hi
    Is it possible to remove a file from IFS using an sql command? If so, what is it?
    Thanks
    Hugo

    No, this is not possible, nor is it supported. You may use the Java API to delete a file.

  • How to delete jdb files at runtime?

    My problem description is, i have to do complete index will be performed by creating a new empty index and adding content data to that (working index). Searches will continue to use the old (active) index. Once the index process is complete, the working and active indexes are swapped and the working index can be removed in preparation for the next complete analysis.
    How can i remove jdb files at runtime without using java.io.File. ? [ According to the ejb specs an ejb should not try to use java.io package to attempt to access a file ].
    Thanks,
    Katta.

    Hi Charles ,
    I have implemented as your suggested way. I removed the old JE Database once new index (separate JE Database) created using env.removeDatabase() method. It's deleted the databse but *.bdb files not deleted(How can i reclaim the disk space). The cleaner is not deleting the files. Is cleaner will work without closing Environment. Do I need to use any methods to delete *.bdb files?
    JEConnection jeConnection = null;
    Environment env=null;
    try
    jeConnection = getConnection(OldJEEnvHome);
    env = jeConnection.getEnvironment();
    Database index, blocks;
    index = jeConnection.openDatabase("__index__", null);
    blocks = jeConnection.openDatabase("__blocks__", null);
    String dbName1 = index.getDatabaseName();
    String dbName2 = blocks.getDatabaseName();
    Directory indexDir = new JEDirectory(null, index, blocks);
    if(index!=null)index.close();
    if(blocks!=null)blocks.close();
    env.removeDatabase(null, dbName1);
    env.removeDatabase(null, dbName2);
    } catch (Exception e)
    {    // TODO: handle exception
    e.printStackTrace();
    }finally{
    if(jeConnection!=null)
    jeConnection.close();
    env.cleanLog();
    //env.close();
    public JEConnection getConnection(String dbEnvHome)
    throws NamingException, JEException
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    envConfig.setConfigParam("je.cleaner.expunge", "true");
    InitialContext iniCtx = new InitialContext();
    Context enc = (Context) iniCtx.lookup("java:comp/env");
    Object ref = enc.lookup("ra/JEConnectionFactory");
    JEConnectionFactory dcf = (JEConnectionFactory) ref;
    JEConnection dc = dcf.getConnection(dbEnvHome, envConfig);
    return dc;
    Thanks,
    Katta.

  • Use of wildcharacter in DELETE DATASET dsn

    Hi All,
    I have a situation where I have to delete a file from application server at runtime while executing a report. But the problem is I don't know exact filename. But I know first few characters of file which will be always same. So my question is -
    Is it possible to use wild characters in 'DELETE DATASET dsn' or not?
    I tried DELETE DATASET 'delv*.txt'   -  but its doesn't work. Is there any other method to do this?
    thanks,
    Sanjay

    Hi,
    This is an abap question not a security question : wrong forum.
    Anyway the solution is to read the content of the directory with a wildcard 'delv*.txt' to find out the real filename and then use the filename to delete the file.
    Regards,
    Olivier

  • Need help with tomcat 5.5 and using java classes

    hey there,
    i am trying to set up tomcat 5.5 on my computer at home and have sucessfully done so. i have been trying to use Java classes inside my JSP files however tomcat thows an internal servlet error as follows:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 144 in the jsp file: /order.jsp
    Generated servlet error:
    ProductList cannot be resolved to a type
    An error occurred at line: 144 in the jsp file: /order.jsp
    Generated servlet error:
    ProductList cannot be resolved to a type
    An error occurred at line: 144 in the jsp file: /order.jsp
    Generated servlet error:
    Product cannot be resolved to a type
    i have the classes located as the setup tutorial recommends (root/WEB-INF/classes/) and still nothing works. i would appreciate any help anyone can give.
    thanks,

    Which tutorial are you following?
    As of java1.4, all classes must be in packages for them to work in Tomcat. This means your beans and servlets too.
    Put your beans in a package, and then recompile them, and put them in the right place.
    eg
    package com.mypackage
    public class MyClass ...
    once compiled would go into WEB-INF/classes/com/mypackage/MyClass.class
    Are you using Product and ProductList classes in scriptlet code?
    Have you imported them with a page directive
    <%@ page import="com.mypackage.Product, com.mypackage.ProductList" %> ?

Maybe you are looking for

  • Regarding Weak Refrence

    Dear All, i am developing one application in jsp . i have been getting out of memory error in that,so i googled and found that using weakreference class will remove this,i have been implemented like this XYZ xyzobj = null; Reference ref = new WeakRef

  • Trackpad ad mac pro

    My new Trackpad works perfectly with my laptop however it will not work with my Mac Pro (2.66 GHz Quad Core) even I have discoverable on. Any suggestions and advice please?

  • IPhoto Upgrade iBook G4 so can continue to order books & prints?

    Hi, Trying to determine the lowest v iPhoto upgrade for continued ability to order books and prints...would that be the iPhoto version in iLife 05? ...don't want/need GarageBand, iDVD, etc., just iPhoto! Recommendations appreciated.

  • Timers

    ok, call me dumb or whatever but i just don't understand timers. how would i make a timer to fire every second and add 1 to an integer? I've tryed to understand it but there are swing timers and regular timers? and i keep getting confused and all the

  • HT1339 I got a question. A screen comes up on my ipod,.this game cannot be launche.This may be the result of a full ipod. Any ideas?

    I got a question. A screen comes up on my ipod,.this game cannot be launche.This may be the result of a full ipod. Any ideas?