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
 

 

Get the latest record from the file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Mon Jan 28, 2008 10:28 pm    Post subject: Get the latest record from the file
Reply with quote

Hi,
My input file has the below format.

11111 2008-01-26.42.32.222222 Employee
57676 2008-01-27.35.21.123444 Employee
23455 2008-01-28.56.56.566777 Employee
....
....
....
....
88888 2008-01-25.42.32.222222 Salary
77777 2008-01-26.35.21.123444 Salary
66666 2008-01-27.56.56.566777 Salary
....
....
....

Output file:
23455 2008-01-28.56.56.566777 Employee
66666 2008-01-27.56.56.566777 Salary
...

My requirement is I need the latest record in each category(like Employee,Salary,...)

Thanks
Aneeta
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jan 28, 2008 10:49 pm    Post subject:
Reply with quote

aneetha,

Assuming that you have 26 byte timestamp field (you only show 23 bytes) you can simply sort on that field descending.

Code:

//SYSIN    DD *           
  OPTION EQUALS
  SORT FIELDS=(p,26,CH,D)
/*
p = start position of the time stamp field
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jan 28, 2008 10:57 pm    Post subject:
Reply with quote

Hello,

Will this yield only the "latest" for each "type"?
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: Mon Jan 28, 2008 11:05 pm    Post subject:
Reply with quote

Aneeta,

You can use a DFSORT/ICETOOL job like this to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
11111 2008-01-26.42.32.222222 Employee
57676 2008-01-27.35.21.123444 Employee
23455 2008-01-28.56.56.566777 Employee
88888 2008-01-25.42.32.222222 Salary
77777 2008-01-26.35.21.123444 Salary
66666 2008-01-27.56.56.566777 Salary
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(31,10,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(31,10,CH,A,7,23,CH,D)
/*
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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