Posted: Mon Mar 10, 2003 3:21 pm Post subject: comparing two files
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.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Mar 10, 2003 6:39 pm Post subject:
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:
//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
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