how do i reverse the records in a dataset .



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

how do i reverse the records in a dataset .

Postby logeshwari » Fri Oct 04, 2013 12:32 am

hi,


how do i reverse the records in a dataset (esds,ksds).. what are all the ways that i can make it ?
logeshwari
 
Posts: 1
Joined: Thu Oct 03, 2013 9:25 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how do i reverse the records in a dataset .

Postby Akatsukami » Fri Oct 04, 2013 12:48 am

First, it is a very bad idea to overwrite a data set.

Now, suppose your requirement is to create a second data set, with the records in reverse order from the first. For a PS data set or a VSAM ESDS, you're better off using your sort product; put a counter on the end of the record and then sort in descending order.

For a VSAM KSDS, perform a logical NOT on the key.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post