title: How to implement File Update logic in Chunk Processing (Java Batch - JSR352)
body: <p>I am trying to develop a Java batch program using the IBM's JSR352 Implementation. Since the batch job involves iteratively processing huge number of records, I chose to implement it as Chunk Processing job.</p>
  
  <p>This job involves of 3 steps which keeps repeated for each records in File 1</p>
  
  <ol>
  <li>Reader Class:  Read content from File 1 to form a key text</li>
  <li>Processor Class: Look-up the Key text in File 2 </li>
  <li>Writer Class: Update the text in File 2 where key text was found with a custom text</li>
  </ol>
  
  <blockquote>
    <p>From the processor to writer, I can return all line numbers where the 
    key text matches were found. But, without RandomAccess to file, how 
    can i update those specific line numbers in File 2 from my Writer?</p>
  </blockquote>
  
  <p><strong><em>Since I am restricted to use only <a href="https://www.ibm.com/support/knowledgecenter/en/SSYKE2_7.1.0/com.ibm.java.zsecurity.api.71.doc/com.ibm.jzos/com/ibm/jzos/FileFactory.html#newBufferedWriter(java.lang.String)" rel="nofollow noreferrer">these Input/Outputstreams</a> for
   file handling I am unable to split the Lookup &amp; Update logic between
   processor &amp; writer classes. How can i achieve this ?</em></strong></p>
  
  <p>This is because the code will be developed in a windows machine but, finally executed in a mainframe (z/os) server.</p>