View previous topic :: View next topic
|
Author |
Message |
foolsbrain
New User
Joined: 15 Apr 2010 Posts: 11 Location: chennai
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|