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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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