COBOL File Handling

How do you read a file in reverse order through COBOL program?

Questions by rpg0247   answers by rpg0247

Showing Answers 1 - 7 of 7 Answers

Parandhama

  • Jul 19th, 2011
 

Using the 'REVERSE' while opening the file.

Ex: OPEN MODE FILE-NAME REVERSED

  Was this answer useful?  Yes

rasheeed17

  • Jan 19th, 2012
 

I have never seen any keyword like REVERSE or REVERSED in COBOL.

- If you want to read the file in reverse order, first sort you file so that you get the records in reverse order then read the file sequentially.

NOTE: sorting the file for reversing the records ONLY WORKS if all the records in your file are in either ASCENDING or DESC order, other wise your file record sequence/order is lost

  Was this answer useful?  Yes

Harsha

  • Jul 26th, 2014
 

In CICS, we can read the file in reverse order using READPREV command. In batch is not possible to read file in reverse order. Instead sort the file in reverse order and then read in COBOL program

  Was this answer useful?  Yes

Gyanendra Singh

  • Jul 7th, 2016
 

Can be done in VSAM : by using Low and HIGH-VALUE
If you pass HIGH-VALUE to the key field, then it will read the record from bottom

  Was this answer useful?  Yes

sunny

  • Jun 28th, 2017
 

Add a seq number to file thru JCL (1:seqnum,3,zd) and sort the file in descending order sortfields=copy, include cond=(1,3,zd,d) after this provide the file in Cobol as input.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions