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
 

 

Comparing files through sort

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

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Jul 19, 2011 2:18 pm    Post subject: Comparing files through sort
Reply with quote

Hi,

I have 2 files. I want to compare them. But the value format is different in both these files. For eg, one have value as 02000 and other have value as
2,000

Is there any way through which I can convert one format into other? I mean can we convert 02000 to 2,000 or vice versa so that I can match these 2 files through joinkeys?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 19, 2011 2:48 pm    Post subject:
Reply with quote

if you only want to do it for the purposes of joining,

you can icetool with multiple applications:
  1. reformat the file
  2. JOINKEYS


most of the examples for joinkeys is of this type.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Jul 19, 2011 2:52 pm    Post subject: Re: Comparing files through sort
Reply with quote

Shriram Jogdand wrote:
Hi,
Is there any way through which I can convert one format into other? I mean can we convert 02000 to 2,000 or vice versa so that I can match these 2 files through joinkeys?

May be .. But not before you show us how both the input files look like,
sample record in both and what you want as output...

What is the record format and record lenght of both the input files...
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Jul 19, 2011 4:10 pm    Post subject: Reply to: Comparing files through sort
Reply with quote

Both files are FB have file lenght as 15.
File 1 structure

10 02000
10 02199
20 09888
20 10000
30 02400
40 02050

File 2

10 2,000
10 2,199
20 9,888
20 1,000
40 2,050

I want records in o/p file as those whose values are not matching in both file.

30 02400

But since 2,000 of first record of file1 cant be matched with 02000 of second file directly, is there any way to convert these values in same format?

Can we do this in same step or by adding new steps to convert the files to same format and then joining them?
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Tue Jul 19, 2011 4:14 pm    Post subject:
Reply with quote

your input files are confusing, first file was having a value of 20 10000 but in second file it is 20 1,000. Please provide us valid examples and specify the rules completely.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Tue Jul 19, 2011 4:20 pm    Post subject:
Reply with quote

If your input file will look like this -

Code:
10 02000       
10 02199       
20 09888               
30 02400       
40 02050       


using this code
Code:
OPTION  COPY                             
OUTREC OVERLAY=(4:4,5,ZD,EDIT=(T,TTT))   


you can attain

Code:
10 2,000
10 2,199
20 9,888
30 2,400
40 2,050


After which you can use join keys to match files.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 19, 2011 4:22 pm    Post subject:
Reply with quote

deleted by poster
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Jul 19, 2011 4:29 pm    Post subject: Reply to: Comparing files through sort
Reply with quote

Thanks kratos86. icon_lol.gif
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Tue Jul 19, 2011 7:34 pm    Post subject:
Reply with quote

Shriram Jogdand,
You haven't mentioned your matching keys and based on your expected output (30 02400), you need to be matching on first 2 bytes only which doesn't need any conversion, unless you need conversion in the final output "after matching".

However, for either requirement,all these can be done in a single pass, you don't need 2 pass.I assumed you are trying to match on both the fields.
Code:

//STEP0001 EXEC PGM=SORT                                 
//SORTJNF1 DD  *                                         
10 02000                                                 
10 02199                                                 
20 09888                                                 
20 10000                                                 
30 02400                                                 
40 02050                                                 
//SORTJNF2 DD  *                                         
10 2,000                                                 
10 2,199                                                 
20 9,888                                                 
20 1,000                                                 
40 2,050                                                 
/*                                                       
//SORTOUT  DD  SYSOUT=*                                 
//SYSIN    DD  *                                         
  JOINKEYS FILE=F1,FIELDS=(1,2,A,16,5,A)                 
  JOINKEYS FILE=F2,FIELDS=(1,2,A,04,5,A)                 
  JOIN UNPAIRED,ONLY                                     
  REFORMAT FIELDS=(F1:01,15,F2:01,15,?)                 
  INREC IFTHEN=(WHEN=(31,1,CH,EQ,C'2'),OVERLAY=(1:16,15))
  OPTION COPY                                           
  OUTFIL BUILD=(1,15)                                   
//JNF1CNTL DD *                                         
 INREC OVERLAY=(16:4,5,ZD,EDIT=(T,TTT))                 
//*                                                     
//SYSOUT   DD  SYSOUT=*                                 
                               

Thanks,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 19, 2011 7:37 pm    Post subject:
Reply with quote

SQLCODE1,

slick move with the JNF cntl.
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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


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