Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
to get last Rec

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

New User


Joined: 09 Jan 2006
Posts: 5

PostPosted: Mon Jan 09, 2006 5:36 pm    Post subject: to get last Rec
Reply with quote

Hi,
How do you get the last record in a file by using Sort/Icetool whose total count of recs is unknown?

Thanks & Regards
Prabhu
Back to top
View user's profile Send private message

rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Mon Jan 09, 2006 6:05 pm    Post subject:
Reply with quote

Hi prabhu,

Try this ....

assuming the key is like a number
1
8
3
6
5
4
2
10
9....

if u sort in descending order...........the records will be in this order
1
2
3
4
5
6
7
8
9
10

if u sort in descending order...........the records will be in this order
10
9
8
7
6
5
4
3
2
1

where the last record is at top...so to retrive that record use "STOPAFT=1"

which will retrieve the record with key 10 which is a last record after sorting..........

corrections welcomed........

Thanks,
Rajesh
Back to top
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Mon Jan 09, 2006 6:07 pm    Post subject:
Reply with quote

sorry the first sort is as per in ascending order
Back to top
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Mon Jan 09, 2006 6:27 pm    Post subject:
Reply with quote

or simply sort using descending order and fetch the first record by "STOPAFT=1" which will be the last record(when sorted in ascending order)

Thanks,
Rajesh
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 09, 2006 9:19 pm    Post subject:
Reply with quote

See the "Keep the last n records" Smart DFSORT Trick at:

www.ibm.com/systems/support/storage/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
prabhu2006

New User


Joined: 09 Jan 2006
Posts: 5

PostPosted: Wed Jan 11, 2006 11:07 am    Post subject: to get last Rec
Reply with quote

Thaz cool...got it friends
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: Thu Sep 25, 2008 2:08 am    Post subject:
Reply with quote

You can now do this kind of thing quite easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:


Code:
 
//S1  EXEC  PGM=ICETOOL                                           
//TOOLMSG   DD  SYSOUT=*                                           
//DFSMSG    DD  SYSOUT=*                                           
//IN DD DSN=...  input file                                       
//OUT DD DSN=...  output file         
//TOOLIN DD *                                                     
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST
/*     


For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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:


Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us