Tags

,

VSAM – KEYS

Consider the below VSAM definition

DEFINE CLUSTER –

(NAME (YOUR.KYMWK15C.VSAM)) –

DATA –

(NAME (YOUR.KYMWK15C.VSAM.DATA) –

CYL(500 500) –

KEYS (04 2) –

RECORDSIZE (6577 6577) –

) –

INDEX –

(NAME (YOUR.KYMWK15C.VSAM.INDEX))

The below data is currently available in the VSAM file.

—-+—-10—+—-20

011234VSAM

123456KEY

234567STARTS

345678AT

Now when a random read on the VSAM file is done with the key value as 3456, what is the record that would be read?

KEYS give information about the prime key field of a key-sequenced data set’s data records. And the KEY is provided as KEYS (length offset) where length represents the length of the KEY field and offset represents the displacement (in bytes) from the beginning of the record.

In our question, KEYS is provided as KEYS (04 2), so the key length is 4 and the OFFSET is 2, which means that the key starts from the 3rd byte. So when we read VSAM file with keys as 3456, the record 123456KEY would be read.

——————————————————————————————————–

In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog

——————————————————————————————————–

You may also like to look at:

Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
SAS – SAMPLE PROGRAM
CA DISPATCH – Useful Commands
Locate the INVALID data in a field using FILE AID
File-Aid Relational Operators, Data Types
Xpediter – Batch Setup
FILE AID – VIEW TIP
FILEAID TIPS
EDIT PDS USING FILE-AID – FAST MODE
VSAM – KEYS
Comparison of ESDS, KSDS, RRDS, VRRDS, and linear data sets
VSAM OPEN CLOSE I/O RETURN CODES
VSAM INTERVIEW QUESTIONS
VSAM TIPS
Advertisement