MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Comparing the same file records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Thu Oct 18, 2007 4:36 pm    Post subject: Comparing the same file records Reply with quote

Hi,

I have one input file VSAM 50 bytes all alphanumeric
fields:
A : 1- 12 can be duplicate
B : 13-21 can be duplicate but for a corresponding 1 - 12 field number, it won't be duplicate
C : 22-40 something (which i want to compare)
D : 41-50 something...

Also, in A field, I want only specific : e.g. AAAA,BBBB,AB,BC. which was easy using INCLUDE COND.

Then, I used SELECT ... ALLDUPS (on A field) to get only the duplicate records with A field and (AAAA,BBBB,AB or AC) in B field.

Plus, the input file is such that if in one record for some A field, B field = AAAA then it will also have one more record for the same A field and B field = BBBB

Similarly the same as B field = AB and BC.

What I need is : say for particular A field it has two records with B field = AAAA and BBBB. I want to compare C field (22-40 bytes) (of these two records). If same, write both the record in output file.

similarly for some particular A field it will have two records with B field = AB and BC. so, want to compare their C fields. If same, write both the records in output file.

I hope I have been able to explain precisely.

I know splice may work (in addition to something else) but not exactly getting how to work out with splice in this requirement.

Any help will be greatly appreciated.

thanks.
Back to top
View user's profile Send private message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Thu Oct 18, 2007 4:39 pm    Post subject: Reply with quote

Quote:

Also, in A field, I want only specific : e.g. AAAA,BBBB,AB,BC. which was easy using INCLUDE COND.


Please read this line as :

Also, in B field, I want only specific : e.g. AAAA,BBBB,AB,BC. which was easy using INCLUDE COND.
_________________
Thanks.
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Thu Oct 18, 2007 11:47 pm    Post subject: Reply with quote

seekaysk
Looks lot many constraints, unfolding your requirement and building a sample i/p file would be difficult by reading your comments.
Better yourself provide a sample i/p file and expected o/p file by considering good amount of cases.
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Fri Oct 19, 2007 1:11 am    Post subject: Reply with quote

seekaysk,

As said above... Providing a sample input file and an output file would be helpful.
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Fri Oct 19, 2007 8:10 am    Post subject: Reply with quote

Sample Input file:

Code:
       ----+----1----+----2----+----3----+----4----+--
REC1   123456789012AAAA    EEEEEEE EEEEEEE EEEEXXXXXXX
REC2   234567890123AB      GGGGGGGGG GGGGGGGGGGYYYYYYY
REC3   123456789012BBBB    EEEEEEE EEEEEEE EEEEZZZZZZZ
REC4   123456789012AB      FFFFFFFFFFF FFFFFFFFPPPPPPP
REC5   123456789012BC      FFFFFFFFFFF FFFFFFFFPPPPPPP
REC6   234567890123BC      HHHHHHHHH HHHHHHHHHHYYYYYYY



In short, the input file will have duplicate records (more than one) in 1 - 12 bytes. In the sample file REC1, 3, 4 AND 5 are duplicate and similarly REC2 and REC6. What I want is to compare the records on 21 - 40 bytes (AAAA with BBBB) and similarly (AB with BC)

That means, in this case, I want to compare 21 - 40 bytes of REC1 and REC3. since these bytes match, write both the records to output file.
Similarly, I want to compare 21 - 40 bytes of REc4 and REC5. since these bytes match write both the records to output file.

Similarly, as you can see, 1 - 12 bytes of REC2 and REC6 matches. But comparing their 21-40 bytes, they are not same. so we would not write them to output file.
_________________
Thanks.
Back to top
View user's profile Send private message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Fri Oct 19, 2007 8:21 am    Post subject: Reply with quote

Hi,

I am suggesting the solution for this.

We can splice REC1 and REC3. Similarly REC4 and REC5 and similarly REC2 and REC6.

After splicing, how to compare the 21-40 bytes with 71-90* bytes of same record ?

* --> considering input file is of 50 bytes.

I would appreciate if you can give me the code for splice too.

thanks all for the help.
_________________
Thanks.
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 9:00 am    Post subject: Reply with quote

seekaysk
You Dont need a SPLICE operator here, SELECT operator would suffice your requirement.
Try this ICETOOL JOB.
This JOB would work untill and unless there are no duplicates from 1-16 bytes.
Code:
//*******************************************************               
//GETMATCH EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
123456789012AAAA    EEEEEEE EEEEEEE EEEEXXXXXXX                         
234567890123AB      GGGGGGGGG GGGGGGGGGGYYYYYYY                         
123456789012BBBB    EEEEEEE EEEEEEE EEEEZZZZZZZ                         
123456789012AB      FFFFFFFFFFF FFFFFFFFPPPPPPP                         
123456789012BC      FFFFFFFFFFF FFFFFFFFPPPPPPP                         
234567890123BC      HHHHHHHHH HHHHHHHHHHYYYYYYY                         
/*                                                                     
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 SELECT FROM(IN1) TO(OUT) ON(1,12,CH) ON(81,1,CH) ON(21,20,CH) ALLDUPS-
 USING(CP01)                                                           
/*                                                                     
//CP01CNTL DD *                                                         
  INREC  IFTHEN=(WHEN=(13,4,CH,EQ,C'AAAA',|,13,4,CH,EQ,C'BBBB'),       
         OVERLAY=(81:C'1')),                                           
         IFTHEN=(WHEN=(13,4,CH,EQ,C'AB  ',|,13,4,CH,EQ,C'BC  '),       
         OVERLAY=(81:C'2'))                                             
  OUTFIL BUILD=(1,80)                                                   
//*                                                                     


OUT contains:
Code:
123456789012AAAA    EEEEEEE EEEEEEE EEEEXXXXXXX                                 
123456789012BBBB    EEEEEEE EEEEEEE EEEEZZZZZZZ                                 
123456789012AB      FFFFFFFFFFF FFFFFFFFPPPPPPP                                 
123456789012BC      FFFFFFFFFFF FFFFFFFFPPPPPPP                                 

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Fri Oct 19, 2007 9:49 am    Post subject: Reply with quote

krisprems,

thanks a lot. It looked so easy. Infact, first time I am seeing practical use of multiple ON's. Thanks.

vivek, thanks to you too.
_________________
Thanks.
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 9:54 am    Post subject: Reply with quote

seekaysk
You are welcome, For more understanding of DFSORT/ICETOOl refer to z/OS DFSORT: Getting Started (April, 2006) and other books here
http://www-304.ibm.com/jct01004c/systems/support/storage/software/sort/mvs/srtmpub.html
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Fri Oct 19, 2007 10:18 am    Post subject: Reply with quote

krisprems,

Hey, i am sorry. I just misunderstood the requirement. the output file should contain the mismatched records.

I believe just changing from ALLDUPS to NODUPS wouldn't work here. As in this case, we need ON(1,12,CH) ON(81,1,CH) to match but ON(21,20,CH) to mismatch.

Kindly let me know.
_________________
Thanks.
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 10:23 am    Post subject: Reply with quote

NODUPS would result in these records
Code:
234567890123AB      GGGGGGGGG GGGGGGGGGGYYYYYYY
234567890123BC      HHHHHHHHH HHHHHHHHHHYYYYYYY

If this is what is needed go ahead else explain what you expect in o/p
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group