View previous topic :: View next topic
|
Author |
Message |
nivethitha_kumar
New User
Joined: 24 Jan 2007 Posts: 11 Location: chennai
|
|
|
|
i have two files.. i need to get the values that are present in file 1 but not file2...i am able to do it in two steps... is ther any way the utility can be used to do this in a single step... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Please show an example of the records in each input file and the expected output records. If file1 can have duplicates within it, show that in the example. If file2 can have duplicates within it, show that in the example.
What is the starting position, length and format of the value you want to compare on?
What is the RECFM and LRECL of the input files? |
|
Back to top |
|
|
nivethitha_kumar
New User
Joined: 24 Jan 2007 Posts: 11 Location: chennai
|
|
|
|
a sample file 1
aaaaa11111
aaaaa11111
bbbbb22222
cccccc33333
ddddd44444
a sample file 2
bbbbbb22222
cccccc333333
ddddd444444
eeeee555555
files 1 and 2 can have duplicates . My required output should be aaaaa1111.(ie the records present in file1 and not in file 2)
the record format of the files are 171
my actual data runs from pos 1 to 171 it consists of date, names etc space separated .. so i need to consider the entire record for comparison. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
For each set of records in file1 that doesn't have a match in file2, you only want the first record? For example, you just want the first aaaaa1111 record, not both aaaaa1111 records? |
|
Back to top |
|
|
nivethitha_kumar
New User
Joined: 24 Jan 2007 Posts: 11 Location: chennai
|
|
|
|
yes , i do not want duplicates |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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/171)
//IN2 DD DSN=... input file2 (FB/171)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/171)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,171,CH) -
WITH(1,172) KEEPNODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(172:C'BB')
/*
//CTL2CNTL DD *
INREC OVERLAY=(172:C'VV')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(172,2,CH,EQ,C'BB'),
BUILD=(1,171)
/*
|
|
|
Back to top |
|
|
nivethitha_kumar
New User
Joined: 24 Jan 2007 Posts: 11 Location: chennai
|
|
|
|
Thank you.. i came up with a similar thing.. though i used as the third condition i used select with nodups... what might be the difference between that and splice??? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
SELECT with NODUPS will not work if you have duplicates within each file. The SPLICE job I showed you will.
In your example, you show these records in input file1:
aaaaa11111
aaaaa11111
and you want this for output:
aaaaa11111
NODUPS won't give you that record for output because the input records are duplicates.
I gave you a DFSORT job that works for the example you gave which had duplicates within the input file. If NODUPS worked for you, then you don't have duplicates within the input file. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Or some number of records was "lost". . . . |
|
Back to top |
|
|
nivethitha_kumar
New User
Joined: 24 Jan 2007 Posts: 11 Location: chennai
|
|
|
|
This is what i had used and this worked even when there werte duplicates in the files.
SELECT FROM(INA1) TO(TE01) ON(1,171,CH) FIRST USING(CTL1)
COPY FROM(INA2) TO(TE01) USING(CTL2)
SELECT FROM(TE01) TO(OUT01) ON(1,171,CH) NODUPS USING(CTL3)
CTL1CNTL DD *
INREC OVERLAY=(172:C'1')
CTL2CNTL DD *
INREC OVERLAY=(172:C'2')
CTL3CNTL DD *
OUTFIL INCLUDE=(172,1,CH,EQ,C'1'),BUILD=(1,171)
so i was wondering what difference splice brings in . |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
This is what i had used and this worked even when there werte duplicates in the files.
SELECT FROM(INA1) TO(TE01) ON(1,171,CH) FIRST USING(CTL1) |
Well, no there weren't any duplicates in the first file because you eliminated them with the SELECT FIRST operator.
So you did SELECT (sort), COPY (copy) and SELECT (sort) whereas I did COPY (copy), COPY (copy) and SPLICE (sort). copy is more efficient than sort so doing two SELECTs instead of one SPLICE is usually less efficient. But you can certainly use your method if you like it better for some reason. |
|
Back to top |
|
|
nivethitha_kumar
New User
Joined: 24 Jan 2007 Posts: 11 Location: chennai
|
|
|
|
Thank you so much!!! |
|
Back to top |
|
|
|