IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to browse the file from the last record to first record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ipavan

New User


Joined: 12 Jun 2005
Posts: 28
Location: Hyderabad

PostPosted: Sun Oct 23, 2005 12:34 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Oct 24, 2005 11:02 am
Reply with quote

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
View user's profile Send private message
ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Mon Oct 24, 2005 11:47 am
Reply with quote

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
View user's profile Send private message
ipavan

New User


Joined: 12 Jun 2005
Posts: 28
Location: Hyderabad

PostPosted: Mon Oct 24, 2005 8:13 pm
Reply with quote

Thanks a lot Kumar for your reply


Regards

Pavan
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Thu Oct 27, 2005 3:38 pm
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Oct 28, 2005 4:11 am
Reply with quote

Isn't SORT a tool?
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Fri Oct 28, 2005 9:17 am
Reply with quote

Yep. Sort is a tool.

Just want to know how you add the seq. number !!!

Cheers,
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Nov 02, 2005 4:58 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts HILITE on Browse mode? TSO/ISPF 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top