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

How to create output files without duplicate record


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

New User


Joined: 05 Jan 2009
Posts: 56
Location: Dublin

PostPosted: Thu Oct 22, 2009 1:27 pm
Reply with quote

With the sort card I am able to create two file but records are duplicated. Is there any solution so the output files will have only unique records?

SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(5,6,CH,EQ,C'202205',AND,19,2,CH,EQ,C'40'),
OUTREC=(1:19,2,3:196,2)
OUTFIL FILES=02,INCLUDE=(5,6,CH,EQ,C'202205',AND,19,2,CH,EQ,C'42'),
OUTREC=(1:19,2,3:196,2)
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Oct 22, 2009 2:07 pm
Reply with quote

Hi Pradeep,
Which sort product are you using? What is input and output datasets LRECL and RECFM.

What do you mean by unique records? do you mean combination of the 2,6,CH and 19,2,CH should be unique?

Can you please show us few records of input dataset and expected output for the same.(use code tag)
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Oct 22, 2009 2:14 pm
Reply with quote

Hi Pradeep,

what makes it a duplicate record ?

Please give example of input and output data.

If 2,6,CH and 19,2,CH are to be unique, does it mean only 1 record will be written to the output files ?



Gerry
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Oct 22, 2009 2:23 pm
Reply with quote

This works for me from what I understood of your request, although for testing purposes only I used an 80 byte record, changing your field at 196 into 26 for my test.
Code:

  SORT FIELDS=(19,2,A,26,2,A),FORMAT=CH                             
  SUM  FIELDS=NONE                                                   
  OUTFIL FILES=01,INCLUDE=(5,6,CH,EQ,C'202205',AND,19,2,CH,EQ,C'40'),
  OUTREC=(1:19,2,3:26,2)                                             
  OUTFIL FILES=02,INCLUDE=(5,6,CH,EQ,C'202205',AND,19,2,CH,EQ,C'42'),
  OUTREC=(1:19,2,3:26,2)                                             
Back to top
View user's profile Send private message
Vkp321

New User


Joined: 05 Jan 2009
Posts: 56
Location: Dublin

PostPosted: Thu Oct 22, 2009 2:53 pm
Reply with quote

Thanks Expat your solution worked.. icon_biggrin.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Oct 22, 2009 9:50 pm
Reply with quote

Vkp321,

I would use these control cards for better efficiency.

Code:

//SYSIN    DD *                                             
  INCLUDE COND=(5,6,CH,EQ,C'202205',AND,19,2,SS,EQ,C'40,42')
  INREC BUILD=(1:19,2,3:196,2)                               
  SORT FIELDS=(1,4,CH,A)                                     
  SUM FIELDS=NONE                                           
  OUTFIL FILES=01,INCLUDE=(1,2,CH,EQ,C'40')                 
  OUTFIL FILES=02,INCLUDE=(1,2,CH,EQ,C'42')                 
//*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Oct 23, 2009 7:06 am
Reply with quote

Hi Kolusu,

is it really necessary to sort the selected records, wouldn't the first occurrence of "40" and "42" do the trick ?


Gerry
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 23, 2009 8:39 pm
Reply with quote

gcicchet wrote:
Hi Kolusu,

is it really necessary to sort the selected records, wouldn't the first occurrence of "40" and "42" do the trick ?


Gerry


gcicchet,

I think it is the combination of 2 fields which makes it unique 19,2 and 196,2

ex :
Code:

40 AA
42 AA
40 AA
40 AA
42 BB
42 BB
40 CC


So unless you sort , how can you eliminate duplicates? If the data is already sorted on the above 2 keys , then yes SELECT operator can be used to pick the FIRST overriding the sort with sort fields=copy.
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top