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
 
Compare 2 Files & Write Specific Mismatch to Output

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Prasanya

New User


Joined: 04 Jun 2007
Posts: 34
Location: Chennai

PostPosted: Tue Feb 26, 2008 3:59 pm    Post subject: Compare 2 Files & Write Specific Mismatch to Output
Reply with quote

Hi,
I have a certain job in which I'm required to compare two files. I'm supposed to write records to the Output that are Present in the First File, but absent in the first.
For Example, if I have the Two Input Files as below:

File I:
10000 1234 ABC 9999
10001 1235 XYZ 9090
10002 1236 AXZ 9009

File II:
10000 1234 ABC 9999
10002 1236 AXZ 9009
10006 9999 MAD 1111

I need the Output file as below:

Output File:
10000 1234 ABC 9999
10002 1236 AXZ 9009

It's Possible using DFSORT. The Key Fields are 1:5,BI & 12:3,CH. Can someone help me with this please?
Back to top
View user's profile Send private message

rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 195
Location: india

PostPosted: Tue Feb 26, 2008 5:12 pm    Post subject:
Reply with quote

hi,

Quote:
Present in the First File, but absent in the first


what do you mean by the above statement?
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 195
Location: india

PostPosted: Tue Feb 26, 2008 6:00 pm    Post subject:
Reply with quote

hi,

As per your above example the output file contains the records which are matching in both the input files...is that what you need?
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: Tue Feb 26, 2008 9:46 pm    Post subject:
Reply with quote

Prasanya,

If you want the records from input file1 that have a match in input file2 on those two keys, you can use a DFSORT/ICETOOL job like this:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//CON DD *
10000 1234 ABC 9999
10001 1235 XYZ 9090
10002 1236 AXZ 9009
/*
//    DD *
10000 1234 ABC 9999
10002 1236 AXZ 9009
10006 9999 MAD 1111
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(1,5,BI) ON(12,3,CH) FIRSTDUP
/*


If that's not what you want, then you need to do a better job of explaining what you do want.
Back to top
View user's profile Send private message
Prasanya

New User


Joined: 04 Jun 2007
Posts: 34
Location: Chennai

PostPosted: Wed Feb 27, 2008 8:37 am    Post subject: Reply to: Compare 2 Files & Write Specific Mismatch to O
Reply with quote

Sorry,
My Requirement is that, in the given example, for the Files given, I need the Output to contain only the record
10006 9999 MAD 1111
This Record is present in the Second File, but a corresponding match is not found in the first.
I do not want the record
10001 1235 XYZ 9090
to be displayed in the output, as it is a record which is present in the first file with no match in the second file.
Sorry for any inconvenience. icon_redface.gif
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 195
Location: india

PostPosted: Wed Feb 27, 2008 8:09 pm    Post subject:
Reply with quote

Hi Prasanya,

Here is the DFSORT/ICETOOL code which meets your requrement:


Code:
//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1  DD *
10000 1234 ABC 9999
10001 1235 XYZ 9090
10002 1236 AXZ 9009
/*
//IN2 DD *
10000 1234 ABC 9999
10002 1236 AXZ 9009
10006 9999 MAD 1111
/* 
//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 SYSOUT=*
//TOOLIN DD *
  COPY FROM(IN1) TO(T1) USING(CTL1)
  COPY FROM(IN2) TO(T1) USING(CTL2)
  SPLICE FROM(T1) TO(T2) ON(1,5,BI) ON(12,3,CH) -
  KEEPBASE KEEPNODUPS WITHALL WITH(1,81) WITH(83,8) USING(CTL3)
  SORT FROM(T2) TO(OUT) USING(CTL4)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'AA',83:8X)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'BB',83:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=T2,INCLUDE=(81,2,CH,EQ,C'BB')
/*
//CTL4CNTL DD *
  SORT FIELDS=(83,8,ZD,A)
  OUTREC BUILD=(1,80)
/
*
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: Wed Feb 27, 2008 10:34 pm    Post subject:
Reply with quote

Prasanya,

Here's a simpler way to do what you asked for with DFSORT/ICETOOL:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD *
10000 1234 ABC 9999
10001 1235 XYZ 9090
10002 1236 AXZ 9009
/*
//IN2 DD *
10000 1234 ABC 9999
10002 1236 AXZ 9009
10006 9999 MAD 1111
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,5,BI) ON(12,3,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'2'),
    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    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 Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm

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