can we read records in a file from botom to top. if
possible how can we read

Answer Posted / kk

data division.
working storage section.
01 opr pic a(1).
01 arrays.
02 aaa occurs n times.
03 name attribute.
------------------
------------------
01 I pic 9(2) value 1.

procedure division.
open file
read file at end move 'n' to opt
perform para1 until opt = 'n'
perform para2 until i = 0

para1.
move filed to aaa
add i to i.
read file at end move 'n' to opt.
perform-end.

para2.
diplay aaa(I).
compute i=i-1.
perform-end.

stop run.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

For rewrite, why is it mandatory that file needs to be opened?

620


how can i see junk values in dclgen or in hostvariable of comp ?

2544


Write the code to count the sum of n natural numbers.

697


What is the difference between comp and comp-3 usage?

678


What is the difference between binary search and sequential search?

638






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

643


what is the difference between COBOL2 AND COBOL390?

2453


How do we get current date from system with century in COBOL?

805


What are the different open modes available in cobol?

715


) How do u handle errors in BMS macro?

1427


write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc

706


Explain what you understand by passing by value.

694


What are the rules of the move verb?

704


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

1230


What is the Purpose of POINTER Phrase in STRING command in COBOL?

719