1

I am working to write java code to update an ICL (x937 format) check 21 file. This is the file having details and images of cash letters (cheque) My requirement is to take an existing file. Edit some values and create a new file.

I have written below code.

private void writeItemData(ForwardPresentmentBundle bundle) throws Exception {
    System.out.println("WRITE ITEM DATA");
    Iterator<ICLItem> it = bundle.getItemList().iterator();
    while (it.hasNext()) {
        ICLItem item = it.next();

        String [] dataToReplace1=dataPassed.split("\\,");
        int sizeOfData=dataToReplace1.length;
        int indexOfICL=0;

        for(int i=0;i<sizeOfData;i++){
            String param=(dataToReplace1[i].split("\\="))[0];
            String value=(dataToReplace1[i].split("\\="))[1];
            System.out.println("Param : "+param+"  |  value : "+value);

            /* write the check detail record */
            len = RecordLength.intToByteArray(item.getCheckDetail().getRecordLength(), 4);
            data = item.getCheckDetail().getBytes();
            System.out.println("Lenght : "+len+" | Data : "+data);
            writeData();

            /* write any addendum records */
            // TODO: implement writing of other addendum record types
            for (int i = 0; i < item.getCheckDetailAddendumAList().size(); i++) {
                len = RecordLength.intToByteArray(item.getCheckDetailAddendumAList().get(i).getRecordLength(), 4);
                data = item.getCheckDetailAddendumAList().get(i).getBytes();
                //((item.getCheckDetailAddendumAList()).get(4)).setFieldData(4, "44");
                System.out.println("========= *********8 ============");
                //System.out.println(">> >> << <<");
                // System.out.println(" >>> "+(item.getCheckDetailAddendumAList()).get(4));


                /*  System.out.println("Count : "+i);
                System.out.println("Lenght : "+len+" | Data : "+data);
                CheckDetailRecord cdr = new CheckDetailRecord();
                System.out.println(cdr.getFieldNameAtPosition(5));
                System.out.println(cdr.getFieldDataAtPosition(5));
                cdr.setFieldData(5, "6");
                System.out.println(cdr.getFieldDataAtPosition(5));*/
                writeData();
            }

            for (int i = 0; i < item.getCheckDetailAddendumCList().size(); i++) {
                len = RecordLength.intToByteArray(item.getCheckDetailAddendumCList().get(i).getRecordLength(), 4);
                data = item.getCheckDetailAddendumCList().get(i).getBytes();
                writeData();
            }

            /* write the image view records */
            writeImageData(item);
        }
    }
}

This is creating ICL file but the images are not copied properly in the new file. Verified using x-editor.

Need help on this.

Danielson
  • 2,605
  • 2
  • 28
  • 51
  • Could it be what you're searching for? http://sourceforge.net/projects/x937/ – rsutormin Sep 10 '15 at 22:03
  • Actually i have looked here and got the code and adapted it for my needs. But thei issue exists. –  Sep 16 '15 at 06:53

0 Answers0