Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can I write duplicate records using sort file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Can I write duplicate records using sort file
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 Moderator


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

PostPosted: Mon Feb 04, 2008 10:12 pm    Post subject:
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    Post subject: WORKS
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 Moderator


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

PostPosted: Thu Mar 06, 2008 5:20 am    Post subject:
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:

http://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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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    Post subject: COOL
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

Senior Member


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

PostPosted: Thu Mar 06, 2008 11:23 pm    Post subject: Re: COOL
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Matching and unmatched records!! Vignesh Sid SYNCSORT 3 Thu Nov 09, 2017 11:22 am
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us