One Star

Read Cobol packed (COMP-3) values from a file

I've got some flatfiles that have COMP-3 packed numbers. I don't have the possibility to run a program on the mainframe and change it there.
Is there any way to convert these to 'normal' numbers in talend?
Tags (1)
4 REPLIES
Employee

Re: Read Cobol packed (COMP-3) values from a file

With a Perl project, you can use a tPerlRow component with the following code:
use Convert::IBM390 qw(unpackeb packeb);
@output_row = @input_row;
($output_row) = unpackeb('p4', $input_row);

See Convert::IBM390 documentation on CPAN about the pattern used to extract field in unpackeb function.
What is the Cobol Copybook definition of the field?
One Star

Re: Read Cobol packed (COMP-3) values from a file

Hmm. That looks easy Smiley Happy Unfortunatly my project is Java but luckily i found a class that can do it. I found it here:
cobolConversion V0.0.3 package
http://jymengant.ifrance.com/jymengant/jurassicfaq.html
I read the file with fixed width columns. The packed columns with byte[] type, length 2. I pass the column data directly to a conversion method. Don't forget to uncheck trimming for the fields..
One Star

Re: Read Cobol packed (COMP-3) values from a file

This is the copybook:
FD FF-DOSSIER.
01 TVS1-DOSSIER.
03 AAA-DATA-BASE-KEY.
05 TAB-CODE PIC X(1) VALUE "D".
05 VWC PIC X(2).
05 JAAR PIC X(1).
05 DOCNR PIC X(4).
05 FILLER PIC X(23).
03 FAA-VNR-TELLER PIC S9(3) COMP-3.
03 FAB-POSTNR-TELLER PIC S9(3) COMP-3.
03 FAD-VLAG-INSCHR PIC X(1).
One Star

Re: Read Cobol packed (COMP-3) values from a file

Hi,
I was looking for code or routine to read copy book from MVS system using Talend3.0 tp apply transcodification to data stream. , please if you have it ,can you please send it my ID.
ronik.bahl@polaris.co.in
Thanks Ronik