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

Comparing Records in two files


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

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Thu Mar 04, 2010 9:06 am
Reply with quote

Hi,
I have two i/p files whose recl and the format are same. Record length is 500. I have to do comparison as per below condition
Compare first 1-388(key1) and then 393-500 (Key2) . Matched records will go to the Match1 file and unmatched records will go to the UNMAT1 file.

Can anyone plz suggest.

Regards,
Abhijit.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Mar 04, 2010 10:15 am
Reply with quote

Have you looked at Smart DFSORT Tricks

The section on "Match and no match, FB, key in same place, no duplicates" seems easily adaptable to your needs.
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: Thu Mar 04, 2010 11:04 pm
Reply with quote

Quote:
Have you looked at Smart DFSORT Tricks

The section on "Match and no match, FB, key in same place, no duplicates" seems easily adaptable to your needs.


Right. And if you have the Nov, 2009 PTF, you can use JOINKEYS as well - see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174

If you need more specific help, show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.

Also, run this job and show the //SYSOUT messages you receive, so I can see what level you're at:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DUMMY
//SYSIN    DD    *
  OPTION COPY
/*
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Fri Mar 05, 2010 12:54 am
Reply with quote

The two i/p files recfm is fixed and the LRECL is 500. I need to compare the records as follows:
file1's 1-388 length will be compared with file2's 1-388 length and then
file1's - 393-500 length will be compared with file2's 393-500 length and
and from position 389-392 should be ignored.
The o/p file should only contain the unique records.
File1's record count is : RECORD COUNT = 11633753
File2's record count is : RECORD COUNT = 11630895
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 Mar 05, 2010 1:03 am
Reply with quote

I can't help you until you supply ALL of the information I asked for. See my previous post for the information I need.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Fri Mar 05, 2010 1:16 am
Reply with quote

Actually I have made some changes to my cobol program. And due to that the file after run is showing more records than before run. I need to find the extra records and need to analyse why these extra records came. I had only done changes from 389-392 position of the file . So, in both the file this particular fields may/may not vary but there should not be no mismatch in the record count. So, that is the reason I need the unique records in my o/p file.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Fri Mar 05, 2010 1:32 am
Reply with quote

1st file:

cols---1-----------------------388-389-390----------------------500
value-11111111111a--------100- 0 - 2009010120101231a--
value-11111111111a--------000- 0 - 2008010120081231i--
value-12111111111a--------000- 0 - 20100101 a--
value-12111111111a--------100- 0 - 2009010120091231i--
value-12111111111a--------000- 0 - 2008010120081231i--

2nd file:

cols---1-----------------------388-389-390----------------------500
value-11111111111a--------100- 0 - 2009010120101231a--
value-11111111111a--------100- 0 - 2008010120081231i--
value-12111111111a--------075- 0 - 20100101 a--
value-12111111111a--------100- 0 - 2009010120091231i--
value-12111111111a--------000- 0 - 2008010120081231i--

First 12 bytes are customer numbers and these have multiple records based on effective dates and end dates.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Fri Mar 05, 2010 2:11 am
Reply with quote

Please provide me some tricks....Also I am checking from google and the doc that was posted earlier....
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 Mar 05, 2010 2:55 am
Reply with quote

abhijit,

Here's a DFSORT/ICETOOL job that will do what I think you're asking for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/500)
//IN2 DD DSN=...  input file2 (FB/500)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/40)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,388,CH) ON(393,108,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(501:C'1 ')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(502:C'1')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
      BUILD=(1,40),
      TRAILER1=('FILE1 RECORD COUNT = ',
        TOT=(501,1,ZD,M10,LENGTH=8),/,
       'FILE2 RECORD COUNT = ',
        TOT=(502,1,ZD,M10,LENGTH=8))
/*
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 Mar 05, 2010 3:04 am
Reply with quote

If you have the Nov, 2009 PTF, you can do the same thing with the following DFSORT JOINKEYS job:

Code:

//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/500)
//IN2 DD DSN=...  input file2 (FB/500)
//SORTOUT DD DSN=...  output file (FB/40)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,388,A,393,108,A)
  JOINKEYS F2=IN2,FIELDS=(1,388,A,393,108,A)
  JOIN UNPAIRED,ONLY,F1,F2
  REFORMAT FIELDS=(?)
  OPTION COPY
  INREC IFOUTLEN=2,
    IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),OVERLAY=(C' 1'))
  OUTFIL REMOVECC,NODETAIL,
      BUILD=(40X),
      TRAILER1=('FILE1 RECORD COUNT = ',
        TOT=(1,1,ZD,M10,LENGTH=8),/,
       'FILE2 RECORD COUNT = ',
        TOT=(2,1,ZD,M10,LENGTH=8))
/*
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Fri Mar 05, 2010 12:02 pm
Reply with quote

Hi ,
I am getting S0B37 error with the ICETOOL option. Can anyone have idea.

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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Mar 05, 2010 12:33 pm
Reply with quote

Have you searched what S0B37 is?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Mar 05, 2010 12:38 pm
Reply with quote

This Thread will help you
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Fri Mar 05, 2010 12:39 pm
Reply with quote

I reduced the size of the i/p files and now its running fine. But in the output file no records are coming only trailer records are coming.
i.e.
FILE1 RECORD COUNT = 48
FILE2 RECORD COUNT = 48

But i need the unique records also.
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 Mar 05, 2010 11:00 pm
Reply with quote

Quote:
I reduced the size of the i/p files and now its running fine. But in the output file no records are coming only trailer records are coming.
i.e.
FILE1 RECORD COUNT = 48
FILE2 RECORD COUNT = 48

But i need the unique records also.


Sigh. In my first post, I said:

Quote:
If you need more specific help, show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.


The only output you showed was the record counts, so that's what I gave you. Now you complain that it isn't the correct output. Sheesh.

If you want the unique records as well as the record counts, change your CTL3CNTL statements to:

Code:

//CTL3CNTL DD *                                 
  OUTFIL FNAMES=OUT,REMOVECC,                   
      BUILD=(1,500),                           
      TRAILER1=('FILE1 RECORD COUNT = ',       
        TOT=(501,1,ZD,M10,LENGTH=8),/,         
       'FILE2 RECORD COUNT = ',                 
        TOT=(502,1,ZD,M10,LENGTH=8))           


If that doesn't give you what you want, then you need to give me ALL of the information I asked for.

Quote:
I am getting S0B37 error with the ICETOOL option. Can anyone have idea


A B37 means you haven't given large enough SPACE values for the data set that's getting the B37. You need to increase the SPACE values. Of course, since you didn't tell us which data set you got the B37 for, what SPACE parameters you used, how many records you had, etc, we can't help you much.

You really need to learn how to do a better job of giving information if you want people to help you.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Sat Mar 06, 2010 11:18 pm
Reply with quote

Hi Frank,

Thanks for all ur valuable inputs and I am able to get the results...Again I am very much thankful to u.. icon_smile.gif
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 Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top