| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| puttu Beginner
 
 
 Joined: 29 Jul 2010
 Posts: 41
 Topics: 9
 
 
 | 
			
				|  Posted: Tue Aug 10, 2010 11:03 am    Post subject: merging records |   |  
				| 
 |  
				| hi, I need a sort conditionto merge two files into the one file.
 
 Please find the details:
 input file:
 file 1 : 1st position to 15th position having data (acct-nbr)
 file 3 : 16th postion to 32nd positio having data (name).
 
 Output file:
 output file: 1st to 15th position (acct nbr),16th to 32nd (name)
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Tue Aug 10, 2010 11:19 am    Post subject: |   |  
				| 
 |  
				| puttu, 
 huh? What is the Matching key in both files?
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| puttu Beginner
 
 
 Joined: 29 Jul 2010
 Posts: 41
 Topics: 9
 
 
 | 
			
				|  Posted: Tue Aug 10, 2010 11:25 am    Post subject: |   |  
				| 
 |  
				| kolusu, in file 1 we have starting position 00 for all reords.
 in file 2 we have starting position 2010 for all records.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| puttu Beginner
 
 
 Joined: 29 Jul 2010
 Posts: 41
 Topics: 9
 
 
 | 
			
				|  Posted: Tue Aug 10, 2010 11:59 am    Post subject: |   |  
				| 
 |  
				| kolusu, a bit confusion...
 can u please send a exact code for my requirement....
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Tue Aug 10, 2010 12:17 pm    Post subject: |   |  
				| 
 |  
				|  	  | puttu wrote: |  	  | kolusu, a bit confusion...
 can u please send a exact code for my requirement....
 | 
 
 
  just unbelievable _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| puttu Beginner
 
 
 Joined: 29 Jul 2010
 Posts: 41
 Topics: 9
 
 
 | 
			
				|  Posted: Tue Aug 10, 2010 12:46 pm    Post subject: |   |  
				| 
 |  
				| kolusu, 
 for my requirement. i dont want to check key.
 just i want to merge.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| puttu Beginner
 
 
 Joined: 29 Jul 2010
 Posts: 41
 Topics: 9
 
 
 | 
			
				|  Posted: Tue Aug 10, 2010 1:41 pm    Post subject: |   |  
				| 
 |  
				| Hi kolusu, 
 Please find the detailed explanation of my requirement:
 
 need a sort conditionto merge two files into the one file.
 
 Please find the details:
 input file:
 file 1 : 16th postion to 31st position having data.
 file 2 : 1st position to 15th position having data.
 
 Output file:
 output file: 1st to 15th position ,16th to 32nd
 
 input file 1 format:
 from 1st postion spaces, 16th to 31 having date.
 
 file 2 format:
 1st to 15th time stamp
 
 output should be:
 1,16 date, 17,15 timestamp
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Tue Aug 10, 2010 2:14 pm    Post subject: |   |  
				| 
 |  
				| puttu, 
 
  you don't get it don't you? sigh ok explain me from the following input 
 File 1 has 5 records like shown below
 
 File 2 has only 3 records like shown below.
 
 if the criteria is to match record-1 or file 1 with record-2 of file 2 then then the output is shown below.
 
 Now the question is what happens when the files DO NOT have the same number of records like shown below?
 
 Technically you ALWAYS will have a KEY if you want to merge contents from 2 different files. In this case it is the record number.  Remember that we can't see your data nor read your mind. So Please specify everything so that we wont be wasting time.
 
 
 
 FILE : 1
 
  	  | Code: |  	  | ----+----1----+----2----+----3----+----4----+----5--
 AAAAAAAAAAAAAAAA - RECORD 01
 BBBBBBBBBBBBBBBB - RECORD 02
 CCCCCCCCCCCCCCCC - RECORD 03
 DDDDDDDDDDDDDDDD - RECORD 04
 EEEEEEEEEEEEEEEE - RECORD 05
 
 | 
 
 FILE : 2
 
  	  | Code: |  	  | ----+----1----+----2----+----3----+----4----+----5--
 111111111111111 - RECORD 01
 222222222222222 - RECORD 02
 333333333333333 - RECORD 03
 
 | 
 
 
 OUTPUT :
 
  	  | Code: |  	  | ----+----1----+----2----+----3----+----4----+----5--
 AAAAAAAAAAAAAAAA 111111111111111
 BBBBBBBBBBBBBBBB 222222222222222
 CCCCCCCCCCCCCCCC 333333333333333
 DDDDDDDDDDDDDDDD ????????
 EEEEEEEEEEEEEEEE ????????
 
 | 
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| puttu Beginner
 
 
 Joined: 29 Jul 2010
 Posts: 41
 Topics: 9
 
 
 | 
			
				|  Posted: Tue Aug 10, 2010 2:38 pm    Post subject: |   |  
				| 
 |  
				| kolusu, what u taken examples & output also correct.
 here in my case always both the files will have same records 100%.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Tue Aug 10, 2010 2:46 pm    Post subject: |   |  
				| 
 |  
				| puttu, 
 
 Use the folloiwng DFSORT JCL which will give you the desired results
 
  	  | Code: |  	  | //STEP0100 EXEC PGM=SORT
 //SYSOUT   DD SYSOUT=*
 //INA      DD *
 AAAAAAAAAAAAAAAA
 BBBBBBBBBBBBBBBB
 CCCCCCCCCCCCCCCC
 //INB      DD *
 111111111111111
 222222222222222
 333333333333333
 //SORTOUT  DD SYSOUT=*
 //SYSIN    DD *
 OPTION COPY
 JOINKEYS F1=INA,FIELDS=(33,8,A),SORTED,NOSEQCK
 JOINKEYS F2=INB,FIELDS=(33,8,A),SORTED,NOSEQCK
 JOIN UNPAIRED
 REFORMAT FIELDS=(F1:16,16,F2:1,15)
 //JNF1CNTL DD *
 INREC OVERLAY=(33:SEQNUM,8,ZD)
 //JNF2CNTL DD *
 INREC OVERLAY=(33:SEQNUM,8,ZD)
 //*
 | 
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |