Returns the length of the header sufficient to determine record's validity and size.
Returns the length of the header sufficient to determine record's validity and size. Usually this is a constant number for a given record header flavor.
Given a raw values of a record header returns metadata sufficient to parse the record.
Given a raw values of a record header returns metadata sufficient to parse the record.
A record header as an array of bytes
An offset from the beginning of the underlying file
A maximum offset allowed to read by the current index chunk
A size of the underlying file
A sequential record number
A parsed record metadata
If true the record parser will expect record headers to be defined in the copybook itself.
If true the record parser will expect record headers to be defined in the copybook itself.
If false the headers are not expected to be defined in the copybook and the number of bytes
returned by getHeaderLength
will be truncated before record bytes are passed to the parser.
Clients of 'spark-cobol' can pass additional information to custom record header parsers using
Clients of 'spark-cobol' can pass additional information to custom record header parsers using
.option("rhp_additional_info", "...anything as a string...")
If a client provides any additional info the method will be executed just after constructing the record header parser.
Built-in record header parsers ignore the additional info. This info string is intended for custom record header parsers.
A string provided by a client for the record header parser.
This trait represents a contract for record header parsers. Usually each record of a multi-segment mainframe file has a 4 byte record descriptor word (RDW) header specifying length of each record. If this RDW header is no-standard a custom header parser can be provided to Cobrix to extract such records.
To this you need to create a parser class that extends this trait and implement the header parser logic. Each concrete class inherited from this trait should be serializable because it need to be transferrable to executors when used from Spark framework.
So the usual way implementing a custom record header parser is
extends Serializable with RecordHeaderParser
A record header parser for RDW is implemented in
RecordHeaderParserRDW
. This is a good starting point for implementing your own record header parser.