Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / lakshmi

1) iN WORKING STORAGE SECTION, Declare 2 variables HOLD-REC
and PRV-REC Equal to length of file and initialize them to
spaces
2) In Procedure divison, use the below logic and at the end
of the file read, PRV-REC contains the record before the
last record

READ <INFILE>
NOT AT END
MOVE HOLD-REC TO PRV-REC
MOVE INREC TO HOLD-REC
AT END
MOVE 'Y' TO EOF
END-READ

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to use the same COBOL program in Batch and CICS on lines? explain with an example

2327


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

1173


What are the different data types in cobol?

1328


Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc

1199


How arrays can be defined in COBOL?

1135


How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?

1185


What is the usage of comp fields in cobol?

1129


what is the use of outrecord?

2153


In which area will you utilize 88 level items in cobol?

1098


What is the difference between binary search and sequential search?

1043


i need a small 3d program using inline and outline.

2166


Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.

5669


What is a SSRANGE and NOSSRANGE?

1415


Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?

1114


how do you reference the variable unblock file formats from cobol programs

1278