Posted: Wed May 20, 2009 12:57 pm Post subject: Sort and Overlay
Hi All ,
I need to sort out records from file2 which matches the empnum and deptnum in file1 and also overlay pos 352 len 11 with the value given in file 1. Below is an example.
Code:
File 1 ( Length : 80 byte)
Emp num : Pos 1 length 6
dept num : pos 7 length 9
Amount : Pos 16 length 11
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed May 20, 2009 2:52 pm Post subject:
Martin,
Martin,
The following DFSORT JCL will give you the desired results. I assumed that your input 80 byte file does not have duplicates. I used $$ in first 2 pos to differentiate that it is a record from 80 byte file. Make sure that your 2000 byte input file does not have '$$' in pos 1 and 2.
The last byte in amount field ( 351 : 11 ) needs to hold the sign as well. But the above solution doesn't take care of this. Could you please let me know what changes need to be made?
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Thu May 21, 2009 12:52 pm Post subject:
Martin,
The explanation of the control cards
1. The INREC is putting the amount value from pos 351 for 11 bytes in pos 2001 for 11 bytes and the 2 byte indicator from pos1 from your input. So for every matched record in 80 byte file the indicator will be '$$'.
2. The splice statement will will splice the amount value and the indicator on to matching keys on 3,6, and 18,9
3. Using an OUTFIL include , we only pick the values which got a match from file2. The indicator specifies that it is match .
Now for the sign overpunch on the last byte , does your 80 byte file have positive and negative values? _________________ Kolusu
www.linkedin.com/in/kolusu
1. The INREC is putting the amount value from pos 351 for 11 bytes in pos 2001 for 11 bytes and the 2 byte indicator from pos1 from your input. So for every matched record in 80 byte file the indicator will be '$$'.
2. The splice statement will will splice the amount value and the indicator on to matching keys on 3,6, and 18,9
3. Using an OUTFIL include , we only pick the values which got a match from file2. The indicator specifies that it is match .
Now for the sign overpunch on the last byte , does your 80 byte file have positive and negative values?
Yes .. my file can have both negative and positive values:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum