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
 
How to create output files without duplicate record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Vkp321

New User


Joined: 05 Jan 2009
Posts: 35
Location: Pune

PostPosted: Thu Oct 22, 2009 1:27 pm    Post subject: How to create output files without duplicate record
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    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Oct 22, 2009 2:14 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 22, 2009 2:23 pm    Post subject:
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: 35
Location: Pune

PostPosted: Thu Oct 22, 2009 2:53 pm    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Fri Oct 23, 2009 7:06 am    Post subject:
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    Post subject:
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    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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Where is output from PARM ABEXIT (SNA... packerm CA Products 3 Thu Sep 28, 2017 4:06 pm
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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