MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File Comparision with unequal no of records on two files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
sivafdms
Intermediate


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Wed Nov 10, 2010 2:23 pm    Post subject: File Comparision with unequal no of records on two files Reply with quote

Hi,

I need to compare two files file 1 with length as 80 and file 2 with length as 80.They key that can be used is 1,12 on both the files.File2 contains duplicates.

After the compare there is another comparision on file1 with file on 4 byte field.
The o/p file should contains the records satisfying the 1st compare and the 2nd compare as well.

Example:

File1:-(Not in sorted order)

123456789012 ABCD
234656789013 ABCD
123434569012 DEFG

File2:-

123456789012 GHID
123456789012 ABCD
234656789013 EFDG
234656789013 HIJK

O/P FILE:=

123456789012 ABCD

Please help me in writing a JCL using any utility.Thanks in advance
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Nov 10, 2010 4:15 pm    Post subject: Reply with quote

sivafdms,

The following DFSORT JCL will give you the desired results
Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//INA      DD *                                           
----+----1----+----2----+----3----+----4----+----5----+---
123456789012 ABCD                                         
234656789013 ABCD                                         
123434569012 DEFG                                         
//INB      DD *                                           
123456789012 GHID                                         
123456789012 ABCD                                         
234656789013 EFDG                                         
234656789013 HIJK                                         
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  OPTION COPY                                             
  JOINKEYS F1=INA,FIELDS=(1,12,A,14,4,A)                 
  JOINKEYS F2=INB,FIELDS=(1,12,A,14,4,A)                 
  JOIN UNPAIRED                                           
  REFORMAT FIELDS=(F1:1,80,?)                             
  OUTFIL BUILD=(1,80),INCLUDE=(81,1,CH,EQ,C'B')           
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group