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 find the dup and non-dup in a PS file

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

Active User


Joined: 14 Sep 2009
Posts: 147
Location: Coimbatore

PostPosted: Tue Oct 13, 2009 7:09 pm    Post subject: How to find the dup and non-dup in a PS file
Reply with quote

Hi,

I have two files. I have to compare these two files and I have to seperate the duplicates and NON-dupes using JCL.

My shop uses DFSORT. Could anybody give me a jcl on how i can perform it.
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: Tue Oct 13, 2009 9:26 pm    Post subject:
Reply with quote

Quote:
I have to compare these two files and I have to seperate the duplicates and NON-dupes using JCL.


This is a rather ambiguous statement. It's not clear exactly what you want to do.

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 147
Location: Coimbatore

PostPosted: Mon Oct 19, 2009 4:08 pm    Post subject: Reply to: How to find the dup and non-dup in a PS file
Reply with quote

Input1:
Abdul
Prashant
Ram
Sam
Arun

Input2:
Abdul
Prashant
Ram

After comparison the output should like the one given below:

Output1:
Abdul
Prashant
Ram

Output2:
Sam
Arun
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Oct 19, 2009 9:03 pm    Post subject:
Reply with quote

abdulrafi,

The following DFSORT/ICETOOL JCL will give you the desired results


Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD *                                                       
ABDUL                                                                 
PRASHANT                                                             
RAM                                                                   
SAM                                                                   
ARUN                                                                 
//         DD *                                                       
ABDUL                                                                 
PRASHANT                                                             
RAM                                                                   
//OUT1     DD SYSOUT=*                                               
//OUT2     DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
SELECT FROM(IN) TO(OUT1) ON(1,10,CH) ALLDUPS DISCARD(OUT2) USING(CTL1)
//CTL1CNTL DD *                                                       
  OUTFIL FNAMES=OUT1,REMOVECC,NODETAIL,                               
  SECTIONS=(1,10,HEADER3=(1,80))                                     
  OUTFIL FNAMES=OUT2                                                 
//*
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 147
Location: Coimbatore

PostPosted: Mon Oct 19, 2009 10:22 pm    Post subject: Reply to: How to find the dup and non-dup in a PS file
Reply with quote

Thanks a lot for your help. The code is working.

But I have a doubt. Could you tell me what for,
SECTIONS=(1,10,HEADER3=(1,80)) this statement has been given for the file OUT1 and not for OUT2
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Oct 19, 2009 10:27 pm    Post subject:
Reply with quote

abdulrafi,

All the matching rows will be duplicates. Since you only wanted 1 record per duplicate , we use sections to eliminate the duplicates and only write the first dup.

Non matching keys are unique and you don't need to eliminate any records and hence we don't use sections

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
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Tue Oct 20, 2009 7:48 pm    Post subject:
Reply with quote

Hi Kolusu,

Thanks a lot for bringing such an wonderful utility into light.I was not aware of this. Earlier I used to code Cobol pgm to find duplicate and non duplicate records.
But I have some doubts with the CTL card. can you please help me in explaining that. Iwent through the link as mentioned by you but still have some doubts. My understanding is given below:

OUTFIL FNAMES=OUT1,REMOVECC,NODETAIL,
SECTIONS=(1,10,HEADER3=(1,80))
OUTFIL FNAMES=OUT2

1. I think REMOVECC removes duplicate.
2. NODETAIL is just to extract records in position 1-10 as given in the SECTIONS.
3.Sections is used to declare the layout of the output or sysout, of 80 bytes and 1-10 position will have the key on which it is compared.

Please correct me if my understandings are wrong.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Oct 20, 2009 10:26 pm    Post subject: Reply to: How to find the dup and non-dup in a PS file
Reply with quote

arindambanerjee,

You understanding of the keywords is completely wrong. I suggest you read this "DFSORT: Getting Started"

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG40/CCONTENTS


NODETAIL/REMOVECC is explained here

SECTIONS is explained here

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG40/2.6.8.6?
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 Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm

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