Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

i have a file which contains records like
10,30,90,50,20,40,80,60,70
i want to display these records in reverse order like
70,60,80,40,20,50,90,30,10
please give me the cobol code (do not sort the records)

Answer Posted / preethi

Declare table , and a index variable in the working storage section.

Procedure Division.

Open file1.
perform para1 thru para1-exit until end-of-file.
perform display-para thru display-para-exit.
close file1.
go back.
Para1.
read file1 into ws-file1
at end
end-of-file
set index-diff to index
not at end
move ws-file1-num to table-num(index)
set index up by 1
end-read.
para1-exit.
exit.

Display-para.
subtract 1 from index-diff.
perform until index-diff = 0
display table-num(index-diff)
set index-diff down by 1
end-perform.

display-para-exit.
exit.

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Whats the difference between search & search ALL?

6492


How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?

2559


Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

1075


What is the utilization of copybook in cobol? Could we utilize a similar copybook?

1206


What is difference between static and dynamic call in cobol?

1359


How you can characterize tables in cobol?

1176


How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that

3212


When is inspect verb is used in cobol?

1232


What are the different data types in cobol?

1404


What is a report item?

1130


how do you define single dimensional array and multidimensional array in your cobol?

1078


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

3247


Write the code implementing the perform … varying.

1041


What are the different rules to perform a Search?

1077


How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?

1179