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
 

 

Compare 2 PS, Each having RECL as 500

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

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Wed Mar 25, 2009 7:06 pm    Post subject: Compare 2 PS, Each having RECL as 500
Reply with quote

Hi All,

I want some help on the below.

I have 2 PS: PS1 and PS2. Each having RECL as 500.
I want to compare PS2 with PS1 and write records in PS3 which are present in PS2 but not in PS1. Please suggest how can i do it. Both PS1 and PS2 contains millions of records.

e.g.
Input PS1
Code:

abcdefghi
pppppppp
qqqqqqqq
rrrrrrrrrrr
yyyyyyyy
nnnnnnnn
xxxxxxxx


Input PS2
Code:

iiiiiiiiiiiiiiiiii
pppppppp
llllllllllllllllllllllll
zzzzzzzzzzzz
xxxxxxxxxx
nnnnnnnnnn
rrrrrrrrrrrrrr


Output PS3
Code:

iiiiiiiiiiiiiiiiiii
lllllllllllllllllll
zzzzzzzzzz
rrrrrrrrrrrr
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Mar 25, 2009 7:23 pm    Post subject:
Reply with quote

Once again,
1. What is the RECFM of each file and the LRECL of each?
2. What are the positions, length and format of the keys for matching?
3. Are the files already sorted?
4. Are there duplicate keys in either file?
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Wed Mar 25, 2009 7:29 pm    Post subject:
Reply with quote

Craq Giegerich wrote:
Once again,
1. What is the RECFM of each file and the LRECL of each?
2. What are the positions, length and format of the keys for matching?
3. Are the files already sorted?
4. Are there duplicate keys in either file?


1. RECFM is FB. LRECL is 200.

2. We would have to match the whole record(200 bytes) in PS2 with PS1. There is no unique key available.

3. No, the files are not sorted. They are just record exracts from database.

4. No records (200 byte) will be duplicate.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed Mar 25, 2009 7:44 pm    Post subject:
Reply with quote

A search on "compare files duplicates" turned up one that is (almost) exactly what you are asking for:
Compare File B with File A and eliminate duplicate
By the way,
Quote:
Each having RECL as 500.

Quote:
the whole record(200 bytes)

which one is correct?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Mar 25, 2009 9:38 pm    Post subject:
Reply with quote

Since the files are not in sequence and do not have matching keys then you would have to compare all of the records in PS1 with all of the records in PS2. For millions of records that would be a ridiculous idea, you had better redesign the process.
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: Wed Mar 25, 2009 10:45 pm    Post subject:
Reply with quote

Akash,

Assuming that the LRECL is 200 and you want to match on all 200 bytes, here's a DFSORT/ICETOOL job that will do what you asked for.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/200)
//IN2 DD DSN=...  input file2 (FB/200)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/200)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,200,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(201:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(201:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(201,1,CH,EQ,C'2'),
    BUILD=(1,200)
/*


Note that the ouput records will be in sorted order. If you really want them in their original order, we'd have to add a sequence number and another pass to sort on that sequence number.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Wed Mar 25, 2009 10:45 pm    Post subject:
Reply with quote

Now, Craq, for two million records in each file that would only require a total of 4 trillion compares. Surely the z10 could get 4 trillion compares done in a few thousand CPU seconds (maybe a week or two elapsed time)? icon_biggrin.gif
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: Wed Mar 25, 2009 10:47 pm    Post subject:
Reply with quote

Quote:
Since the files are not in sequence and do not have matching keys then you would have to compare all of the records in PS1 with all of the records in PS2. For millions of records that would be a ridiculous idea, you had better redesign the process.


SELECT sorts the records so it only has to compare adjacent sorted records - it does not have to compare all of the records in PS1 with all of the records in PS2.
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Mon Mar 30, 2009 4:31 pm    Post subject: Reply to: Compare 2 PS, Each having RECL as 500
Reply with quote

Thanks a lot Frank.
Its working absolutely fine. icon_smile.gif
Your time and help is much appreciated.
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 member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts fuzzy compare Martylin JCL & VSAM 9 Thu Mar 30, 2017 2:45 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


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