Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copmaring files for changed fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Copmaring files for changed fields
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    Post subject:
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 Moderator


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

PostPosted: Fri Sep 09, 2005 11:47 pm    Post subject:
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:

http://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    Post subject: Re: Copmaring files for changed fields
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 Moderator


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

PostPosted: Sat Sep 10, 2005 1:24 am    Post subject:
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    Post subject: Re: Copmaring files for changed fields
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 Moderator


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

PostPosted: Sat Sep 10, 2005 2:26 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
No new posts Profile changed to NUMBER ON STD (fro... Martylin TSO/ISPF 1 Thu Aug 03, 2017 9:14 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us