How to read the last 100 records from a COBOL file. The file
contains N number of records.
Answer Posted / mobi and remya
PROCEDURE DIVISION.
PARA.
OPEN INPUT STUDFILE.
PERFORM PARA1 UNTIL EOF = 1.
DISPLAY 'TOTAL NO:OF RECORDS ' A.
COMPUTE B = A - 100.
MOVE 0 TO EOF.
CLOSE STUDFILE.
OPEN INPUT STUDFILE.
PERFORM PARA2 UNTIL EOF = 1.
CLOSE STUDFILE.
STOP RUN.
PARA1.
READ STUDFILE AT END MOVE 1 TO EOF.
COMPUTE A = A + 1.
PARA2.
READ STUDFILE AT END MOVE 1 TO EOF.
COMPUTE C = C + 1.
IF C >= B AND EOF NOT = 1
DISPLAY STUD-REC.
| Is This Answer Correct ? | 16 Yes | 0 No |
Post New Answer View All Answers
input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?
how do you reference the printer file formats from cobol programs
What the difference is between continue and next sentence?
What is the difference between comp and comp-3?
How arrays can be defined in COBOL?
How do get the result of your program directly on your pc?
What are the access modes of START statement?
What are literals?
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
How do you differentiate between cobol and cobol-ii?
Can a Search can be done on a table with or without Index?
Give some examples of command terminators?
can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech
i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com
Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc