cobrix
cobrix copied to clipboard
how to read a VB file format with RDWs removed
We are from capital one, trying to use COBRIX to convert some of the EBCDIC files to ASCII format. we are facing some issues in reading a VB file format with RDWs removed (it's working only in ab initio); But not in any other E2A tool.
if it can be worked; I can share you the copybook and sample file
Hi, thanks for your interest. A couple of questions:
- What's VB file format?
- How record sizes are determined if RDWs are removed?
If these files can be processed in Ab Initio, I'm pretty sure they can be processed in Cobrix as well 😄
We have a variable length file with different segments having different copybook layouts. The first 2 bytes determine what type of record and which copybook/seg it belongs too.
ex: data (no RDW / no rec length)
deaaaaaaaaa dxbbbb dgc dfddddd
copybook (based on 1st 2 char de /dg /dx/df we determine that record should go to which copybook)
01 record-a
02 rectype pic x(2)
05 a-copybook pic x(9)
01 record-b
02 rectype pic x(2)
05 b-copybook pic x(4)
01 record-c
02 rectype pic x(2)
05 c-copybook pic x(1)
01 record-d
02 rectype pic x(2)
05 b-copybook pic x(5)
How to achieve this in cobrix.
This type of files can be parsed using so-called 'custom record header parser'. A custom record parser should request first 2 bytes and return the size of the record. The copybook should contain all segments that redefine each other. You can use segment redefine to fields mapping to define which redefine GROUP corresponds to which segment id (segment ids are de, dx, dg, etc in your case).
Here is an example on how to use a custom record header parser: SparkCodecApp.scala Here is an example of such a parser: CustomRecordHeadersParser.scala
In your case isHeaderDefinedInCopybook = true since you want header fields to be parsed using the copybook as well.