Skip to content

Instantly share code, notes, and snippets.

@palanisamym14
Created April 28, 2021 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palanisamym14/db5a36b0f9de7906d12cb2ed0017e515 to your computer and use it in GitHub Desktop.
Save palanisamym14/db5a36b0f9de7906d12cb2ed0017e515 to your computer and use it in GitHub Desktop.
const fs = require('fs');
const lineReader = require('line-reader');
const mainframeFileName = 'ftc/infolease-23-4-21.txt';
const microserviceFileName = 'ftc/23-4-21-CACS_TO_INFOLEASE';
var counter = 0;
const mainframeLines = await readlinesFromFile(mainframeFileName);
const microserviceLines = await readlinesFromFile(microserviceFileName);
const file1rmsRecords = [];
for (const line of mainframeLines) {
const result = flatFileToObj(
rmsInterfaceRecordWidthConfig,
line,
getRmsInterfaceRecord()
);
file1rmsRecords.push(result.rmsInterfaceRecord);
}
const readlinesFromFile = (file) => {
const lines = [];
return new Promise((resolve, reject) => {
lineReader.eachLine(file, (line, last) => {
lines.push(line);
if (last) {
resolve(lines);
}
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment