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 know whether the module is dynamical or statistical?
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
What is the difference between structured cobol programming and object alternativelyiented cobol?
I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue
How many sections are there in data division in COBOL?
What is the utilization of copybook in cobol?
Define static linking and dynamic linking.
) how do u code after getting data?
In COBOL programming, what is PERFORM? What is VARYING?
Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks
What is the difference between a binary search and a sequential search what are the pertinent cobol?
what is amode(24), amode(31), rmode(24) and rmode(any)?
What is report-item in COBOL?
What are different data types in cobol?
) what is the difference between AID and HANDLE AID?