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 two files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
ammukavi
Beginner


Joined: 10 Mar 2003
Posts: 1
Topics: 1

PostPosted: Mon Mar 10, 2003 3:21 pm    Post subject: comparing two files Reply with quote

Hi,

Can u please suggest me how to do this...

I want to compare two(new & OLD) GDG file and write them in three different files based on the comparison.

Suppose,
1. If any new item exist in the New file then write those records in a FILE1
2. If any records deleted from the New file then write those records in a FILE2
3. If any record is changed in the new file then write those items in a FILE3.

example,
New:

Member Flag
101 Y
102 Y
103 N (the flag is changed this record should be written in FILE3)
105 Y (this is new member so it should be written in FILE1)
(104 member is deleted in this new file so this should be written in FILE2)

OlD:

Member Flag
101 Y
102 Y
103 Y
104 Y

Please let me know if you need any more information regarding this.

Thanks,
Kavitha
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Mar 10, 2003 3:50 pm    Post subject: Reply with quote

kavitha,

This is quite similar to one of the topics which discusses about matching 2 files.Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=11

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Mar 10, 2003 6:39 pm    Post subject: Reply with quote

Kavitha,

If I understand what you want correctly, then if you have DFSORT R14 PTF UQ90053 (Feb, 2003), the DFSORT/ICETOOL job below using the new SPLICE operator will do what you want. For complete information on the SPLICE operator, see:

http://www.storage.ibm.com/software/sort/mvs/uq90053/online/srtmutol.html#spl

Code:

//STEP1    EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//OLD      DD *
101 Y
102 Y
103 Y
104 Y
/*
//NEW      DD *
101 Y
102 Y
103 N
105 Y
/*
//FILE1    DD DSN=...  records added to NEW file
//FILE2    DD DSN=...  records deleted from NEW file
//FILE3    DD DSN=...  records changed in NEW file
//T1       DD DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(5,5),RLSE)
//T2       DD DSN=&&T2,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(5,5),RLSE)
//CONCT    DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,DELETE)
//         DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,DELETE)
//TOOLIN   DD *
* Add '11' id to OLD records -> T1
  COPY FROM(OLD) TO(T1) USING(CTL1)
* Add '22' id to NEW records -> T2
  COPY FROM(NEW) TO(T2) USING(CTL2)
* Splice T2 flag and id into T1 record with matching key.
* Resulting output data sets are:
*  FILE3 - flag is 'N' and id is '12' for changed records
*  FILE2 -  id is '11' for deleted records
*  FILE1 -  id is '22' for added records
  SPLICE FROM(CONCT) TO(FILE3) ON(1,3,CH) WITH(5,1) WITH(82,1) -
    KEEPNODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,80,C'11')
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(1,80,C'22')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=FILE3,
    INCLUDE=(5,1,CH,EQ,C'N',AND,81,2,CH,EQ,C'12'),OUTREC=(1,80)
  OUTFIL FNAMES=FILE2,INCLUDE=(81,2,CH,EQ,C'11'),OUTREC=(1,80)
  OUTFIL FNAMES=FILE1,INCLUDE=(81,2,CH,EQ,C'22'),OUTREC=(1,80)
/*


The output of this job is as follows:

FILE3
103 N

FILE2
104 Y

FILE1
105 Y
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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