Background
Currently, REDEFINE rules are ignored when files are processed in-place:
SparkCobolProcessor.builder
.withCopybookContents(copybookContents)
.withProcessingStrategy(CobolProcessingStrategy.ToVariableLength)
.withRecordProcessor(processor)
.option("record_format", "F")
.option("redefine-rule:1", "G1 => in(ID, 1, null)") // <---- This
.option("redefine-rule:2", "G2 => ID = 2 || ID = null")
.option("redefine-rule:3", "G3 => ID = 3 || ID = null")
.load(listOfFiles)
.save(outputPath)
override def processRecord(record: Array[Byte], ctx: CobolProcessorContext): Array[Byte] = {
// When getFieldValueByName is used, the rules are not applied.
val segmentId = ctx.copybook.getFieldValueByName(someField, record, 0).toString
...
}
Feature
Add support for REDEFINES rules when processing files in-place.
Example [Optional]
--
Proposed Solution [Optional]
- Add method
isFiedEnabled() to be used together with getFieldByName() and getPrimitiveField()
- (possibly)
getFieldValueByName() should apply redefine rules
Background
Currently, REDEFINE rules are ignored when files are processed in-place:
Feature
Add support for REDEFINES rules when processing files in-place.
Example [Optional]
--
Proposed Solution [Optional]
isFiedEnabled()to be used together withgetFieldByName()andgetPrimitiveField()getFieldValueByName()should apply redefine rules