Page 1 of 1

Last record

PostPosted: Mon May 24, 2010 12:56 am
by Shakthivel V
Hi.. I want to get the very last record in the file without using any JCL. i want to retrive in program how it is possible??

Re: Last record

PostPosted: Mon May 24, 2010 1:32 am
by dick scherrer
Hello,

Not gonna happen. . .

How would you propose to run a program without JCL. . . :?

Re: Last record

PostPosted: Mon May 24, 2010 2:05 am
by Shakthivel V
Sorry i mean by using JCL(SORT or anyother) dont want to retriew the last record. through the program i need to acive that.

Re: Last record

PostPosted: Mon May 24, 2010 2:08 am
by dick scherrer
Hello,

In your program read each record and move it to working-storage. When the AT END condition is raised, the record in working-storage is the last record. If you want to know the logical record number also put a counter in working-storage and add 1 each time a record is moved to working-storage.

Re: Last record

PostPosted: Mon May 24, 2010 3:53 am
by Shakthivel V
Thanks Dick. . Is there any possible to get the last record by using high values concept in COBOL program?

Re: Last record

PostPosted: Mon May 24, 2010 4:42 am
by Robert Sample
If the file is sequential, the answer is no -- you must read every record to reach the last record.

If the file is VSAM KSDS, being accessed from CICS, and you put a HIGH-VALUES record into the file, you can use READPREV to get to the last record. Batch VSAM access does not support read previous, though, so if you're using a batch program then you must, again, read every record to read the last record.