IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to get the Matching records replacing particular column


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suganthyprabha

New User


Joined: 28 Jul 2005
Posts: 58

PostPosted: Tue Jan 10, 2006 5:11 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 10, 2006 9:26 pm
Reply with quote

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
View user's profile Send private message
karthik1680
Warnings : 2

New User


Joined: 14 May 2005
Posts: 64
Location: chennai

PostPosted: Wed Jan 11, 2006 12:03 pm
Reply with quote

hi frank
coule u plz explain the select statement in the pgm
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jan 11, 2006 9:19 pm
Reply with quote

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
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Format data from multiple records usi... SYNCSORT 4
No new posts Sort SMF records? SYNCSORT 6
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts Identify and write records containing... SYNCSORT 11
No new posts Filter records where condition is in ... SYNCSORT 6
Search our Forums:


Back to Top