Reading EBCDIC variable files with comp-3 without COBOL on MVS?

372 Views Asked by At

Is there a way with Java or within .Net or some sort of API to read EBCDIC files that are variable and unpack COMPUTANIONAL-3 data?

I have searched, and all I could find is that UltraEdit converts EBCDIC to ANSI but the file is still not usable due to variable length and COMP-3.

1

There are 1 best solutions below

0
On

On z/OS, where your data originates, there is a Java package called Java Batch Toolkit for z/OS (JZOS), which offers many classes to work with mainframe data sets and records (mainframe speak for file). Google "IBM JZOS".

Since you mention .net, I assume you're refering to code running on a PC (Windows), and JZOS is not an option.

If the files are downloaded using FTP, using bin and quote mode b on the client side, will transfer the records prepending a 3 byte header to each record (see RFC 959: FTP, chapter 3 "Data Transfer Functions", section "3.4.2. Block Mode").

The header allows the code to understand if this is the last record or not, and more importantly, the length of each record. Note that the two byte binary length field is in big endian format.

You would need to understand the record structure, i.e. what fields the record is composed of. And, the format of each field, i.e. EBCDIC character field, packed decimal field (COMPUTATIONAL-3), etc.

Next you need to know the EBCDIC code page being used on the mainframe. You can then use iconv() (or the corresponding Java methods) to convert those to whatever code page you need.

As for the packed decimal fields, you also need to know the precision, i.e.how many of the digits are assumed to be decimal fraction digits.