Extract text files and split the data into 3 files- design

I need to extract the text file which has fixed width fields containing header,line and batch related data . Now the initial fileds in each row has a flag like H or L or B respectively. I need to desiugn the job to split the data into 3 files containing header data only,line data and batch data only using the flag .

Please suggest how to proceed


kgecdeep (BOB member since 2012-07-25)

http://wiki.sdn.sap.com/wiki/display/EIM/Multirecord+Files


Werner Daehn :de: (BOB member since 2004-12-17)

Or you could use a case transform to identify the different record types and process accordingly.


Nemesis :australia: (BOB member since 2004-06-09)

Thanks for your suggestion, I have tried to split the source txt file into 3 files using cobol copybook as per the example.

I have created the cpy file and record trailer length as 2
but unable to get the proper output, i have set all the format,data file exactly same like the example given.

Please help me how to get the 3 different file Header, line and batch

Source File:

C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007
L00000000000000000000000000000000000000000000000000000000000000000000000000000000B 0000000016000000001150000000001840000000000001150000000000000000000000000000000
B0000000000000000000000000000000000000000000000000000000000000000000000000

cpy file:

01 HeaderRec.

02 r  PIC x.
02 c  PIC x.
02 t x(2).
02  y PIC x(8).
02  u PIC x(15).
02  ID PIC x(9).
02  Name PIC x(30).
02  OrderNumber  PIC x(20).
02  Date PIC x(8).
02 Amount  PIC x(13).
02 VAT PIC x(13).
02  Seg PIC x(3).
02 t PIC x(2).
 02 reason PIC x(4).

01 LineRec.

02 t PIC x.
02 g PIC x(15).
02 N PIC x(10).
02 col2 PIC x(20).
02 col3 PIC x(15).
02 col4 PIC x(30).
02 col5 PIC x(13).
02 col6 PIC x(13).
02 col7 PIC x(13).
02 col8 PIC x(14).
02 col9 PIC x(13).
02 col10 PIC x(13).

01 batch.

02 col1 PIC x.
02 col2 PIC x(15).
02 col3 PIC x(10).
02 col4 PIC x(15).
02 col5 PIC x(10).
02 col6 PIC x(10).
02 col7 PIC x(13).


kgecdeep (BOB member since 2012-07-25)

I really appreciate your support and help. But I am unable to solve my issue.

I have tried to split the source txt file into 3 files using cobol copybook as per the example you have shared with the link.

I have created the cpy file and record trailer length as 2
but unable to get the proper output, i have set all the format,data file exactly same like the example given.

Please help me how to get the 3 different file Header, line and batch

Source File:

C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007
L00000000000000000000000000000000000000000000000000000000000000000000000000000000B 0000000016000000001150000000001840000000000001150000000000000000000000000000000
B0000000000000000000000000000000000000000000000000000000000000000000000000

cpy file:

01 HeaderRec.

02 r PIC x.
02 c PIC x.
02 t x(2).
02 y PIC x(.
02 u PIC x(15).
02 ID PIC x(9).
02 Name PIC x(30).
02 OrderNumber PIC x(20).
02 Date PIC x(.
02 Amount PIC x(13).
02 VAT PIC x(13).
02 Seg PIC x(3).
02 t PIC x(2).
02 reason PIC x(4).

01 LineRec.

02 t PIC x.
02 g PIC x(15).
02 N PIC x(10).
02 col2 PIC x(20).
02 col3 PIC x(15).
02 col4 PIC x(30).
02 col5 PIC x(13).
02 col6 PIC x(13).
02 col7 PIC x(13).
02 col8 PIC x(14).
02 col9 PIC x(13).
02 col10 PIC x(13).

01 batch.

02 col1 PIC x.
02 col2 PIC x(15).
02 col3 PIC x(10).
02 col4 PIC x(15).
02 col5 PIC x(10).
02 col6 PIC x(10).
02 col7 PIC x(13).


kgecdeep (BOB member since 2012-07-25)

Please suggest


kgecdeep (BOB member since 2012-07-25)