MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to read a last record of a KSDS VSAM file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vinuknr
Beginner


Joined: 17 Mar 2005
Posts: 3
Topics: 1
Location: London

PostPosted: Thu Mar 17, 2005 5:10 am    Post subject: How to read a last record of a KSDS VSAM file Reply with quote

Hi all,

Any idea how to do this?



I don
_________________
Regards,
Vinu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Mar 17, 2005 8:42 am    Post subject: Reply with quote

vinuknr,

There are couple of ways to do it.

1. You can use an utility like file-aid , sort to write the last record from the vsam cluster.

ex:

Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD DSN=YOUR VSAM FILE,
//            DISP=SHR
//SORTOUT  DD DSN=LAST.RECORD.FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(1,1),RLSE)
//SYSIN    DD *                 
  SORT  FIELDS=COPY                 
  OUTFIL NODETAIL,REMOVECC,         
  TRAILER1=(1,80)                   
/*


Code:

//STEP0100 EXEC PGM=FILEAID 
//SYSPRINT DD SYSOUT=*         
//DD01     DD DSN=INPUT.DATASET,
//            DISP=SHR
//DD01O    DD DSN=LAST.RECORD.FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(1,1),RLSE),
//            DCB=(RECFM=FB,LRECL=???,BLKSIZE=0)   
//SYSIN    DD  *                   
$$DD01 COPYBACK OUT=1
/*


Programatically you can use READ PREVIOUS with high-values in the key field of the vsam cluster.

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vinuknr
Beginner


Joined: 17 Mar 2005
Posts: 3
Topics: 1
Location: London

PostPosted: Mon Mar 21, 2005 9:08 am    Post subject: Reply with quote

Hi Kolusu,
Thanks a llot for the Solution.
When I tried moving Moving HIGH VALUES to the RIDFLD worked
_________________
Regards,
Vinu
Back to top
View user's profile Send private message Yahoo Messenger
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Mon Mar 21, 2005 11:00 pm    Post subject: Reply with quote

Hi Vinu,

999 is not a high value for S9(3) COMP-3 variable. High value refers to x'FFFFFF'( Hex value).

Trying moving the above it will work..

Very Happy Hope the above info helps you.
_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
vinuknr
Beginner


Joined: 17 Mar 2005
Posts: 3
Topics: 1
Location: London

PostPosted: Tue Mar 22, 2005 4:29 am    Post subject: Hi Reply with quote

Thanks Shivaraj.
_________________
Regards,
Vinu
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group