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 / vijay kumar reddy
identification division.
program-id. -------
environment division.
file control.
select infile assign to disky.
organization is sequential.
acess mode is sequential.
select outfile assign to disky1.
organization is sequential.
acess mode is sequential.
data division.
file section.
fd 01 infile.
05 ---
05
fd 01 outfile.
05 ---
05
working-storager section.
77 ws-eof pic 9 value zero.
77 ws-buffer1 pic x(80) value spaces.
77 ws-buffer2 pic x(80) value spaces.
procedure division.
000-main-para.
100-open-para thru 100-exit-para.
200-read-para thru 200-exit-para until ws-eof=1.
300-close-para thru 300-exit-para.
stop run.
100-open-para.
open infile.
open outfile.
100-exit-para.
exit.
200-read-para.
at end.
move 1 to ws-eof.
display buffer1.
not at end.
move buffer2 to buffer1
read infile.
move inrec to buffer2.
read infile.
move inrec to buffer1.
200-exit-para.
exit.
300-close-para.
close infile.
close outfile.
300-exit-para.
exit.
| Is This Answer Correct ? | 1 Yes | 4 No |
Post New Answer View All Answers
How to remove 2 duplicate records and copy only one using job control language?
Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.
how do you reference the variable unblock file formats from cobol programs
What is the difference between structured cobol programming and object alternativelyiented cobol programming?
How are the next sentence and continue different from each other?
Can we change the password using ALTER? anyone tried and changed?
How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?
Name some of the examples of COBOl 11?
How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?
How many bytes S(8) comp field occupy and its maximum value?
What is the problem of ordered sequential files access?
What are all the divisions of a COBOL program?
EXPLAIN MAIN FRAME TESTING PROCESS...HOW TO FIX THE MAINFRAME BUGS?
write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc
What is the difference between PIC 9.99 and 9v99 in COBOL?