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

Comparing two files of different layout


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
foolsbrain

New User


Joined: 15 Apr 2010
Posts: 11
Location: chennai

PostPosted: Fri Oct 15, 2010 6:49 pm
Reply with quote

hi all,
My requirement is to compare two flat files of different layout and different record length using key values and write the common records from file1 in third file.
Example:
File1- record length 1500 and it contains
Code:
0000AAA 1234 AAAAAAAA........
0000BBB 1234 BBBBBBBB........
0000CCC 3453 AAAAAAA........

keys are at columns (5-7) and (9-12)

File2- record length 500 and it contains
Code:
AAA-2343 AAA 0000000000000.........
AAA-1234 AAA 1111111111111.........
CCC-3453 CCC 2333333333333........

keys are at columns (1-3) and (5-8)

the output should contain the records from file1
Code:
0000AAA 1234 AAAAAAAA........
0000CCC 3453 AAAAAAA........

can anyone help?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Oct 15, 2010 6:57 pm
Reply with quote

Quote:
can anyone help?


I can.

Click the search button and search for JOINKEYS
in forum JCL.

There are many examples that you should be able to easily modify to work for you.

Did you not learn anything from your previous post about allocating a file?

Search for yourself, use your brain.

For every little EASY thing you are going to ask for help?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Oct 15, 2010 7:01 pm
Reply with quote

if You do not want Yes/no answers do not post Yes/no questions

it would be useful for you to read and meditate on
How To Ask Questions The Smart Way
catb.org/~esr/faqs/smart-questions.html
to make the most out of the questions You ask
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Oct 16, 2010 1:35 am
Reply with quote

foolsbrain,

Here's a DFSORT job that will do what you asked for. For complete information on JOINKEYS, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/1500)
//IN2 DD DSN=...  input file2 (FB/500)
//SORTOUT DD DSN=...  output file (FB/1500)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(5,3,A,9,4,A)
  JOINKEYS F2=IN2,FIELDS=(1,3,A,5,4,A)
  REFORMAT FIELDS=(F1:1,1500)
  OPTION COPY
/*
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top