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

comparison of files


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

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 9:41 am
Reply with quote

Hi all,

I need to compare two files and write the unmatching records and new records into a new output file.
Example:
File1 contains 100 Records
File2 contains 110 records out of which 99 exactly matches with File1, so now i need rest 11 records to be written to a new file.
Note: File1 and File2 are of same format.

The comparison should be done based on the whole record, we don't have any key fields in the files.

I came to know this can be done by ICETOOL, i have not worked on it so could anyone kindly give the solution with brief example.
If the same can be achieved by anyother utility also its fine.

Thanks,
M.Loganathan
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Fri Apr 03, 2009 9:55 am
Reply with quote

Loganathan,
We can do that using a match Eztrieve also(EZTPA00 utility).
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 10:19 am
Reply with quote

Hi Anand,
I have not used EZTPA00 utility also.
But do send me the sample i'll try it out.

Thanks,
M.Loganathan
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Fri Apr 03, 2009 10:41 am
Reply with quote

Just you can do using a simple program.
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 10:48 am
Reply with quote

hi,

we have lot of utilites. using them is much easier then creating a progam.
so wish to learn those utilites.

Thanks,
M.Loganathan
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Fri Apr 03, 2009 11:00 am
Reply with quote

//XXXXXXXX JOB (X,XXX),'EZT',CLASS=0,MSGCLASS=X
//EZTCOM EXEC PGM=EZTPA00
//STEPLIB DD DSN=SYSTEMS.LINKLIB,DISP=SHR
// DD DSN=DB2D.SDSNLOAD,DISP=SHR
//EZTVFM DD SPACE=(CYL,(20,20)),UNIT=SYSDA,DCB=BUFNO=40
//SYSPRINT DD SYSOUT=*
//SYSPUNCH DD DUMMY
//SYSUDUMP DD SYSOUT=Y
//SYSOUT DD SYSOUT=*
//FILEA DD DISP=SHR,DSN=File1(I/P1)
//FILEB DD DISP=SHR,DSN=File2(I/P2)
//FILEC DD DSN=File3(MISMATCH)
//FILED DD DSN=File4(MISMATCH FROM I/P1)
//FILEE DD DSN=File5(MISMATCH FROM I/P2)
//SYSIN DD *
*
FILE FILEA
A-REC 1 80 A
A-KEY 1 80 A
*
FILE FILEB
B-REC 1 80 A
B-KEY 1 80 A
*
FILE FILEC
C-REC 1 80 A
*
FILE FILED
D-REC 1 80 A
*
FILE FILEE
E-REC 1 80 A
*
JOB INPUT ( FILEA KEY(A-KEY) +
FILEB KEY(B-KEY) ) FINISH EXIT-PARA
*
IF MATCHED
C-REC = A-REC
PUT FILEC
ELSE
IF FILEA
D-REC = A-REC
PUT FILED
ELSE
IF FILEB
E-REC = B-REC
PUT FILEE
END-IF
END-IF
END-IF
*
EXIT-PARA. PROC.
DISPLAY 'SUCCESSFUL RUN '
END-PROC.
/*
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 11:34 am
Reply with quote

hi,

Please find below the input and output.

File1:
aaaaaaaaaa
bbbbbbbbbb
cccccccccc
dddddddddd
eeeeeeeeee

File2:
aaaaxxxxxx
bbbbxxxbbb
cccccxcccc
gggggggggg
dddddddddd
eeeeeeeeee
ffffffffff

File3: Empty

File4:
aaaaaaaaaa
bbbbbbbbbb
cccccccccc
dddddddddd
eeeeeeeeee

File5:
aaaaxxxxxx
bbbbxxxbbb
cccccxcccc
gggggggggg
dddddddddd
eeeeeeeeee
ffffffffff

It is not matching the requirements. Could u kindly send me some reference document so that i can understand how the IF condition is working.
I have not changed you code added the files.

Thanks,
M.Loganathan
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Fri Apr 03, 2009 11:39 am
Reply with quote

M.Loganathan,

I know about utilities. I myself used in our shop EZT, DFSORT and COBOL for comparison purposes. For his requirment COBOL is enough as number of records are less.
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 11:43 am
Reply with quote

hi,

Actual file contains millions of records.
Just for understanding i gave that example.
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Fri Apr 03, 2009 11:45 am
Reply with quote

Loganathan,
Have you sorted the two files before this step. if you sort and match definitely you will get the result you want.
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 11:57 am
Reply with quote

Hi Anand,

Still the same output i get icon_sad.gif
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Fri Apr 03, 2009 12:04 pm
Reply with quote

Loganathan,

Try this, i have sorted the file before comparing.

Code:
//STEP010 EXEC PGM=EZTPA00
//FILEA    DD DSN = ID.XXX.FILE1,DISP=SHR
//FILEB    DD DSN = ID.XXX.FILE2,DISP=SHR
//FILEO    DD DSN = ID.XXX.FILEOUT,DISP=(NEW,CATLG,DELETE),
           SPACE=(CYL,(1,1),RLSE),           
           DCB=(RECFM=FB,LRECL=09,BLKSIZE=0)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
* INPUT FILE
FILE FILEA
  A-RECORD    1   9   A
  A-FIELD1    1   3   A
  A-FIELD2    5   1   A
  A-FIELD3    7   3   A

FILE FILEB
  B-RECORD    1   9   A
  B-FIELD1    1   3   A
  B-FIELD2    5   1   A
  B-FIELD3    7   3   A

* OUTPUT FILE
FILE FILEO
  WS-OUT-RECORD  1  9   A

SORT FILEA  TO FILEA  USING (A-FIELD1 A-FIELD2 A-FIELD3)
                                           
SORT FILEB  TO FILEB  USING (B-FIELD1 B-FIELD2 B-FIELD3)

JOB INPUT (FILEA KEY (A-FIELD1, +
                      A-FIELD2, +
                      A-FIELD3) +
           FILEB KEY (B-FIELD1, +
                      B-FIELD2, +
                      B-FIELD3)) +
NAME TWO-FILE-MATCH

IF NOT MATCHED FILEA FILEB
   WS-OUT-RECORD = B-RECORD           
   PUT FILEO                 
END-IF 
GO TO JOB
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 12:15 pm
Reply with quote

hi,
Thanks a lot...
Could you please send the code using ICETOOL, That would be of very great help.
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Fri Apr 03, 2009 12:15 pm
Reply with quote

Loganathan,
I Tested now its working very well for me icon_cool.gif
and
A-KEY 1 80 A below this give
A-KEY1 1 80 A

B-KEY 1 80 A
B-KEY1 1 80 A

try again i hope you will get it.
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Fri Apr 03, 2009 12:41 pm
Reply with quote

Hi,

Have a look this post for comparing files using icetool

ibmmainframes.com/viewtopic.php?t=39181&highlight=comparing+files+icetool
Back to top
View user's profile Send private message
vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Fri Apr 03, 2009 12:45 pm
Reply with quote

Try this and let us know your output:
Code:
//STEP1 EXEC PGM=ICETOOL                                               
//TOOLMSG  DD  SYSOUT=*                                                 
//DFSMSG   DD  SYSOUT=*                                                 
//SYSOUT   DD  SYSOUT=*                                                 
//TEMP1   DD DISP=(,DELETE,DELETE),SPACE=(CYL,10,10),RLSE),DSN=&&TEMP1
//OUTFILE DD DSN=  **ouputfile
//INFILE DD DISP=SHR,DSN=  **inputfile1                         
//       DD DISP=SHR,DSN=  **inputfile2
//TOOLIN DD *                                                           
 SORT FROM(INFILE) TO(TEMP1) USING(CTL1)                               
 COPY FROM(TEMP1) TO(OUTFILE) USING(CTL2)                               
//CTL1CNTL DD *                                                         
 INREC BUILD=(1:1,80,81:SEQNUM,8,ZD,RESTART=(1,80))                     
 SORT FIELDS=(1,80,CH,A)                                               
 SUM FIELDS=(81,8,ZD)         
/*                                         
//CTL2CNTL DD *                                                         
 INCLUDE COND=(81,8,ZD,LT,2)                                           
 OUTREC FIELDS=(1,80)                                                   
/*
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Fri Apr 03, 2009 1:23 pm
Reply with quote

Hi loganathan,

Try this job.

Code:
//STEP008  EXEC  PGM=ICETOOL                             
//TOOLMSG  DD    SYSOUT=*                                 
//SSMSG    DD    SYSOUT=*                                 
//FILEA    DD    DSN=FILEA,DISP=SHR
//FILEB    DD    DSN=FILEB,DISP=SHR
//FILEC    DD    DSN=DGCVPG2.REGION.DELTA,DISP=SHR       
//T1       DD    DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(15,15)),
//     DISP=(MOD,PASS)                                   
//TOOLIN DD *                                             
COPY FROM(FILEB) TO(T1) USING(CTL1)                       
COPY FROM(FILEA) TO(T1) USING(CTL2)                       
SELECT FROM(T1) TO(FILEC) ON(1,40,CH) NODUPS USING(CTL3) 
/*                                                       
//CTL1CNTL DD *                                           
  INREC OVERLAY=(81:C'B')                                 
/*                                                       
//CTL2CNTL DD *                                           
  INREC OVERLAY=(81:C'A')                                 
/*                                                       
//CTL3CNTL DD *                                   
  OUTFIL FNAMES=FILEC,INCLUDE=(81,1,CH,EQ,C'B'), 
    BUILD=(1,80)                                 
/*     


The file lenght is 80 and will certainly fetch you No duplicates.
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 1:51 pm
Reply with quote

Thanks a lot at all.
This above post looks perfect.
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 2:09 pm
Reply with quote

Hi all,

One small doubt.
If my file contains Packed decimal, will that also be considered while comparison.

File1: Packed decimal, Position 1 to 5 value 25369
File2: Packed decimal, position 1 to 5 value 54879 all other position matches exactly with file1.

will the above two records will be considered as matching or unmatching.
It should be unmatching, just wanted to confirm
(I'm using the ICETOOL code)
Back to top
View user's profile Send private message
vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Fri Apr 03, 2009 2:53 pm
Reply with quote

Which Icetool code. Posted by me or himanshu7
Back to top
View user's profile Send private message
loga_nathan_m

New User


Joined: 07 Jun 2007
Posts: 40
Location: India

PostPosted: Fri Apr 03, 2009 4:20 pm
Reply with quote

Posted by himanshu7
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 Apr 03, 2009 8:57 pm
Reply with quote

In the case you give (25369 vs 54879), the records would be considered unmatched.

However, you really need to consider the matching PD values to understand if CH would work for you or not.

If your packed decimal fields are "normalized", then the comparisons will work correctly with CH format. If the packed decimal fields are "not normalized", then you'd need to use separate ON operands for the CH and PD fields.

By "normalized", I mean that all of the positive PD values have the same sign (e.g. C) and all of the negative PD values have the same sign (e.g. D).

An example of "not normalized" PD values would be where some of the positive PD values have a C sign and some of the positive PD values have an F sign.
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 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
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top