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

Compare Files using ICETOOL


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

New User


Joined: 25 Oct 2007
Posts: 16
Location: mumbai

PostPosted: Tue Sep 23, 2008 5:30 pm
Reply with quote

Hi,

I have two files FileA & FileB
FileA
======
789111567
111888991
330007845

FileB
======
789111567
311888991
330007845

I need to create two files
FileC containing matched records and FileD containing unmatched records
FileC
======
789111567
330007845

FileD
======
111888991
311888991

I tried using ICETOOL with following syntax in TOOLIN
SELECT FROM(BKIN) TO(DUP) DISCARD(NODUP) -
ON(1,9,ZD) ALLDUPS

//BKIN FILEA,DISP=SHR
FILEB,DISP=SHR

//DUP FILEC,DISP=(NEW,CATLG,DELETE)

//NODUP FILED,DISP=(NEW,CATLG,DELETE)

FILED is getting generated properly but FileC contains duplicate records


FileD
======
111888991
311888991

FileC
=====
330007845
330007845
789111567
789111567

Does it mean I have to sort FileC again in the next step or is it possible in the same step.
Can someone advise on the correct syntax?


Thanks in advance.

Atchuta
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Tue Sep 23, 2008 6:34 pm
Reply with quote

You can add additional statment in splice to copy from NODUP and write in to your final output (i.e final file with duplicates).

During this copy you can eliminate duplicates using SUM FIELDS=NONE.
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: Tue Sep 23, 2008 9:56 pm
Reply with quote

Atchuta,

You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//FILEA DD DSN=FILEA,DISP=SHR (FB/80)
//FILEB DD DSN=FILEB,DISP=SHR (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=FILEC,DISP=(NEW,CATLG,DELETE)   (FB/80)
//FILED DD DSN=FILED,DISP=(NEW,CATLG,DELETE)   (FB/80)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(FILEC) ON(1,9,ZD) KEEPNODUPS -
  WITH(81,1) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=FILEC,INCLUDE=(81,2,CH,EQ,C'VB'),
    BUILD=(1,80)
  OUTFIL FNAMES=FILED,SAVE,
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
atchuta konduri

New User


Joined: 25 Oct 2007
Posts: 16
Location: mumbai

PostPosted: Wed Sep 24, 2008 3:55 pm
Reply with quote

Thank you Frank, it worked perfectly
Back to top
View user's profile Send private message
atchuta konduri

New User


Joined: 25 Oct 2007
Posts: 16
Location: mumbai

PostPosted: Mon Oct 13, 2008 3:46 pm
Reply with quote

Hi,

As mentioned in the earlier post we have two files. above resolution given by frank is working perfectly but i have a small problem here.

FileA
======
789111567
111888991
330007845

FileB
======
789111567
311888991
330007845

but fileA contains data in hex format (S9(09) USAGE COMP).
FileB --- Picture clause defined as 9(09).

Is there any way to compare these two files? or Do i need to convert any of these file format before icetool step?


Thanks in advance.
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: Mon Oct 13, 2008 8:48 pm
Reply with quote

9(9) is a 9-byte ZD field.

S9(9) COMP is a 4-byte BI field (assuming its unsigned like the 9(9) field).

If you want to compare these two fields, you must convert one of them first. You could use a DFSORT/ICETOOL job like this. However, your output files could have a mixture of the records with the ZD fields and the records with the BI fields. I'm not sure if that's what you want. If not, you need to explain what you do want for output.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//FILEA DD DSN=...  input fileA (FB/80) - ZD field
//FILEB DD DSN=...  input fileB (FB/80) - BI field
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=...  output fileC (FB/80)
//FILED DD DSN=...  output fileD (FB/80)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(FILEC) ON(83,4,BI) KEEPNODUPS -
  WITH(81,1) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'BB',83:1,9,ZD,TO=BI,LENGTH=4)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'VV',83:1,4)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=FILEC,INCLUDE=(81,2,CH,EQ,C'VB'),
    BUILD=(1,80)
/*
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 0
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 Shift left VB record without x00 endi... DFSORT/ICETOOL 11
Search our Forums:

Back to Top