Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
But I try and it is not working!!! Please help!
How can anyone help. . .
You joined the forum over 2 years ago and surely have seen how to receive help.
You need to post your jcl and control statements as well as any error messages presented by your test (make sure to include the message ids along with the text). When posting these, use the "Code" tag at the top of the reply panel for readability. When you have entered your post, use Preview so you can see your post the way it will appear to the forum, rather than how it looks in the reply editor. When you are satisfied with how your post looks, Submit.
If your test ran but did not produce the desired results, you need to post the output received.
You need to post any processing rules. For example what if there were a million records with ABC in file 2? What about duplicates in file 1? What if there is a "key" in file 2 that is not in file 1? Anything else you might think of that will prevent some surprise later?
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Anuj.D wrote:
Probably you can try this, I don't have access to mainframe just now so couldn't test but it should work
No the JCL posted by anuj will NOT work. Once you concatenate the 2 datasets your data is not sorted on the key fields and INREC is processed before the SORT,so the sequencing of the records will be wrong.
He is also missing DFSMSG dd statement and you really dont need SYSPRINT, SYSUDUMP & CEEDUMP dd statements
The following DFSORT/ICETOOL JCL will give you the desired results. I assumed that at any time you can have a max of 11 duplicates (1 from file + 10 duplicates from file 2)
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
Hi Kolusu,
Quote:
Once you concatenate the 2 datasets your data is not sorted on the key fields and INREC is processed before the SORT,so the sequencing of the records will be wrong.
Thanks for getting me corrected. I think the code of my post might have worked for the records of type
Code:
ABC 123
ABC aaa
ABC bbb
ABC ccc
DEF zzz
DEF 234
Please advice. I don't have access to Mainframes to these days, so can't check .
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
You can do this kind of thing more easily and efficiently with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's another variation on Kolusu's clever idea for using WHEN=GROUP for this situation.
This one has the advantage of doing one PUSH for each 4-byte field rather than a PUSH for the combined fields. On the other hand, for a different max, it would require changing the RECORDS values in the IFTHEN clauses whereas Kolusu's version doesn't. Either version will produce the same results, so use whichever one you prefer.