VSAM file status 02.



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

VSAM file status 02.

Postby sandeepjanar » Thu Oct 31, 2013 2:52 am

Hi all,

I have a doubt in VSAM. It would be really helpful if some one can help me with that.

I got a VSAM file (say A) with first 48 characters as key. There is an alternate path created for this VSAM (say B) with fields 33-42 (10 digit field as key) as key.
I am writing a program where I must use path B as I have to query on that 10 digit field. (I can directly use VSAM file A but it is going to take lot of time to process all records). That 10 digit field has alphanumeric values WITH DUPLICATES.
In my program, I have a input value. I need to read this path B with 10 digit key >= Input-key.. My intention is to retrieve multiple records from VSAM satisfying the criteria.. Please let me know how to do it.. Not sure if it is possible to do also..

Thanks,
Sandeep.
sandeepjanar
 
Posts: 6
Joined: Sat Mar 09, 2013 12:20 am
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM file status 02.

 

Re: VSAM file status 02.

Postby Robert Sample » Thu Oct 31, 2013 3:18 am

You did not specify the language your program is written in. I am assuming COBOL; other languages would use similar methodss. Use
START <file name> KEY IS <alt-key-name>
followed by READ NEXT to retrieve the data in alternate index sequence.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: VSAM file status 02.

Postby sandeepjanar » Thu Oct 31, 2013 3:52 am

I am sorry about that.. yes it is COBOL..
I tried giving START FILE B KEY IS FILE B KEY..
Then I did a READ NEXT... it is giving RC=02 (duplicate)..
Thanks for your reply..
sandeepjanar
 
Posts: 6
Joined: Sat Mar 09, 2013 12:20 am
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM file status 02.

Postby BillyBoyo » Thu Oct 31, 2013 4:18 am

There is more than one record with that same alternate key value. What problem does that give you?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: VSAM file status 02.

Postby Robert Sample » Thu Oct 31, 2013 5:43 am

A file status code of 02 is NOT an error -- so your code should ignore it and continue.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: VSAM file status 02.

Postby sandeepjanar » Thu Oct 31, 2013 10:53 am

Thanks for the help. It did work. I am able to make it work after adding further processing under IF condition IF STATUS-CODE = '02'.
sandeepjanar
 
Posts: 6
Joined: Sat Mar 09, 2013 12:20 am
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM file status 02.

Postby dick scherrer » Thu Oct 31, 2013 9:51 pm

Hello,

You need to make sure you understand why you changed the code . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: VSAM file status 02.

Postby sandeepjanar » Thu Oct 31, 2013 10:03 pm

Yes. I did understand. Initially I was assuming STATUS-CODE shouldn't be '02' when we use START & READNEXT. Now I am clear that when we read sequentially from a particular point in this case, status '02' is a valid possible code that comes because of duplicate keys. So, we can read all records next using status code '00' or '02'. Let me know if I have understood anything wrong.
sandeepjanar
 
Posts: 6
Joined: Sat Mar 09, 2013 12:20 am
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM file status 02.

Postby Robert Sample » Thu Oct 31, 2013 10:17 pm

It is worth noting that the first digit of the file status code being a zero means that the operation was successful, even though the second digit can be 0, 2, 4, 5, or 7 to denote various conditions that did not prevent the operation but could impact the results.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: VSAM file status 02.

Postby sandeepjanar » Thu Oct 31, 2013 10:24 pm

Robert, I never knew this. Thanks for sharing. This will help me.
sandeepjanar
 
Posts: 6
Joined: Sat Mar 09, 2013 12:20 am
Has thanked: 0 time
Been thanked: 0 time


Return to VSAM/SMS

 


  • Related topics
    Replies
    Views
    Last post