Read a flat file and write last but one (I have n records in a file I have to write n-1th) record in another flat file. Could you please provide me the code in COBOL?



Read a flat file and write last but one (I have n records in a file I have to write n-1th) record in..

Answer / mehak

open input file reversed
this will read file in reversed order
write 2 record

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

I have a sequential file of 100 records. How do I load the records into a two dimensional array ?

3 Answers   IBM, Xansa,


I have a files containing both duplicate and non-duplicate records.The file is already sorted by a key.I want to determine those records that are duplicate and records that are non-duplicate.If duplicate the record is move to a duplicate file and if non-duplicate that will be move to valid file.thank you

1 Answers  


What is a SSRANGE and NOSSRANGE?

0 Answers  


What is static and dynamic call in cobol?

0 Answers  


What is the difference between SEARCH and SEARCH ALL?

6 Answers   Cognizant,






what is the size of W-REC in the following 01 W-REC 05 A PIC 9(4)V99 05 B READLINES A 10 C PIC XX 10 D PIC S9(4) 05 E OCCURS 7 PIC ZZ.ZZ 05 F OCCURS 5 10 G PIC ZZ.ZZZ99 10 H OCCURS 3 15 J PIC 9(3) 15 K PIC V99

2 Answers   TCS,


In a program, variables are used but no DB2 involved in it. Can you call it as host variables??

4 Answers   EDS,


What kind of error is trapped by on size error option?

0 Answers  


What does the INITIALIZE verb do?

1 Answers  


What is an in line perform? When would you use it? Anything else you wish to say about it.

0 Answers  


what happens if parmparameter passes zero bytes to the program

0 Answers   HSBC,


Consider the following: 77 A PIC 9(10) 77 B PIC 9(10) 77 C PIC 9(19) MULTIPLY AB BY B GIVING C Which of the following is true ? (a) The execution of the above may result in size error. (b) The execution of the above will result in size error. (c) The definition of C is invalid resulting in compilation error. (d) No error will be thee and the program would proceed correctly.

4 Answers   TCS,


Categories