Hi Bruce, please assist on the below , I m using IOBuilder from Jrecord to read the copybook that consists of the variable length reader and I m getting the following exception:
My java program :
ICobolIOBuilder iob = JRecordInterface1.COBOL.newIOBuilder("copybook.cob") .setDialect(ICopybookDialects.FMT_MAINFRAME).setFont("cp037") .setCopybookFileFormat(Cb2xmlConstants.FREE_FORMAT) .setSplitCopybook(CopybookLoader.SPLIT_01_LEVEL).setFileOrganization(Constants.IO_VB); AbstractLineReader reader = iob.newReader("Jrecorder_Full_Binary_Data_VBFormat.bin");
05 *TAP-TRANSACTION-LINE-ITEM-COUNT* PIC 9(2). 05 TAP-TRANSACTION-TAX-ON-FEES PIC S9(7)V99 COMP-3. 05 FILLER PIC X(234). 05 FILLER PIC X(229). 05 TAP-LINE-ITEM OCCURS 0 TO 100 TIMES DEPENDING ON *TAP-TRANSACTION-LINE-ITEM-COUNT*. 10 TAP-LINE-ITEM-DEPT PIC 9(3) COMP-3.
~~~
Caused by: java.lang.RuntimeException: Error With Occurs Depending On Field: TAP-TRAN-LINE-ITEM-COUNT
at net.sf.JRecord.External.Def.DependingOn.updateField(DependingOn.java:278)
at net.sf.JRecord.Details.RecordDetail.setDependingOn(RecordDetail.java:1322)
at net.sf.JRecord.External.ExternalRecord.toRecordDetail(ExternalRecord.java:722)
at net.sf.JRecord.External.ExternalRecord.asLayoutDetail(ExternalRecord.java:600)
at net.sf.JRecord.IO.builders.IOBuilderBase.getLayout(IOBuilderBase.java:515)
at net.sf.JRecord.IO.builders.IOBuilderBase.newReader(IOBuilderBase.java:256)
at net.sf.JRecord.IO.builders.IOBuilderBase.newReader(IOBuilderBase.java:248)
at com.macys.sabrecreditmanagement.SCMApplication.main(SCMApplication.java:31)
... 5 more
~~~
Anonymous
Diff:
Will look at it,
is the definition of field TAP-TRANSACTION-LINE-ITEM-COUNT in a separate 01 level to its use in the occurs depending clause. I think I need to full copybook to understand what is going on
The error occurs because JRecord can not find TAP-TRANSACTION-LINE-ITEM-COUNT in the current Record. Possible causes
I really need to see the full copybook to understand what is going on
Last edit: Bruce Martin 2021-11-26
Hi Bruce the field name is TAP-TRAN-LINE-ITEM-COUNT :
my copy book :
I have done some basic testing and have had no problems. See the attached source code.
The program logic to create a file and then read it is:
Potential problems:
Thank you Bruce, its working.