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

Copmaring files for changed fields


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MidasTouch

New User


Joined: 16 May 2005
Posts: 10
Location: The 'SYSTEM'

PostPosted: Fri Sep 09, 2005 11:09 pm
Reply with quote

I need to compare two files on a field by field basis. The files are basically dumps of DB2 table, and the structure would look like this.

Key Field1 Field2 Field3

What I need to do is to compare the two files which would have the same records for the key elements. However the non key fields would differ in the two files. I would like to compare both the files for each of the Key fields and need to know how many of the non key fields have undergone a change.

Is there some feature of the SORT utility that we can use to do this? Can this be achieved using FILE-AID, ESYTRIEVE, CLIST/REXX or any other way? If so can someone give me the details?

I know this can be done programmatically, bit I am looking at some utility to get this done.

Regards,
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Fri Sep 09, 2005 11:41 pm
Reply with quote

Try to search before posting... icon_wink.gif
This is a link from a search of "COMPARE" in this forum.
http://ibmmainframes.com/viewtopic.php?t=3049&highlight=compare
I suppose that is what you need... If is not tell us your doubt.
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: Fri Sep 09, 2005 11:47 pm
Reply with quote

That discussion will send you to the following Smart DFSORT Trick which uses the SPLICE operator of DFSORT's ICETOOL to do the matching:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmst02.html#t05

If you need more specific help, show an example of the records in each input file and what you want the output records to look like. Be as specific as possible. For example, if there can be duplicate records in file1, show that in the example, etc. Also, tell us the RECFM and LRECL of the input files, and explain any "rules" you need to use.
Back to top
View user's profile Send private message
MidasTouch

New User


Joined: 16 May 2005
Posts: 10
Location: The 'SYSTEM'

PostPosted: Sat Sep 10, 2005 12:23 am
Reply with quote

I don?t think the links help in solving my problem. I am giving a detailed requirement below:

Say there are two files, Say File 1 and File 2 (both sequential files), with the following contents. The fields are ID (key, char 5), Address (char 5), Status (char 2)


File1

11111 BOSTN AA
22222 RIVER BB
33333 ANDRO CC
44444 MELIN DD
55555 BLOOM EE


File2 has the following records

11111 BOSTN ZZ (Status changed)
22222 NEVAD BB (Address changed)
33333 ANDRO XX (Status changed)
44444 CALIF DD (Address changed)
55555 BLOOM YY (Status changed)
66666 WASHI FF (New record)

What I wand is to get a comparison of the above files, which will give me the following:

Address ? 2 changes
Status - 3 changes

Any help would be greatly appreciated. And yes, I did search in the forum to find and answer, but did not get a specific solution hence the post.

Regards,
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 Sep 10, 2005 1:24 am
Reply with quote

I'm not sure how you expected to get that specific a solution given what you originally posted. But now that you've explained exactly what you want, I can give you the following DFSORT/ICETOOL job that will do it:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=...  input file1
//    DD DSN=...  input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
 COPY FROM(CON) USING(CTL1)
 SELECT FROM(T1) TO(T2) ON(1,19,CH) NODUPS
 SELECT FROM(T2) TO(OUT) ON(1,12,CH) FIRSTDUP USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,
    OUTREC=(C'Address',8:1,5,13:8,5,25:X,/,
            C'Status ',8:1,5,18:15,2,25:X)
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,NODETAIL,REMOVECC,
    SECTIONS=(1,7,
      TRAILER3=(1,7,C' - ',COUNT=(EDIT=(IIT)),C' changes'))
/*
Back to top
View user's profile Send private message
MidasTouch

New User


Joined: 16 May 2005
Posts: 10
Location: The 'SYSTEM'

PostPosted: Sat Sep 10, 2005 1:31 am
Reply with quote

Thanks for the reply?but unfortunately we don?t have the ICETOOL utility. We just have the DFSORT utility.

Regards,
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 Sep 10, 2005 2:26 am
Reply with quote

Quote:
but unfortunately we don?t have the ICETOOL utility. We just have the DFSORT utility.


I don't know what you mean by that. If you have DFSORT, then you have ICETOOL. ICETOOL is a part of DFSORT (has been since 1991) and is shipped with it. Your System Programmers would have had to do something very strange to remove ICETOOL if you have DFSORT.

Why do you say you don't have ICETOOL? Have you tried it? What happened?
Back to top
View user's profile Send private message
MidasTouch

New User


Joined: 16 May 2005
Posts: 10
Location: The 'SYSTEM'

PostPosted: Tue Sep 13, 2005 3:28 am
Reply with quote

Thanks for enlightening me...and sorry for my Ignorance. I concluded that ICETOOL is missing on our system by relying on someones words. However I have not tried out your code yet, I will let you know once i try it.

Thanks again.[/quote]
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top