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

What is a SSRANGE and NOSSRANGE?

1416


what is amode(24), amode(31), rmode(24) and rmode(any)?

1092


explain sorting techniques in cobol program?

1145


What is the local-storage section?

1103


Define cobol?

1312


How are the next sentence and continue different from each other?

1225


Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.

2395


In COBOL programming, what is PERFORM? What is VARYING?

1087


What is the default value(s) for an initialize and what keyword allows for an override of the default?

1155


What is difference between static and dynamic call in cobol?

1301


How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?

1145


What is the difference between PIC 9.99 and 9v99 in COBOL?

1244


How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.

4120


What are the access modes of START statement?

1188


Can you please let me know the centre name of INS certification in Kolkata.

2181