I have two questions here.
1. How to read a flat file in reverse order?
2. How to read a VSAM KSDS file in reverse order?

In both the cases we donot know the total number of records.

Answers were Sorted based on User's Feedback



I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSD..

Answer / kingmanish

For the KSDS file we can set the pointer on the last record.
After that use the command READ Previous to read the
records in the reverse order.

I am not very sure about flat file. May be we can use a
turn around.
Sort the file in descending order first and then start
reading.

Is This Answer Correct ?    7 Yes 6 No

I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSD..

Answer / hanish

Flat file may be read in reverse order by using the following code

READ file-name into data-name REVERSED.

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More COBOL Interview Questions

if a pic 9(3) value 354,b pic x(2) value '46' then a)a>b 2)a<b 3)error

8 Answers   Cap Gemini,


wht happens if we dnt give scope terminator ?

4 Answers   TCS,


how to know that the file has 300 records how to acess it?

0 Answers   Hewitt, TCS,


what happens if we dont close cursor in db2-cobol pgm?

6 Answers  


what is the diff b/w select stsmt and cursor ?

2 Answers  






suppose a cobol programme A calling programme B,C and D. If C undergoes some change what if A,B,C,D need to be recompiled or only C nee to be recompliled.

2 Answers   IBM,


what is the use of comp2 ? where can we use it with example ?

3 Answers   Covansys,


Why IBM?

1 Answers   IBM,


how you will define variables length in cobol.

3 Answers   Temenos,


which is better either static call or dynamic call? and why?

5 Answers   HCL,


Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?

0 Answers  


How can we increase the size of an existing PDS to include more no. of modules. I tried the answer posted by Jagan(TSO PDS 'pds name') but did not find it working. The answer posted by kamal i know very well. Please suggest me a answer so that we don't need to delete the existing PDS and still we can change the size as well.

10 Answers  


Categories