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

Fetch data Through input file with out duplication.


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

New User


Joined: 15 Sep 2005
Posts: 11

PostPosted: Mon Dec 26, 2005 3:04 pm
Reply with quote

Hi all,

I had query in JCL. I want to fetch the data from input file and write to output file. Here is the test data.

ITEM TIMESTAMP
123 123456
122 123457
121 123459
121 123460
121 123461

Ouput will be:

123 123456
122 123457
121 123461

I have to get the unique value for Item, If there is multiple occurence for item like 121 than I have select the line with latest timestamp or with highest TIMESTAMP VALUE, ignoring the other values.

I want to do it through JCL, can u all help me out.
Back to top
View user's profile Send private message
sunish

New User


Joined: 23 May 2005
Posts: 19

PostPosted: Mon Dec 26, 2005 5:55 pm
Reply with quote

hi

this is the jcl

//sysprint dd sysout=*
//sysin dd *
sort fields=(1,3,ch,a)
sumfields=none
/*
//

correct me if it is worng
Back to top
View user's profile Send private message
Direction

New User


Joined: 15 Sep 2005
Posts: 11

PostPosted: Mon Dec 26, 2005 7:38 pm
Reply with quote

Thanx for ur favour, But it not giving the desired result.
By using this JCL my output is :

123 123456
122 123457
121 123459

But the Answer I reqire is:

123 123456
122 123457
121 123461
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: Mon Dec 26, 2005 10:12 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for.

Code:

//S1   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN  DD *
123 123456
122 123457
121 123459
121 123460
121 123461
/*
//OUT  DD SYSOUT=*
//TOOLIN   DD *
SELECT FROM(IN) TO(OUT) ON(1,3,CH) LAST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,3,CH,D)
/*


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 IGYPG3178-I when compiling a pgm read... COBOL Programming 6
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts To Sort detail records in a file with... SYNCSORT 5
Search our Forums:


Back to Top