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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top