wirte a pgm in using files in which we hav 10 ,20,30 40...100
records in inputfile and i want them to be send to outputfile
in reverse order.
PLZ HELP ME OUT .........THIS IS A RECENT QUESTION IN IGATE..
Answer Posted / quasar chunawala
However, if there are a fixed no. of records, as you have
mentioned in the question - which may not always be the
case with Production Files(They may contain millions of
records), you may follow this approach.
1. Read all the records into a COBOL array(table) A
(1,2,...10).
PERFORM VARYING I FROM 1 BY 1 UNTIL I>10
READ INPUT-FILE
MOVE INPUT-RECORD TO WS-RECORD(I)
END-PERFORM.
2. Print the data from the COBOL Array into Output-file.
PERFORM VARYING I FROM 10 BY -1 UNTIL I<1
WRITE WS-RECORD(I)
END-PERFORM.
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?
What is the LINKAGE SECTION used in COBOL?
What is the Purpose of Pointer in the string?
What are INPUT PROCEDURE and OUTPUT PROCEDURE?
What is static and dynamic call in cobol?
IF I mention stop run in CICS what happens?
what is difference between cobol and cobol/400
What is the utilization of copybook in cobol?
Write a program to enter and display the names of students in a class using the occurs clause.
How did the release of cobol/370 version 1.3 improve the performance of release 1.1?
What is an in line perform? When would you use it? Anything else you wish to say about it.
Difference between array and sub-script ?
please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?
What is the use of intialize verb?
Write a cobol program making use of the redefine clause.