View previous topic :: View next topic
|
Author |
Message |
puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
Hi,
How can I sort input file so that distinct records are written in 1 file and duplicates in another using SORT utility in JCL.
Field 1-10 check fpr the duplicates.
Thanks
Puneet |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Puneet,
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input data set
//OUT DD DSN=... first record with each key
//SORTXSUM DD DSN=... subsequent records with each key
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,10,CH) FIRST DISCARD(SORTXSUM)
/*
|
|
|
Back to top |
|
|
kirankumarj
New User
Joined: 18 Dec 2007 Posts: 51 Location: delaware
|
|
|
|
I tried this and worked.
//TOOLIN DD *
SELECT FROM(SORTIN) TO(SORTOUT) ON(30,8,CH) FIRST DISCARD(SORTXSUM)
//*
However,I have 2 questions.
1) Cant I have two keys in the sort condition ? I tried and it didnt allow.
2) When there are multiple keys, I need to extend to two lines.
In that scenario can "FIRST DISCARD" be in the next line? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Cant I have two keys in the sort condition ? I tried and it didnt allow. |
Yes. Just specify two ON fields.
Quote: |
can "FIRST DISCARD" be in the next line? |
Yes. End the first line with a dash and continue on the second line.
Code: |
SELECT FROM(SORTIN) TO(SORTOUT) ON(30,8,CH) ON(p,m,f) -
FIRST DISCARD(SORTXSUM)
|
where p,m,f is for your second key.
DFSORT's ICETOOL, like any program, has specific syntax you have to use. The syntax is completely defined in Chapter 6 of "z/OS DFSORT Application Programming Guide". Here's a link to that Chapter:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/6.0?DT=20060615185603
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
kirankumarj
New User
Joined: 18 Dec 2007 Posts: 51 Location: delaware
|
|
|
|
THANK YOU VERY MUCH FRANK. IT HELPS TO HAVE A NICE AND KNOWLEDGABLE GUY LIKE YOU ON THE FORUM. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
kirankumarj wrote: |
THANK YOU VERY MUCH FRANK. IT HELPS TO HAVE A NICE AND KNOWLEDGABLE GUY LIKE YOU ON THE FORUM. |
Hi,
I think You were excited enough after getting the solution...so the post is in CAPS... . Usually CAPS text is percepted for shouting.
And Yes, Frank is the Kernal Writer of ICETOOL so He knows everything about it, many times I proudly say that I know Frank...Perhaps one day I would be able to associate with Him..& Skolusu (another Intelligence in DFSORT) |
|
Back to top |
|
|
|