Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

comparison of files
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: comparison of files
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    Post subject: Reply to: comparison of files
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    Post subject:
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: 356
Location: New York

PostPosted: Fri Apr 03, 2009 10:41 am    Post subject:
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    Post subject:
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    Post subject: Reply to: comparison of files
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    Post subject:
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: 356
Location: New York

PostPosted: Fri Apr 03, 2009 11:39 am    Post subject:
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    Post subject:
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    Post subject: Reply to: comparison of files
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: comparison of files
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    Post subject:
Reply with quote

Hi,

Have a look this post for comparing files using icetool

http://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    Post subject: Here is the ICETOOL control cards
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

Which Icetool code. Posted by me or himanshu7
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us