IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

comparision of two files on a particular field


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Sat Jan 19, 2008 12:10 am
Reply with quote

hi ,

i have a requirement like i have two files each with 5183 record length and fba recfm

now i have to compare the two files depending on a particular field in it

can any one give me a sort card using which i can compare only that field in both the files if got mismatch then display it in the output file.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jan 19, 2008 12:19 am
Reply with quote

Your requirement is unclear and your description does not contain any real details.

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Give the starting position, length and format of each relevant field. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Sat Jan 19, 2008 12:27 am
Reply with quote

hi frank,

thanks for your response

file1

name addr city state eff-dt .......
aaaa sssss dddd fffff 20060604

file2

name addr city state eff-dt .......
aaaa sssss dddd fffff 20070604


the eff-dt for some of the records is changing those records i need to trace out.

eff-dt is of length 10

since rec lngth is 5183 it is from 4510 to 4520

you take recordlength as 80 and give me the sort card i will change it accordingly.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Sat Jan 19, 2008 1:15 am
Reply with quote

Quote:
eff-dt is of length 10

since rec lngth is 5183 it is from 4510 to 4520

4510 to 4520 makes length of 11...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jan 19, 2008 1:37 am
Reply with quote

And the data posted look like a length of 8 . . .

Quote:
If you can't convince them, confuse them
It is working icon_smile.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jan 19, 2008 1:54 am
Reply with quote

Balakrishna,

Besides the confusion about where the key is and how long it is, you still didn't say anything about duplicates, or show a good example of input records and expected output records. Are you trying to provide the minimum information you can get away with? I'm happy to help, but I don't have time to guess at what you want, and I can't read your mind.
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Mon Jan 21, 2008 11:00 am
Reply with quote

Hi All,

I am very sorry that i didn't provide you all the information you needed,

both the files are ps having same type of data, but some of the records differs,i need to track those records and write into another file.

both the files have same attributes with record length 5183 and recfm fba,

i cant give you the exact example since it is very big record, i am giving you the sample which reflects the same as i need.

file-1 :
name addr city sum-no eff-dt

file-2 :
name addr city sum-no eff-dt

here sum-no is the unique key and eff-dt i need to check in both the files whether same or not.

sum-no is of length 10 from 60-69

eff-dt length 10 from 70-79

name is of length 20
addr of length -30
city of length 10

now can you give me sort card for this, file size for this sample is 80 and recfm is fba.

if i forgot any information to specify kindly let me know.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jan 21, 2008 11:04 pm
Reply with quote

Quote:
i cant give you the exact example since it is very big record, i am giving you the sample which reflects the same as i need.


I don't need the entire record - I just need the relevant fields which appear to be the sum-no and eff-dt.

I still don't know what you want to do. I don't know if either file can have duplicates within it. I don't know if every record in file1 has a sum-no match in file2, or there are records in file1 with a sum-no that isn't in file2, or there are records in file2 with a sum-no that isn't in file1 or what. I don't know if you just want records from file1 in the output, or just records from file2 in the output, or records from file1 and file2 in the output.

You don't seem to understand how to explain your requirement (despite the fact that there are hundreds of examples on this board), so I'll show you an example of what I'm looking for.

Let's say that every record in file1 has a sum-no match in file2, and for output you want the records from file1 and file2 that have a match on sum-no but don't have a match on eff-dt. There are no duplicates for sum-no within file1, and there are no duplicates for sum-no within file2.

So for example (I'm just showing the sum-no and eff-dt):

Input file1 has these records:

Code:

.....KEY01     2008-01-21
.....KEY02     2008-01-10
.....KEY03     2008-01-18
.....KEY04     2008-01-19


and input file2 has these records:

Code:

.....KEY01     2008-01-21
.....KEY02     2008-01-11
.....KEY03     2008-01-17
.....KEY04     2008-01-19


and you want the output file to contain these records:

Code:

.....KEY02     2008-01-10
.....KEY02     2008-01-11
.....KEY03     2008-01-17
.....KEY03     2008-01-18


then you could use this DFSORT/ICETOOL job:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//CON DD DSN=...  input file1
//    DD DSN=...  input file2
//OUT DD DSN=...  output file
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(60,10,CH) ON(70,10,CH) NODUPS
/*


Now, depending on what you really want, the job would change accordingly. So if you can show me what you want with examples like I gave above, then I can show you how to do it with DFSORT/ICETOOL.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Jan 22, 2008 1:01 am
Reply with quote

You can use SUPERC with the CMPCOLM statement.

O.
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Tue Jan 22, 2008 11:55 am
Reply with quote

Hi Frank,

What you have understood is exactly same as what i need.

except the output file it should be like below
Code:

sum-no   eff-dt1             eff-dt2
KEY02     2008-01-10      2008-01-11
KEY03     2008-01-17      2008-01-18



and there will not be any duplicates in both the files and the change will be in eff-dt field only in both the files remaining data will be same in both the files for each and every record. The number of records are also same in both the files.

From next post onwards i will try to elaborate my requirement clearly.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 22, 2008 10:58 pm
Reply with quote

Now we're getting somewhere.

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
//IN2 DD DSN=...  input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)     
//OUT DD DSN=...  output file                                           
//TOOLIN DD *                                                     
COPY FROM(IN1) TO(T1) USING(CTL1)                                 
COPY FROM(IN2) TO(T1) USING(CTL2)                                 
SPLICE FROM(T1) TO(OUT) ON(1,10,CH) -                             
 WITH(27,10) USING(CTL3)                                         
/*                                                               
//CTL1CNTL DD *                                                   
  INREC BUILD=(1:60,10,11:70,10,36:X) 
/*                           
//CTL2CNTL DD *                                                   
  INREC BUILD=(1:60,10,27:70,10)         
/*                       
//CTL3CNTL DD *                                                   
  OUTFIL FNAMES=OUT,INCLUDE=(11,10,CH,NE,27,10,CH)
/*               


OUT will have:

Code:

KEY02     2008-01-10      2008-01-11 
KEY03     2008-01-18      2008-01-17 


Not sure why your output example shows the dates reversed for KEY03.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Wed Jan 23, 2008 6:40 pm
Reply with quote

SYNCSORT is not DFSORT plouf
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jan 23, 2008 10:18 pm
Reply with quote

Prashant,

My job runs fine with DFSORT's ICETOOL. But the SYT messages indicate you're using Syncsort's SYNCTOOL, not DFSORT's ICETOOL.

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top