Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to get the Matching records replacing particular column

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to get the Matching records replacing particular column
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 Moderator


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

PostPosted: Tue Jan 10, 2006 9:26 pm    Post subject:
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    Post subject: Re: How to get the Matching records replacing particular col
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 Moderator


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

PostPosted: Wed Jan 11, 2006 9:19 pm    Post subject:
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:

http://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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us