View previous topic :: View next topic
|
Author |
Message |
prabhu2006
New User
Joined: 09 Jan 2006 Posts: 5
|
|
|
|
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 |
|
|
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 121 Location: Tadepalligudem
|
|
|
|
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 |
|
|
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 121 Location: Tadepalligudem
|
|
|
|
sorry the first sort is as per in ascending order |
|
Back to top |
|
|
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 121 Location: Tadepalligudem
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
prabhu2006
New User
Joined: 09 Jan 2006 Posts: 5
|
|
|
|
Thaz cool...got it friends |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|