Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Seperate duplicates & Unique records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
padma_prakasam

New User


Joined: 06 Oct 2005
Posts: 31

PostPosted: Fri Nov 18, 2005 11:43 am    Post subject: Seperate duplicates & Unique records
Reply with quote

Hi,

I'm having a file containing some records with duplicates. I need to write a JCL to write unique records in one output file and duplicates in another output file. This has to be done through JCL alone. How to code Jcl for this????

Thanks
padma.
Back to top
View user's profile Send private message

crm

New User


Joined: 14 Nov 2005
Posts: 25

PostPosted: Fri Nov 18, 2005 12:10 pm    Post subject: Re: Jcl required
Reply with quote

hai padma

u can do this by using SUMFIELDS=NONE

Here is the JCL code:

//JOB1 JOB MAC,123,CLASS=A,MSGCLASS=X
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=A
//SYSPRINT DD SYSOUT=A
//SORTIN01 DD DSN=FILE1,DISP=SHR
//SORTIN02 DD DSN=FILE2,DISP=SHR
//SORTIN03 DD DSN=FILE3,DISP=SHR
//OUTFILE DD DSN=IBM.MFS,DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(2,1),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN DD *
SUMFIELDS = NONE
/*
//

LET ME GIVE EXAMPLE;

Let FILE1 have

ram,sam,mac

Let FILE2 have

paul,ram

Let FILE3 have
sam,paul,mac

then OUTFILE wil give

ram,sam,mac,paul


if there are any mistakes in my answer let me know
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Nov 18, 2005 12:13 pm    Post subject:
Reply with quote

Hi,


Please use this JCl
.if anything wrong please let me know




//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=INPUT Dataset,DISP=SHR
//SORTOF01 DD DSN=OUTPUT Dataset,
// DCB=(BLKSIZE=0,RECFM=FB),
// SPACE=(CYL,(50,25),RLSE),UNIT=SYSDA,
// DISP=(NEW,CATLG,DELETE)
//SYSOUT DD SYSOUT=*
//SYUDUMP DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(9,4,BI,A) /*Sort Fields
SUM FIELDS=NONE
/*
Back to top
View user's profile Send private message
padma_prakasam

New User


Joined: 06 Oct 2005
Posts: 31

PostPosted: Fri Nov 18, 2005 12:14 pm    Post subject: Re: Jcl required
Reply with quote

Hi,

My requirement is to splitt a file having duplicates such that one output file should contain unique records and the other one contains duplicate records.
Back to top
View user's profile Send private message
reshma

New User


Joined: 10 Sep 2005
Posts: 9
Location: software engineer

PostPosted: Fri Nov 18, 2005 12:34 pm    Post subject: Re: Jcl required
Reply with quote

padma,

vicky has send u a correct solution for ur requirement..gothru it correctly
Back to top
View user's profile Send private message
padma_prakasam

New User


Joined: 06 Oct 2005
Posts: 31

PostPosted: Fri Nov 18, 2005 12:43 pm    Post subject: Re: Jcl required
Reply with quote

Hi,

The jcl which Mr.vicky has sent will retrieve unique records from the input file. That's fine. along with that i need one more output file which contains duplicated records that has been omitted in first output file.
suppose let the i/p file contents are like this
A,B,C,D,A,E,F,B (A,B apperars twice)
O/P 1 should be A,B,C,D,E,F
O/P 2 should be A,B
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Nov 18, 2005 1:40 pm    Post subject:
Reply with quote

Hi Padma,

Please check this link

http://www-03.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmst01.html
Back to top
View user's profile Send private message
stly
Warnings : 1

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Fri Nov 18, 2005 2:40 pm    Post subject: Re: Jcl to seperate duplicates & unique records in diff.
Reply with quote

hi padma use sumfields=none,xsum

in the jcl there must be a ddname as xsum so that the duplicate records will move to that dataset.

plesae correct if i m wrong
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Nov 18, 2005 4:06 pm    Post subject:
Reply with quote

Please use this jcl

//SORTXSUM DD DSN=&HQUAL..O4XS4787,
DISP=(NEW,CATLG,DELETE),
DCB=(LRECL=19,BLKSIZE=0,RECFM=FB),
SPACE=(CYL,(50,25),RLSE),UNIT=SYSDA

//SYSIN DD * SUM FIELDS=NONE,XSUM
//SORTWK01 DD SPACE=&SRTSZ.,UNIT=&SRTWK1
//SORTWK02 DD SPACE=&SRTSZ.,UNIT=&SRTWK2
//SORTWK03 DD SPACE=&SRTSZ.,UNIT=&SRTWK1
//SORTWK04 DD SPACE=&SRTSZ.,UNIT=&SRTWK2

If I wrong.Please let me know
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: Fri Nov 18, 2005 9:12 pm    Post subject:
Reply with quote

Padma,

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 *
A
B
C
D
A
E
F
B
/*
//FIRST DD DSN=...  output file1
//REST DD DSN=...   output file2
//TOOLIN DD *
SELECT FROM(IN) TO(FIRST) ON(1,1,CH) FIRST DISCARD(REST)
/*


FIRST will have:

Code:









REST will have:

Code:

A
B


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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Splitting of single report to seperat... abdulrafi TSO/ISPF 7 Mon Mar 27, 2017 3:59 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us