• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Read Cobol packed (COMP-3) values from a file

#1 2008-07-31 11:34:12

robvonk
Member
Company: Capire
Registered: 2007-10-25
Posts: 14
Website

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?

Offline

#2 2008-07-31 13:55:40

plegall
Member
Registered: 2006-09-19
Posts: 1586
Website

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

With a Perl project, you can use a tPerlRow component with the following code:

Code:

use Convert::IBM390 qw(unpackeb packeb);

@output_row = @input_row;
($output_row[field]) = unpackeb('p4', $input_row[field]);

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?

Offline

#3 2008-07-31 21:47:55

robvonk
Member
Company: Capire
Registered: 2007-10-25
Posts: 14
Website

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

Hmm. That looks easy smile 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..

Offline

#4 2008-08-01 08:01:02

robvonk
Member
Company: Capire
Registered: 2007-10-25
Posts: 14
Website

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).

Offline

#5 2009-02-11 12:48:42

Ronik
Guest

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

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Read Cobol packed (COMP-3) values from a file

Board footer

Powered by FluxBB