Thanks a lot Fady, This really helped.
We are now trying to run it in Map Reduce and presently we are conidering only 1 mapper and experimenting with it. we thought of writing a Custom Inputformat Class and read the entire file into the buffer in other words use the zosfileinputstream in the inputformat class and read the entire file into the record reader.
Do you think this is the right approach?
Thanks,
Aparna
We are converting bin file to Java and are using legstar, we have tried to put byteArray of .bin file ( which read through buffered reader) into method hostToJavaTransform(byte[] HostByte) , but it did not transform and give errors: Want to know if this is the right approach
This is the javaCode:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import com.legstar.coxb.transform.HostTransformException;
import com.legstar.test.coxb.cobol.PersonalData;
import com.legstar.test.coxb.cobol.bind.PersonalDataTransformers;
import com.legstar.coxb.transform.AbstractTransformers;
import com.legstar.coxb.transform.HostTransformStatus;
public class ReadMainframe {
public void hostToJavaTransform(final byte[] mainframe) throws HostTransformException
{
PersonalDataTransformers transformers = new PersonalDataTransformers();
PersonalData personal = transformers.toJava(mainframe);
personal.getCustomerName().trim();
personal.getCustomerAddress().trim();
personal.getCustomerPhone().trim();
System.out.println(personal.getCustomerName().trim());
}
public static void main(String[]args) throws Exception
{
BufferedReader br = new BufferedReader(new FileReader("/home/hadoop/Desktop/cobol/ZOS.FCUSTDAT.bin"));
try (BufferedReader reader = new BufferedReader(br))
{ byte[] mainframeOut =null;
String line = null;
while ((line = reader.readLine()) != null)
{
System.out.println(line);
mainframeOut = line.getBytes();
System.out.println(Arrays.toString(mainframeOut));
}
ReadMainframe read = new ReadMainframe();
read.hostToJavaTransform(mainframeOut);
}catch (IOException x)
{ System.err.format("IOException: %s%n", x);}
}
}
Thanks, Aparna