JRIO API examples

Here some examples of JRIO APIs for accessing VSAM data sets:

Locate a record by key in keyed access record file

IKeyedAccessRecordFile karf =
    new KeyedAccessRecordFile("//JOE.KSDS",
                      ;         JRIO_READ_MODE);
IRecordFile index = karf.getPrimaryIndex();
karf.positionForward(index, key);
karf.read(index, buffer);
karf.close();

Position to a record in a random access record file

 IRandomAccessRecordFile rarf = new RandomAccessRecordFile("//JOE.KSDS", ; JRIO_READ_MODE); rarf.read(buffer); // reads the first record (record 0) rarf.positionLast(); rarf.positionPrev(); rarf.read(buffer); // reads the last record (record n-1) rarf.positionFirst(); rarf.positionNext(); rarf.read(buffer); // reads the second record (record 1) rarf.seek(5L); ...

Get VSAM Demystified now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.