Sharad
Sharad

Reputation: 1

How to convert COBOL COMP, COMP-1 and COMP-2 into Java Long or Int

I am working to Mainframe to Hadoop migration and have very knowledge in Java. I have a cobol flat file which contains computational fields (COMP, COMP-1, COMP-2). I have to use this file in Java application.

Need help to understand below points:

  1. How to FTP mainframe flat file which has COMP fields. I tried to FTP it but got non readable characters. I tried to FTP in Binary Mode but still its not readable.

  2. How to convert Cobol COMP fields in to JAVA int/long. If you have any sample java snippet. Please share.

I have found java snippet for COMP-3 to Java Long on below link: http://www.coderanch.com/t/411222/java/java/Packed-decimal-conversion-Java

Appreciate you help.

Upvotes: 0

Views: 2262

Answers (1)

Felipe Martins Melo
Felipe Martins Melo

Reputation: 1333

You can take a look at the parser behind Cobrix. This is an open-source COBOL data source for Spark and it copes with COMP fields.

Upvotes: 1

Related Questions