|
View previous topic :: View next topic
|
| Author |
Message |
sudib19
New User
Joined: 06 Feb 2007 Posts: 29 Location: Noida
|
|
|
|
Hi,
I want to compare between two files and put the matching data into one file and the non matching data into another.
The first file is a VB file which has 34 bytes of data which looks like this
| Code: |
4009289999900008708864068848701|Q
0024389999914838321270308411399|Q
0024389999918704172877375860610|I
0024389999918704642778717102236|Q
|
The second file is a FB file which looks like this
| Code: |
483832127,13349500374
483832129,12357270656
483832136,12581630634
483832145,12975630596
|
The key is from position 13 in the VB file and position 1 to 9 in the second file
I want to take out the common records based on the key in both the files and put the record from the second file's 11th position to another file.. These would be the common records, and if I do not find a match I would want the entire record from the first file to be present in another file.
For example for the key 483832127 we have a match in the first file in the second record so I would want my match output file to have 13349500374 and rest of the records from the first file which do not match should come to the non match file in the same layout as my first file.
Can you please help me to do this
Thanks
Sudip[/code] |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
sudib19,
Use the following DFSORT JCL which will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=Your Input VB File,DISP=SHR
//INB DD DSN=Your Input FB File,DISP=SHR
//MATCH DD SYSOUT=*
//ONLYF1 DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(17,9,A)
JOINKEYS F2=INB,FIELDS=(01,9,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,4,?,F2:11,11,F1:5)
OUTFIL FNAMES=MATCH,INCLUDE=(5,1,CH,EQ,C'B'),VTOF,BUILD=(6,11)
OUTFIL FNAMES=ONLYF1,INCLUDE=(5,1,CH,EQ,C'1'),BUILD=(1,4,17)
//* |
|
|
| Back to top |
|
 |
sudib19
New User
Joined: 06 Feb 2007 Posts: 29 Location: Noida
|
|
|
|
Hi kolusu,
Thanks for the reply
When I try to run this sort job, I get an error
| Code: |
E1 - DSS20011E - DD 'SORTIN' WAS NOT ALLOCATED.
E2 - DSS11043E - NO SORT OR MERGE CONTROL STATEMENT WAS FOUND |
I am not sure if this has something to do with the installation of DFSORT, We have ICETOOL in our shop, can this be done through that or am I missing something here.
Also can you let me know what does the ? indicate in
| Code: |
REFORMAT FIELDS=(F1:1,4,?,F2:11,11,F1:5) |
Thanks again for the help
Sudip |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| sudib19 wrote: |
| When I try to run this sort job, I get an error |
sudib19,
Nope you did NOT run the job. They are your JCL syntax checker messages which never are up to date with the latest features of DFSORT. So ignore them and run your job.
| sudib19 wrote: |
Also can you let me know what does the ? indicate in
| Code: |
| REFORMAT FIELDS=(F1:1,4,?,F2:11,11,F1:5) |
|
Check this link which explain in detail about joinkeys
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA50/5.0 |
|
| Back to top |
|
 |
sudib19
New User
Joined: 06 Feb 2007 Posts: 29 Location: Noida
|
|
|
|
| Thanks a lot Kolusu, It works great. Thanks for all the help. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|