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
 
Comparing two files of different layout

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Comparing two files of different layout
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: 710
Location: Pennsylvania

PostPosted: Fri Oct 15, 2010 6:57 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10455
Location: italy

PostPosted: Fri Oct 15, 2010 7:01 pm    Post subject: Reply to: Comparing two files of different layout
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
http://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 Moderator


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

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

foolsbrain,

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

http://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    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 Comparing two sequential files Mohan Kothakota COBOL Programming 14 Mon Apr 16, 2018 6:35 pm
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts How to build one file from two input ... daniele DFSORT/ICETOOL 5 Tue Feb 27, 2018 6:45 pm
No new posts To get Non matching row after compari... vinu78 DB2 7 Fri Jan 05, 2018 5:43 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm

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