how to fetch the record before the last record in a cobol
file( its a huge file and if the key field is not known)
Answer Posted / krishna
<PROCEDURE DIVISION>
OPEN INPUT <INFILE>.
OPEN OUTPUT <OUTFILE>.
PERFORM <READ-PARA-NAME> UNTILL EOF='Y'.
PERFORM <CLOSE-PARA-NAME>.
================================
READ-PARA-NAME.
READ <INFILE> AT END MOVE 'Y' TO EOF
IF EOF NOT = 'Y'
MOVE INREC TO OUTREC
WRITE OUTREC.
================================
CLOSE-PARA-NAME.
CLOSE INFILE.
CLOSE OUTFILE.
STOP RUN.
| Is This Answer Correct ? | 4 Yes | 7 No |
Post New Answer View All Answers
What is cobol?
input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.
What guidelines should be followed to write a structured cobol prgm?
Can a Search can be done on a table with or without Index?
What is comp-1 and comp-2?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
What is a SSRANGE and NOSSRANGE?
What are all the divisions of a COBOL program?
If you are current on the owner of a set, what is the difference between obtain next and obtain first?
What is the utilization of copybook in cobol?
What is the difference between PIC 9.99 and 9v99 in COBOL?
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
What are the different data types in cobol?
Difference between cobol and cobol-ii?
What is the use of intialize verb?