IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Comparing files through sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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
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
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
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
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: 577
Location: USA

PostPosted: Tue Jul 19, 2011 7:34 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top