Page 1 of 1

RRDS and Slot number

PostPosted: Thu Apr 14, 2011 8:01 pm
by michel123
Hello,

Can I define an order in a RRDS by specifying a key in the file definition?

IF I have the keys 0001, 0003 and 0004, will I free the slot 2?


Thanks.

Re: RRDS and Slot number

PostPosted: Thu Apr 14, 2011 8:09 pm
by Robert Sample
The manual says:
KEYS(length offset| 64 0)
Provides information about the prime key field of a key-sequence data set's data records.

This parameter overrides any KEYS specification on the DATACLASS parameter.

This parameter applies only to key-sequenced clusters. The default is a key field of 64 bytes, beginning at the first byte (byte 0) of each data record.
Hence you cannot specify KEYS for an RRDS VSAM file.

Re: RRDS and Slot number

PostPosted: Thu Apr 14, 2011 8:28 pm
by BillyBoyo
michel123 wrote:Can I define an order in a RRDS by specifying a key in the file definition?



No.

IF I have the keys 0001, 0003 and 0004, will I free the slot 2?


No, you can't have keys.

You obviously have something in mind you are trying to do. Want to let us in on it, maybe then we can help?

Re: RRDS and Slot number

PostPosted: Thu Apr 14, 2011 8:52 pm
by michel123
so I misread the documentation. records are ordered by increasing number, starting from the first one is 0.
That's what gives me DITTO, I have this:

DITTO/ESA for MVS VB - VSAM Browse

CATALOG
RBA 0 Slot 1_________ Col 1_______ Format CHAR
VOLSER FUSR02 Type DATA DSNAME PG8997.ARTICLE2.RRDS.VSAM.DATA

RBA Len 1...5...10....5...20....5...30....5...40....5...50....5...60
0 50 0001GARE .... A010
50 50 0003TGV ....ORANGE A010 .
100 50 0005RAILS .... A010
150 50 0010COFFRET SNCF ....
200 50 0036CASQUE ....ROUGE A040
250 50 0037GENOUILLERE ....VERT A040
300 50 0038SKATE ....JAUNE A050
350 50 0040COFFRET SECURITE .... A050
400 50 0050COFFRET SKATE ....
450 50 0060VELO 0m&.ROUGE
500 50 0070VELO 0094BLANC
**** End of data ****

To be in order and have 0002 on slot 2 and not 0003, I'll have to load a empty record in second position?

Re: RRDS and Slot number

PostPosted: Thu Apr 14, 2011 9:01 pm
by Robert Sample
Are you using a language to write to the file? If so, COBOL (for example) allows you to specify the relative record number and write directly to that slot -- so you would have to write anything into slot 2.

Re: RRDS and Slot number

PostPosted: Thu Apr 14, 2011 9:31 pm
by michel123
Not yet. I wanted to write it in assembler.
I'll take the test and make sure that this slot 2 is available.

Re: RRDS and Slot number

PostPosted: Fri Apr 15, 2011 4:02 am
by BillyBoyo
michel123 wrote:...starting from the first one is 0.


The first record is numbered 1, as far as the RR part is concerned. The RBA is 0 for RR 1. Depends how you want to access it I guess.

If you add records 1, 3 and 4, you can always add number 2 later, you don't have to reserve space for it. You might want to reserve space (load the file up with dummies initially) to simplify your coding, so you read and update, rather than read, add if it is not there, else update. Depends on your requirement.

Is that your own train set, or do you work for SNCF? :-)

Re: RRDS and Slot number

PostPosted: Fri Apr 15, 2011 6:16 pm
by michel123
This means that VSAM reserve an available slot to insert after the number 2?

Re: RRDS and Slot number

PostPosted: Fri Apr 15, 2011 6:28 pm
by Robert Sample
You need to read -- cover to cover, no matter how long it takes -- http://www.redbooks.ibm.com/redbooks/pdfs/sg246105.pdf which is a link to the VSAM Demystified IBM Redbook.

An RRDS consists of a set of slots for records. These slots are sequentially numbered 1, 2, 3, 4, ... and go up to however many slots you defined the RRDS to contain (hence the NUMBERED option in the IDCAMS DEFINE command to indicate you are defining an RRDS). If you place something in slot #2, there is a record in that slot. If you do not place anything in slot #2, there is still a slot #2. In fact, without deleting the entire RRDS you cannot get rid of slot #2 -- it must always exist.

The 0001, 0003, 0004, and so forth -- if they are part of the record then they are placed in the slot just like every other byte of data in the record. If they are the slot number ,then they tell which slot to place the record in. If they are part of the record, there is no relationship between the slot number and that part of the record -- you could put the record containing 0003 in slot 2, or you could put the record containing 0918 in slot 2 ... it all depends upon how you load the data into the RRDS.

Re: RRDS and Slot number

PostPosted: Fri Apr 15, 2011 7:33 pm
by michel123
This time it is quite clear. I doubt, but now it is discarded.

Thank you for your answers.