IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can I write duplicate records using sort file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Mon Feb 04, 2008 4:33 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Feb 04, 2008 10:12 pm
Reply with quote

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
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Thu Mar 06, 2008 3:47 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 06, 2008 5:20 am
Reply with quote

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
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Thu Mar 06, 2008 8:47 pm
Reply with quote

THANK YOU VERY MUCH FRANK. IT HELPS TO HAVE A NICE AND KNOWLEDGABLE GUY LIKE YOU ON THE FORUM.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Mar 06, 2008 11:23 pm
Reply with quote

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... icon_smile.gif . 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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top