Merge Header file and detail file



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

Merge Header file and detail file

Postby avinashmusic » Wed Dec 25, 2013 12:58 pm

Hi Experts,

I have a requirement where i have to merge a file having header records and a file having detail records under its respective header records. Both the input files of length 200

Sample file 1 (header):
HAAAAAA7867AAAA
HBBBBBBB6567BBBB
HCCCCCC5456CCCC


Sample file 2 (detail):
D7867ABABABAB
D7867BABABABA
D6567CDCDCDCD
D5456EFEFEFEF
D5456GHGHGHGH


Output should be like:
HAAAAAA7867AAAA
D7867ABABABAB
D7867BABABABA
HBBBBBBB6567BBBB
D6567CDCDCDCD
HCCCCCC5456CCCC
D5456EFEFEFEF
D5456GHGHGHGH


Can someone please help me with this?
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge Header file and detail file

 

Re: Merge Header file and detail file

Postby BillyBoyo » Wed Dec 25, 2013 5:35 pm

Is it important the the original sequence of the details-file is the order of the output file? It would be easier if it could be in key order.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Merge Header file and detail file

Postby avinashmusic » Wed Dec 25, 2013 5:47 pm

Any order could do.. thanks in advance
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge Header file and detail file

Postby BillyBoyo » Wed Dec 25, 2013 6:43 pm

OK. We need to know which SORT product and version you actually have at your site. Have a look at the sysout from a SORT step and post the information please. Likely it will be DFSORT or SyncSort, but we need to also know the version (if DFSORT need to see ICE201I message as well).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Merge Header file and detail file

Postby avinashmusic » Wed Dec 25, 2013 8:55 pm

Umm.. Am afraid i cannot see it right now as i am at home, can you not provide the solution for this, so that i try it tomorrow and see if it works?

Sorry if i am troubling. :)
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge Header file and detail file

Postby Terry Heinze » Thu Dec 26, 2013 8:14 am

The solution will depend upon the answers you provide to BillyBoyo's questions.
.... Terry
Terry Heinze
 
Posts: 199
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 10 times
Been thanked: 11 times

Re: Merge Header file and detail file

Postby avinashmusic » Thu Dec 26, 2013 10:30 am

Here you go..

ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-K59562 C6-BASE   C7-K58148 C8-K58148 E9-K58148 C9-BASE   E5-K59517
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 23:07 ON TUE DE
              INREC IFTHEN=(WHEN=INIT,OVERLAY=(91:C'A')),                       
                    IFTHEN=(WHEN=(1,1,SS,EQ,C'H,D'),OVERLAY=(91:C'B'))         
              SORT FIELDS=COPY                                                 
              OUTREC IFTHEN=(WHEN=(91,1,CH,EQ,C'A'),OVERLAY=(92:SEQNUM,5,ZD))   
              OUTFIL BUILD=(1,80),OMIT=(92,5,ZD,GT,1)                           
ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-K59562 C6-BASE   C7-K58148 C8-K58148 E9-K58148 C9-BASE   E5-K59517
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
ICE088I 0 T040CJ7H.SORT    .        , INPUT LRECL = 200, BLKSIZE = 4000, TYPE =
ICE093I 0 MAIN STORAGE = (MAX,62914560,62914560)                               
ICE156I 0 MAIN STORAGE ABOVE 16MB = (62857200,62857200)                         
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=62914560,MAXLIM=2097152,MINLIM=1048576,EQUALS=N,LIST=Y,E
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=FULL ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=62914560,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=N,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=2097152,SOLRF=Y,VLLONG=N
ICE235I 0 OPTIONS: NULLOUT=RC0                                                 
ICE236I 0 OPTIONS: DYNAPCT=10 ,MOWRK=Y                                         
ICE084I 0 EXCP ACCESS METHOD USED FOR SORTIN                                   
ICE231I 0 STORAGE USED FOR OUTFIL : BELOW 16M = 20480, ABOVE 16M = 2121728     
ICE210I 0 SORTOUT  : EXCP USED, LRECL = 80, BLKSIZE = 27920, TYPE = FB   (SDB) 
ICE751I 1 EF-BASE   CB-BASE   F0-K62422 E8-K58148                               
ICE055I 0 INSERT 0, DELETE 0                                                   
ICE054I 0 RECORDS - IN: 263, OUT: 263                                           
ICE227I 0 SORTOUT  : DELETED = 0, REPORT = 0, DATA = 263                       
ICE228I 0 SORTOUT  : TOTAL IN = 263, TOTAL OUT = 263                           
ICE052I 0 END OF DFSORT     


Code'd
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge Header file and detail file

Postby BillyBoyo » Thu Dec 26, 2013 3:19 pm

The ICE message-prefix tells that you have DFSORT at your site. The topic has been moved to the appropriate forum.

The G in the ICE201I message says that you have JOINKEYS available.

I assumed the extra B in your sample data was a typo.

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  JOINKEYS F1=INA,FIELDS=(2,4,A,1,1,D)
  JOINKEYS F2=INB,FIELDS=(8,4,A,1,1,D)
  JOIN UNPAIRED,ONLY
  REFORMAT FIELDS=(F1:1,80,?,F2:1,80)
                                       
  INREC IFOUTLEN=80,
        IFTHEN=(WHEN=(81,1,CH,EQ,C'2'),
                  BUILD=(82,80))
                                       
//INA      DD *
D7867ABABABAB
D7867BABABABA
D6567CDCDCDCD
D5456EFEFEFEF
D5456GHGHGHGH
//INB      DD *
HAAAAAA7867AAAA
HBBBBBB6567BBBB
HCCCCCC5456CCCC



This gives:

HCCCCCC5456CCCC
D5456EFEFEFEF   
D5456GHGHGHGH   
HBBBBBB6567BBBB
D6567CDCDCDCD   
HAAAAAA7867AAAA
D7867ABABABAB   
D7867BABABABA   


You can't just take the code, you need to understand it. So, what does it do, how does it work? If you don't know, ask. If you do, tell please.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Merge Header file and detail file

Postby avinashmusic » Thu Dec 26, 2013 3:33 pm

If you can explain me this, it wouldbe great. - I asked :)
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge Header file and detail file

Postby avinashmusic » Thu Dec 26, 2013 3:48 pm

Bily, You're a genius. It worked. :). Thanks
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post