Showing posts with label Working With COBOL Copybook in Informatica. Show all posts
Showing posts with label Working With COBOL Copybook in Informatica. Show all posts

Monday, May 20, 2013

Working With COBOL Copybook in Informatica


  •   The data structure from mainframe will come in a COBOL copy book format (.cpy). Sample copybook content is pasted below.


01 SALES-RECORD.                                                                                                 
                03  HDR-DATA.                                                                          
                   05  HDR-REC-TYPE                             PIC X.
                   05  HDR-STORE                           PIC X(02).
                03  STORE-DATA.
                   05  STORE-NAME                        PIC X(30).
                   05  STORE-ADDR1                       PIC X(30).
                   05  STORE-CITY                            PIC X(30).
                03  DETAIL-DATA REDEFINES STORE-DATA.
                   05  DETAIL-ITEM                            PIC 9(9).
                   05  DETAIL-DESC                         PIC X(30).
                   05  DETAIL-PRICE                   PIC 9(4)V99.
                   05  DETAIL-QTY                             PIC 9(5).
                   05  SUPPLIER-INFO OCCURS 4 TIMES.
                                   10  SUPPLIER-CODE          PIC XX.
                                   10  SUPPLIER-NAME      PIC X(8). 


  • We need to add the standard header part and footer part to the copybook and save it as .cbl file which can be imported to Informatica as source definition.





Header: 

IDENTIFICATION DIVISION.
                 PROGRAM-ID.   COPYBOOK.
ENVIRONMENT DIVISION.
                SELECT SALES ASSIGN TO F1.
DATA DIVISION.
FILE SECTION.
FD SALES.

Here ‘SALES’ will be the source Name.

Footer:

WORKING-STORAGE SECTION.
ROCEDURE  DIVISION.
STOP RUN.
  • Save the file as Sales.cbl and Import to informatica as shown below.

  

  •  The source will be imported like this.

  • The mapping will look like this where Cobol source will have a Normalizer by default in place of Source Qualifier.
 
   Important things to remember: COBOL copybook will have Redefines and occurrences in the 
   structure. Occurrences we can be removed by multiplying the same column that many times.