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 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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm

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