View previous topic :: View next topic
|
Author |
Message |
ipavan
New User
Joined: 12 Jun 2005 Posts: 28 Location: Hyderabad
|
|
|
|
Hi can any one help me out,
My file(PS or ESDS or KSDS) has 1 million records . How to browse the file from the last record to first record.
I should not use any tools.
Thanks in advance,
pavan. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi Pavan,
1> Add a SEQ NUM to each record.
2> SORT the file DESCENDING based on SEQ NUM.
3> BROWSE record by record.
Steps given above can be performed by DFSORT.
Make a search in the forum to get solution for the first step. Get back in case any problem with your file structure.
Regards,
Priyesh. |
|
Back to top |
|
|
ikumar
New User
Joined: 02 Aug 2005 Posts: 81
|
|
|
|
Hi,
1) If you want to browse PS file in reverse, you must read all the records prior to that. Other way is, you can reverse the order of the records in your file through SORT utility using SEQNUM...
For example,
INREC FIELDS=(1,80,SEQNUM,8,ZD) // assigns the SEQNUM to 81st col
SORT FIELDS=(81,8,ZD,D) // sort the seqnum in DESC order
OUTREC FIELDS=(1,80) // write the output excluding the SEQNUM.
So, last record becomes the first record and you can use that output file in your program.
2) KSDS: move high-values to KEY field and do a start not greater than and a read backward and you get the last record.
3) ESDS: If you know RBA of the last record you can directly access last record, otherwise you need to follow the same steps as you do for your PS file.
Plz let me know if i am wrong anywhere....
Cheers,
Kumar. |
|
Back to top |
|
|
ipavan
New User
Joined: 12 Jun 2005 Posts: 28 Location: Hyderabad
|
|
|
|
Thanks a lot Kumar for your reply
Regards
Pavan |
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
Hi,
q1 > INREC FIELDS=(1,80,SEQNUM,8,ZD) // assigns the SEQNUM to 81st col
Can you explain how the sequence number get added here ??
q2> SORT FIELDS=(81,8,ZD,D) // sort the seqnum in DESC order
here the file is sorted by starting from 81st columns and leangth 8 in descending order... am i correct ?
Thanks in advance.
Murali |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Isn't SORT a tool? |
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
Yep. Sort is a tool.
Just want to know how you add the seq. number !!!
Cheers, |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Sorry Murial, the ques wasn't directed at you.
But on 2nd thought, a computer is a tool too. I wonder what Paven meant by that comment? |
|
Back to top |
|
|
|