Last record



Help for IBM's record-oriented filesystem VSAM, ESDS, KSDS, RRDS, LDS and Storage management Subsystems

Last record

Postby Shakthivel V » Mon May 24, 2010 12:56 am

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??
Shakthivel V
 
Posts: 22
Joined: Thu Mar 04, 2010 12:12 am
Has thanked: 0 time
Been thanked: 0 time

Re: Last record

Postby dick scherrer » Mon May 24, 2010 1:32 am

Hello,

Not gonna happen. . .

How would you propose to run a program without JCL. . . :?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Last record

Postby Shakthivel V » Mon May 24, 2010 2:05 am

Sorry i mean by using JCL(SORT or anyother) dont want to retriew the last record. through the program i need to acive that.
Shakthivel V
 
Posts: 22
Joined: Thu Mar 04, 2010 12:12 am
Has thanked: 0 time
Been thanked: 0 time

Re: Last record

Postby dick scherrer » Mon May 24, 2010 2:08 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Last record

Postby Shakthivel V » Mon May 24, 2010 3:53 am

Thanks Dick. . Is there any possible to get the last record by using high values concept in COBOL program?
Shakthivel V
 
Posts: 22
Joined: Thu Mar 04, 2010 12:12 am
Has thanked: 0 time
Been thanked: 0 time

Re: Last record

Postby Robert Sample » Mon May 24, 2010 4:42 am

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to VSAM/SMS

 


  • Related topics
    Replies
    Views
    Last post