View previous topic :: View next topic
|
Author |
Message |
pm_prasanth
New User
Joined: 22 Mar 2006 Posts: 3
|
|
|
|
hi,
i need to compare two flat files A and B. B has all the recs of A in addition it has few more records.. i was to exclude all the different records in B and to write it another falt files. i know this is stupid one but one case arised for me in testing.. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
It's not really clear what you want to do. Please show an example of the records in input file A and input file B and what you want for output. Also, what is the RECFM and LRECL of input file A and input file B? |
|
Back to top |
|
|
pm_prasanth
New User
Joined: 22 Mar 2006 Posts: 3
|
|
|
|
PS1 has 4 records.
1aaa
0bbb
3ccc
5ddd
and PS2 has 6 records
1aaa
7bbb
8ddd
3ggg
4ccc
6eee
I want to fetch all the records in PS2 which matches characters in the column (3 to 5) of PS1 and write it in PS3. Its possible in cobol . Is it possible in JCL or SORTs like icetool ,dfs sort.
The oupout file PS3 must have the following reocrds.
1aaa
7bbb
4ccc
8ddd |
|
Back to top |
|
|
rajandhla
Active User
Joined: 18 Oct 2005 Posts: 182 Location: Luton UK
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Actually, you don't need the SPLICE trick for this one. You can do it more simply with SELECT. Here's a DFSORT/ICETOOL job that will do what you want. You said your key is in columns 3-5 but your example shows it in 2-4 so I used that. You can change 2,3,CH to 3,3,CH if appropriate.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=... input file1
// DD DSN=... input file2
//OUT DD DSN=... output file
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(2,3,CH) LASTDUP
/*
|
You can also switch the order of the CON files and use FIRSTDUP, which might be more efficient if you have a large number of records:
Code: |
//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=... input file2
// DD DSN=... input file1
//OUT DD DSN=... output file
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(2,3,CH) FIRSTDUP
/*
|
|
|
Back to top |
|
|
pm_prasanth
New User
Joined: 22 Mar 2006 Posts: 3
|
|
|
|
Frank n Rajan.. Thanks a lot.. |
|
Back to top |
|
|
|