I am trying to read a COBOL data file using JRecord, in that I have a Header record and Detail record, so I parsed with SPLIT_01_LEVEL and CopyBook File format as FMT_OPEN_COBOL. I have few date fields in the flat file as COMP-3 fields, and I am unable to understand on how to convert them into Java Date fields.
ICobolIOBuilder iob = CobolIoProvider.getInstance()
.newIOBuilder(copybookName)
.setCopybookFileFormat(Convert.FMT_OPEN_COBOL)
.setSplitCopybook(CopybookLoader.SPLIT_01_LEVEL);
//I fetched fields as below
line.getFieldValue(field).asString();
The CopyBook have fields as
MPOH-ENTRY-DATE PIC S9(7) COMP-3.
MPOH-STATUS-DATE PIC S9(7) COMP-3.
MPOH-APPROVED-DATE PIC S9(7) COMP-3.
MPOH-ORDER-DATE PIC S9(7) COMP-3.
When I parsed as above the output is
MPOH-ENTRY-DATE : 11261a1
MPOH-STATUS-DATE : 11261a1
MPOH-APPROVED-DATE : 11261a1
MPOH-ORDER-DATE : 11266140
Please help me in converting these fields to Java Date fields.
From the Docs and how JRecords seems to be setup, you should be able to replace
with
to get some meaningful result. If that int will be 20151204 or something else entirely remains to be seen - but if I remember my COBOL days correctly, it's probably yyyyMMdd just stored as number