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
 

 

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 Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts JES2 doesn't honor the priority of th... Aron Lendvai JCL & VSAM 7 Thu Jun 29, 2017 1:41 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am


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