Preprocessing the Cobolsources in the next code snippet created correct Cobol, however only in FREE Format. This is no problem with GnuCobol, just use the -free option for further compilation of the generated Coboloutput. However, if you would like to rerun the preprocessed Coboloutput on the host, you can only use a FIXED format here. (one of the reason for rerunning that output on the host would be cobol source instrumentation or enhancements to be applied ...)
Best implementation would be, that the preprocessed String returned is formatted according to the given input.
CobolPreprocessor.CobolSourceFormatEnum format = CobolPreprocessor.CobolSourceFormatEnum.FIXED;
String preProcessedInput = new CobolPreprocessorImpl().process(inputFile, copyBookFiles,format);
Preprocessing the Cobolsources in the next code snippet created correct Cobol, however only in FREE Format. This is no problem with GnuCobol, just use the -free option for further compilation of the generated Coboloutput. However, if you would like to rerun the preprocessed Coboloutput on the host, you can only use a FIXED format here. (one of the reason for rerunning that output on the host would be cobol source instrumentation or enhancements to be applied ...) Best implementation would be, that the preprocessed String returned is formatted according to the given input.