Merge 2 files with header detail and trailer



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Merge 2 files with header detail and trailer

Postby sethukutty » Thu Mar 07, 2019 2:27 am

Need to combine 2 input files into one output files after keeping just one header and footer. Footer is just copy of header with record count. All files are 600 length.

I/P File1
ZZZZZZZZZ02272019ZZZZZZ      
AAAAAAA                      
BBBBBBB                      
CCCCCCC                      
DDDDDDD                      
EEEEEEE                      
ZZZZZZZZZ02272019ZZZZZZ000005


I/P File2
ZZZZZZZZZ02272019ZZZZZZ      
FFFFFFF                      
GGGGGGG                      
ZZZZZZZZZ02272019ZZZZZZ000002
 

Output File
ZZZZZZZZZ02272019ZZZZZZ      
AAAAAAA                      
BBBBBBB                      
CCCCCCC                      
DDDDDDD                      
EEEEEEE  
FFFFFFF                      
GGGGGGG                    
ZZZZZZZZZ02272019ZZZZZZ000007  ---COPY OF THE HEADER PLUS RECORD COUNT


I used the following SORT card and achieved what I want but I physically inserted the footer and then calculated the record count as you see. But I do want to copy the header into footer and then add the record count so that I get the updated date. Appreciate any help.

INREC BUILD=(1,600,SEQNUM,10,ZD)                            
SORT FIELDS=COPY                                            
OUTFIL REMOVECC,BUILD=(1,600),OMIT=(601,10,ZD,GT,+1,AND,    
    1,9,CH,EQ,C'ZZZZZZZZZ'),                                    
TRAILER1=(C'ZZZZZZZZZ02272019ZZZZZZ',COUNT-1=(M11,LENGTH=6))
 

Thanks


CODE' D
sethukutty
 
Posts: 12
Joined: Fri Jun 20, 2014 6:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge 2 files with header detail and trailer

 

Re: Merge 2 files with header detail and trailer

Postby expat » Thu Mar 07, 2019 12:31 pm

Have you downloaded and read the DFSORT smart tricks pdf that was written by Frank Yaeger ?

If not, do so, because it is detailed in that document.
You can probably find it from the DFSORT reference material section at the top of this forum section.
If not, you can always google it :mrgreen:
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: Merge 2 files with header detail and trailer

Postby NicC » Thu Mar 07, 2019 3:54 pm

Please use the code tags when posting data, code, etc. You were asked to do this in a previous post. Failure to do so in future could lead to your post being deleted.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3004
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post