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 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: 670
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: 10274
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 getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm


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