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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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