View previous topic :: View next topic
|
Author |
Message |
suganthyprabha
New User
Joined: 28 Jul 2005 Posts: 58
|
|
|
|
Hi Friends,
Here is my Requirement.
File 1:
Code: |
Custid Status code
===== ========
246 20
247 40
|
File 2:
Code: |
Custid Status code
===== ========
246 30
247 40
248 50
|
I have to compare the records, if the Custid matches then i have to replace the Status code with the value of 2nd File. If it is matched then leave as it is.
My Output should be as foll:
File 3:
Code: |
Custid Status code
===== ========
246 30
247 40
|
Thanks and Regards,
Suagnthy. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Assuming there are no duplicates within file1 and no duplicates within file2 (as in the example you showed), you can use this DFSORT/ICETOOL job to do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD * input file1
246 20
247 40
/*
// DD * input file2
246 30
247 40
248 50
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(6,3,CH) LASTDUP
/*
|
|
|
Back to top |
|
|
karthik1680 Warnings : 2 New User
Joined: 14 May 2005 Posts: 64 Location: chennai
|
|
|
|
hi frank
coule u plz explain the select statement in the pgm |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
coule u plz explain the select statement in the pgm |
Code: |
SELECT FROM(CON) TO(OUT) ON(6,3,CH) LASTDUP
|
FROM(CON) - specifies CON as the ddname for the input file. CON is a concatenation of file1 and file2, in that order.
TO(OUT) - specifies OUT as the ddname for the output file.
ON(6,3CH) - specifies the key for determining duplicate records.
LASTDUP - keep only the last record of each set of duplicates (in your case, that will be the record from file2). Do not keep nonduplicates.
For complete details on the SELECT operator of DFSORT's ICETOOL (with examples), see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/6.11?DT=20050222160456
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|