View previous topic :: View next topic
Author
Message
madhavihmk New User Joined: 31 Jan 2006Posts: 8 Location: Chennai
I have two PS files A and B.
Both are of the same length, say 80.
I want to compare A recs with that of B and write them to
two different ouput files C and D of length 81.
C will contain the records from A
which has matched with B, the last byte should be appended with M( Matched)
D will contain the records from A
which has not matched with B, the last byte should be appended with N( not matched).
Please let me know a solution using sort utility.
Thanks
Hema
Back to top
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
HI Hema,
Code:
//STEP0100 EXEC PGM=ICETOOL
//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
AAA123BBBBBB
AAA222BBBBBB
AAA333CCCCCCC
/*
//IN2 DD *
AAA111BBBBBB
AAA222BBBBBB
AAA333CCCCCCC
/*
//T1 DD DSN=&T1,SPACE=(CYL,(5,5),RLSE),DISP=(MOD,PASS)
//FILEA DD SYSOUT=*
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SORT FROM(T1) USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,OUTREC=(1,80,C'1')
/*
//CTL2CNTL DD *
OUTFIL FNAMES=T1,OUTREC=(1,80,C'2')
/*
//CTL3CNTL DD *
OPTION EQUALS
SORT FIELDS=(1,13,CH,A)
SUM FIELDS=(81,1,ZD)
OUTFIL FNAMES=OUT,INCLUDE=(81,1,ZD,EQ,3),OUTREC=(1,80,C'M')
OUTFIL FNAMES=FILEA,INCLUDE=(81,1,CH,EQ,C'1'),OUTREC=(1,80,C'N')
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Hema,
Do you want to compare the records on all 80 bytes, or on a particular field?
Can there be duplicate records with fileA? Can there be duplicate records within fileB?
Please show an example of the records in the input files (including duplicates within each file if appropriate) and the expected output records.
Back to top
madhavihmk New User Joined: 31 Jan 2006Posts: 8 Location: Chennai
Hi Frank,
File A and File B will contain mostly the same records.
File A will be a input file and File B is an unload from a database table.
So i will be doing a comapre on the whole record, 80 bytes and there will no duplicates.
Format for the files
ModelNoVersionNo.
Eg File- A
Model1Version1
Model2Version2
Model3Version3
Model4Version4
Eg File-B
Model1Version1
Model2Version1
Model3Version2
Model4Version4
Output
File-C
Model1Version1M
Model4Version4M
File-D
Model2Version2N
Model3Version3N
This is my expected output.
Thanks
Hema
Back to top
madhavihmk New User Joined: 31 Jan 2006Posts: 8 Location: Chennai
Thanks Ekta , the got the output .
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Hema,
Here's another way to do what you asked for with DFSORT/ICETOOL. I assumed your input has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/80)
//IN2 DD DSN=... input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1 DD DSN=... output file1 (FB/80) - matched
//OUT2 DD DSN=... output file2 (FB/80) - unmatched
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT1) ON(1,80,CH) ALLDUPS DISCARD(OUT2) -
USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),
OVERLAY=(81:C'M')
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'1'),
OVERLAY=(81:C'N')
/*
Back to top
Please enable JavaScript!