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


Please Help Members By Posting Answers For Below Questions

What is the difference between structured cobol programming and object alternativelyiented cobol programming?

959


example for sub strings ? and refernce modifications whit output pls

2068


Define static linking and dynamic linking.

868


What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

907


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

2127


What is the utilization of copybook in cobol?

882


what are decleratives in cobol?

2000


Explain about different table spaces.

854


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

926


What is perform what is varying?

916


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

946


Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

865


Which is not true about evaluate statement

2095


What is length is cobol?

860


how do you reference the fixed unblock file formats from cobol programs

924