Read a file content and copy to another Diectory

I wanted to do the following
1-read a file from dir
2- read the content of the file
3- if the file contains zeros
exit from this file and go to read next file
else
do some calculations
i read a file and its contents and found zeros in the contents, so how can i say in the code to go to next file..
any help please

It depends on your code, but most likely using "return":
//pseudo code
while(moreFiles) {
  parseFile(file)
void parseFile(File file) {
  while(moreContentToRead) {
    if(foundZero) {
      return;
}

Similar Messages

  • Need to read text file content and have to display it in multiline text box

    dear all,
    Need to read text file content and have to display it in multiline text box.
    actually im new to file handling. i have tried up to get_line and put_line.
    in_file := TEXT_IO.FOPEN ('D:\SAMPLE.txt', 'r');
    TEXT_IO.GET_LINE (in_file,linebuf);
    i dont know how to assign this get_line function to text item
    pls help me in this regards,

    Simply write:
    in_file := TEXT_IO.FOPEN ('D:\SAMPLE.txt', 'r');
    TEXT_IO.GET_LINE (in_file,linebuf);
    :block2.t1 := chr(10)||:block2.t1||chr(10)||linebuf;
    chr(10) --> is for new line character

  • Mail - Stuck in Reading Table of Contents and Copying Messages

    Mail has been stuck in this loop for the past week. It is either reading table of contents or copying messages. It doesn't stop no matter how long I have it running. I wasn't able to send mail, but somehow that started working. I cannot delete messages (or they seem to delete but come back on restart). I also must force quit to get out of it. Does anybody have any ideas? Help!!!!

    One account, IMAP to my university server. Tried Rebuild.
    Tried Cache cleaners. Hard disk is 50% full. Inbox has on
    the order of 50 messages in it at any one time.
    My wife's iMac has the same problem (one account, IMAP,
    to mac.com). She has OS 10.4.4
    By the way, I also expereince the mysterious "mail marked
    as unread" now...never happened until the past few weeks.

  • How do you copy, for example I work with blue prints and I want to copy a section and copy into another new page?

    How do you copy, for example I work with blue prints and I want to copy a section and copy into another new page?

    Forgot to add that it would be an adjustment layer with some kind of mask on it already. The mask is uncentered when copy and pasted which throws it off.
    I guess the same question would go towards doing the same for an object. How to copy and paste it over to a new doc, keeping its position within the document? is this possible?

  • How to read trace file content

    Hi,
    DB :11.2
    How to read trace file content.It's only for ORACLE SUPPORT?
    calling         
    call
    entry           
    argument values in hex
    location        
    type
    point           
    (? means dubious value)
    ksedst()+31     
    call
    ksedst1()       
    000000000 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    ksedmp()+610    
    call
    ksedst()        
    000000000 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    ksfdmp()+21     
    call
    ksedmp()        
    000000003 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    kgerinv()+161   
    call
    ksfdmp()        
    000000003 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    kgeasnmierr()+163
    call
    kgerinv()       
    0069107E0 ? 011F80370 ?
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000000 ? 000000000 ?
    kssmov()+502    
    call
    kgeasnmierr()   
    0069107E0 ? 011F80370 ?
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncInitSlavePool()  call
    kssmov()        
    0D3F1C5D0 ? 000000000 ?
    +203                                          
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncWorkMsgAlloc()+  call
    kfncInitSlavePool()  0D3F1C5D0 ? 000000000 ?
    83                                            
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncFileUnidentify(  call
    kfncWorkMsgAlloc()   0D3F1C5D0 ? 7FFF19B99AD0 ?
    )+635                                         
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kffmRequestFree()+1  call
    kfncFileUnidentify(  7FFF19B99BC8 ? 7FFF19B99BC0 ?
    Br,
    Raj

    One needs to know the meaning of the kernel functions and their working within the oracle database. I guess, oracle support can do the analysis more easily as they have access to the software code  as well necessary tools to interpret these internal routines.
    Aman....

  • How to read entire file content in one XML tag?

    Hi,
    How can I read entire file content in one XML tag?
    What specifications do I need to specify in Sender adapter?
    regards,
    Anirudh.

    Hi Chirag,
    I am reading a flat file for File to Idoc scenario.
    Target Idoc is nested which can not be populated with graphical mapping.
    see below post for more detail.
    [Mapping flat XML to nested IDOC using node functions |Mapping flat XML to nested IDOC using node functions;
    The problem here is I'm not able to identify when to insert context change for child which is repeating for a repeating parent.
    Solution therefore, I think is reading entire flat structure in one node and then use UDF to populated intermediate target with proper nesting.
    Thats why I need to read entire XML.
    regards,
    Anirudh.

  • How to read text file content in portal application?

    Hi,
    How do we read text file content in portal application?
    Can anyone forward the code to do do?
    Regards,
    Anagha

    Check the code below. This help you to know how to read the text file content line by line. You can display as you require.
    IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
    IResourceContext resourceContext = new ResourceContext(user);
    String filePath = "/documents/....";
    RID rid = RID.getRID(filePath);
    IResource resource = ResourceFactory.getInstance().getResource(rid,resourceContext);
    InputStream inputStream = resource.getContent().getInputStream();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
    String line = reader.readLine();
    while(line!=null) {
          line = reader.readLine();
         //You can append in string buffer to get file content as string object//
    Regards,
    Yoga

  • Read file content and keep binary copy

    Hi All,  I don't know what the best way of doing this is, but my requirement is to read the content of a file using File Adapter and post a document with this datda in SAP, but also to keep a binary copy of the file attached to the posted document.
    So my question is, Is there a way within the file adapter to read the content of the file using the Content Conversion mechanism and at the same type keep a binary copy of the read file.
    Thanks,
    Pablo

    Hi,
    I know we can send it via proxy but your question was something different or my be I misunderstood it.. here is your question again..
    >
    Pablo Lopez wrote:
    > Hi All,  I don't know what the best way of doing this is, but my requirement is to read the content of a file using File Adapter and post a document with this datda in SAP, but also to keep a binary copy of the file attached to the posted document.
    > So my question is, Is there a way within the file adapter to read the content of the file using the Content Conversion mechanism and at the same type keep a binary copy of the read file.
    >
    > Thanks,
    > Pablo
    What I understood from your question that, there is a file which you want to read/pick via file adapter and at the same time you also want to attach same file along with the content and then post it to R3.
    If my assumption is correct then it is not possible. Yeh If there is some workaround then that is different story.
    Regards,
    Sarvesh

  • UDF to read a file name and use some of its contents to map fields in target.

    I have a scenario where I need to take the month and year from the file name and map it to suitable fields in the target. Ex - filename_apr2014 from this i should be able to read the month and year and map it. How to do this? I tried the udf -
    public String getFileName(Container container){
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return ourSourceFileName;
    got this error while testing the mapping -
    Runtime exception when processing target-field mapping /ns0:MT_<<>>_Output/I<<>>; root message: Exception:[java.lang.NullPointerException: while trying to invoke the method com.sap.aii.mapping.api.DynamicConfiguration.get(com.sap.aii.mapping.api.DynamicConfigurationKey) of a null object loaded from a local variable at slot 2] in class <<>> method getSourceFileName[com.sap.aii.mappingtool.tf7.rt.Context@5b04fc0f]
    See error logs for details  

    Hi Satish - You declared "conf" twice.
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    UDF -
    String filename    = "";
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");
    filename = conf.get(key);
    return filename;
    And did you define the variable slot 2 in any of your UDF's?
    The above UDF return the filename and you should handle the sub string later..

  • Divide file contents and read from threads

    I am reading a file which contains doubles... I can do this with 1 thread.
    Now I want to use 2 threads and make each thread read half of that file.. How do I make file to half .. If I take the length and divide by two wont it destort the doubles?
    public class SingleThread extends Thread
         /*** Constructor ***/
         public SingleThread(){}
         /*** Run the thread ***/
         public void run()
              try{
              FileInputStream fis = new FileInputStream("File1.bin");
              DataInputStream dis = new DataInputStream(fis);
              int size = fis.available();
              System.out.println("Size of File1 "+size);
              /*Create an array that can store 100,000 numbers*/
              double num1[] = new double[100001];
              /*Get random number*/
              for (int count = 0; count <= 100000; count ++)
                   num1[count] = dis.readDouble();
                   System.out.println(count); //Count
                   System.out.println(num1[count]); //Prints doubles that are read from file.
         }//try
              catch(Exception e){System.out.println("Exception: "+e.getMessage());}
         /******************** Main Program ********************************************************/
         public static void main(String[] args)
              new SingleThread().start();
    }

    I dont know....my professor wants us to test multithreading response times.. :(

  • Read incoming EDI File content and FTP file on R/3 server based on value

    Hi,
    We have the below scenario:
    The incoming file is received in XI in the below directory:
    /usr/feeders//interfaces/EP1/abc
    The file name is- TCDE.BLQSAM.OCAA2682.C0084031
    The file contains some data like below:
    UNBUNOA:3HEXAGON-ABCABC10268002090806:1004+403140015324'
    UNH1CONTRL:2:2:UN:APACS'
    UCI1000284217ABC10268002HEXAGON-ABC7+C00'
    Based on this incoming file reference number in line 3 as given (1000284217) for example, a lookup needs to be made in R/3 in a table to determine if the file should be placed in directory A or Directory B in R/3 without any XML conversion.
    I have made the scenario and the details are as below:
    Created the new Mapping Archive in the IR and import this .jar
    Created an Interface mapping for the Control File processing and select the mapping program from the archive
    Created a Business Service called  "BSY_ECC6_FI_CENTRAL" and a communication channel called "CCIA_01_RFC_RECEIVER", for the connection to the R/3 system of type RFC and will have to have the connection settings for the R/3 backend with the client which has the data in it for the FM call.
    I have the java code that I can forward you for reference.
    I am not able to run the scenario successfully.
    Plaese advise as to how I can develop this scenario.
    Regards,
    Archana

    Hi Archana,
    Based on this incoming file reference number in line 3 as given (1000284217) for example, a lookup needs to be made in R/3 in a table to determine if the file should be placed in directory A or Directory B in R/3 without any XML conversion.
    Created the new Mapping Archive in the IR and import this .jar
    Created an Interface mapping for the Control File processing and select the mapping program from the archive
    Created a Business Service called "BSY_ECC6_FI_CENTRAL" and a communication channel called "CCIA_01_RFC_RECEIVER",
    for the connection to the R/3 system of type RFC and will have to have the connection settings for the R/3 backend with the
    client which has the data in it for the FM call.
    What i understand from your Qs is, you want to get the location where the file need to be placed from the table in R/3 system
    based on the ref. no mentioned in source EDI file, and the target file should be placed as a flat file format.
    You are using RFC lookup to get the details of the location in Java mapping, Once you have the location you can map it to the
    element in payload and using varaible substitution you can specify the  target directory.
    Regards,
    Prasanna

  • File movement and copying

    Here where i work we use a software, whose files are stored on the server. But we also have a local copy of these files so that we can use the software when not in the office. Or when the server is down. The problem is, that many of my co workers are not very computer literate and the constant copying back and forth of files confuses them.
    So I am trying to write an updater application. Basically all they would have to do is click a button, it would tell them whether there had been any important changes, and allow them to update by pressing a single other button.
    I have the gui written, I have all the checks done, but i cannot figure out how to make Java take files in one place and copy them to another place. I would think this would be something that java is capable of. But as of this moment I am drawing a blank.
    Any ideas?

    Quick and dirty method is to use Runtime.exec() to execute the copy/move commands directly, though this is platform dependant.
    Another way is to use InputStream and OutputStream to read the original file and write out the copy of the file.

  • [CS3 JS]  Reading TXT file content into String

    Hello,
    I'm currently wanting to display a dialog box that has a dropdown menu containing all countries of the world.
    I have an external txt file that contains a list of all countries.
    I thought I would simply read-in the contents of the 'txt' file into a string and use it for displaying the list.
    For example
    i Instead of the usual:
    > var myLandMenu = dropdowns.add({stringList:["A", "B"...], selectedIndex:0});
    i I thought of doing something like:
    > var myLandList = ....? HELP ?....
    > var myLandMenu = dropdowns.add({stringList:myLandList, selectedIndex:0});
    Is this the way to do it?
    What would be the way to read in the text file content as a string?
    Thanks in advance,
    Lee

    > var myLandList = ....? HELP ?....
    > var myLandMenu = dropdowns.add({stringList:myLandList, selectedIndex:0});
    It's hard to tell from context, but myLandList needs to be an array of strings.
    If the file has one element per line, this would be one way of handling the
    conversion:
    var file = File("~/countries.txt");
    file.open("r");
    var str = file.read();
    file.close();
    var myLandList = str.split(/[\r\n]+/);
    And assuming that this is ScriptUI and not the older ID UI, the menu creation
    would look more like:
    var myLandMenu = dropdowns.add(bounds, myLandList);
    myLandMenu.items[0].selected = true;
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • Read a file content into Variable

    Hi There,
    I've a file in Unix and the content of it need to be assigned to an ODI variable. How can I do it?
    Regards.
    -Bhavani

    Step 1. ODI procedure .
    Command on Target - Java bean shell.
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    BufferedReader br = new BufferedReader(new FileReader("C:\\test.txt" ));
    String strLine = br.readLine();Step 2
    Create variable and add
    SELECT '<@=strLine@>' from dual This particular code will read only first line and pass into variable.

  • To read xls file content

    Hi all
    I want read the content of a xls file.
    For creating xls file am used poi.
    On reading xls hoe to get the column and row count.
    pls reply with example
    thanks for reply.

    You're already using POI to create XLS files. Guess what, you can also use the same to read XLS files. If your problem is more that you don't know how, then just read the documentation and code examples which come along it (and are available at its homepage).

Maybe you are looking for

  • E-Recruiting 6.0: Business Partner Role For Branches

    Hi Experts, In the IMG, SAP E-Recruiting > Basic Settings > Enterprise Structure > Define Business Partner Role for Branches Can anyone help in the following: 1) What is the purpose of Business Partner Role and how does it relate the Branches? Or how

  • How to get the link between MCH1, AUSP, CAWN and CAWNT tables

    Hi,     Can anyone let me know how to get the link between MCH1, AUSP, CAWN and CAWNT tables as I want to get the description (CAWNT-ATWTB) for a particular Batch (MCH1-CHARG). Thanks & Regards, Kumar

  • Function module to display process overview log from SM66 Transaction

    Hi, I want to display process overview log from SM66 Transaction in a report. Is there a function module which will help me in achieving that or is there any other method. Thanks in advance, Sandeep.

  • Query timeout on 10g thin driver

    I'm using the Statement.setQueryTimeout(...) method, but it doesn't seem to work when the server is shutdown. I do the following: 1) create the statement and set the query timeout to 30 seconds 2) run a query that gets stuck waiting for a lock (ie se

  • Dynamic Forms (Data Dictionary) using CFForm (??)

    Hi, The basic plan is to build the forms in my application dynamically using a data dictionary rather than basing them upon static tables and having statically coded forms to match. This would allow me to offer the ability for an administrator to add