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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm


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