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
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
Write the code implementing the perform … varying.
how do you define single dimensional array and multidimensional array in your cobol?
Can you please let me know the centre name of INS certification in Kolkata.
Explain about different table spaces.
How many bytes S(8) comp field occupy and its maximum value?
What is rmode(any) ?
how do you reference the fixed unblock file formats from cobol programs
There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.
How to know whether the module is dynamical or statistical?
How do you reference the following file formats from cobol programs?
Name the sections present in data division.
Which Search verb is equivalent to PERFORM…VARYING?
What is the difference between structured cobol programming and object alternativelyiented cobol?
Which is not true about evaluate statement