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
 

 

Compare two files and write the common record of first file

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

New User


Joined: 12 Jul 2009
Posts: 9
Location: Pune

PostPosted: Thu Jul 16, 2009 5:40 pm    Post subject: Compare two files and write the common record of first file
Reply with quote

Hi,

can any-one help me to resolve following request using ICETOOL or any other utility.

I have the two file, FILE A and FILE B

Sturucture & Specification of FILE A is as below

Record Format : FB
LRECL : 29021

FILE A Structure
xxxx1111111111xxxxxxxxxxxxxxx
xxxx2222222222xxxxxxxxxxxxxxx
xxxx3333333333xxxxxxxxxxxxxxx
xxxx4444444444xxxxxxxxxxxxxxx
xxxx5555555555xxxxxxxxxxxxxxx


Sturucture & Specification of FILE B is as below
Record format : FB
LRECL : 80

FILE B Structure

xxxx3333333333
xxxx4444444444

Key filed is at position 4 in both the file,also length of key is 10.
I want to comare File A with File B and copy all the duplicate record from FILE A in new file (say File C)

My final Output Should look like as below

FILE C
-------------
xxxx3333333333xxxxxxxxxxxxxxx
xxxx4444444444xxxxxxxxxxxxxxx

Please help me.

Thanks & Regards
Sumeet Duseja.



[/b]
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 16, 2009 9:12 pm    Post subject:
Reply with quote

The following DFSORT JCL will give you the desired results. This job assumes that both files have unique keys.

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=your 80 byte input file,DISP=SHR           
//SORTOUT  DD DSN=&&FB,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)   
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC BUILD=(C'$$$',4,10,29021:X)   
/*
//STEP0200 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD DSN=your 29021 byte input file,DISP=SHR
//          DD DSN=&&FB,DISP=SHR   
//OUT      DD SYSOUT=*
//TOOLIN   DD *                                               
  SELECT FROM(IN) ON(4,10,CH) TO(OUT) FIRSTDUP                 
/*                                                           


If you have duplicates in any of the input files then change the step0200 to the following

Code:
                     
//STEP0200 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=&&FB,DISP=SHR                                 
//         DD DSN=your 29021 byte input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=(4,10,CH,A),EQUALS                               
  OUTREC IFTHEN=(WHEN=INIT,                                     
  OVERLAY=(29022:SEQNUM,8,ZD,RESTART=(4,10))),                 
  IFTHEN=(WHEN=GROUP,BEGIN=(29022,8,ZD,EQ,1),PUSH=(29030:1,3)) 
                                                               
  OUTFIL BUILD=(1,29021),                                       
  INCLUDE=(29030,3,CH,EQ,C'$$$',AND,1,3,CH,NE,C'$$$')           
/*
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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