RXVSAM is a package originated by Mark Winges. Mark is out of the programming game these days, preferring to devote his time to music, but he left behind a very useful piece of software that you can have for free. It can be found on file 268 of the CBT Tape. You will have to assemble the RXVSAM load module from its supplied source, but it doesn't have to be located in an authorized library, so anyone can have a VSAM-enabled REXX routine, and let me assure you that is something very useful to have on occasion. What follows will be a very 'surface' treatment of RXVSAM just to illustrate how powerful it is. It will not be a recitation of the RXVSAM manual.
Once you have RXVSAM available to you as a callable load module, you have to make it available to your REXX routine:
"LIBDEF ISPLLIB DATASET ID(...the loadlib with RXVSAM...) STACK"
and you have to allocate and open the VSAM dataset(s) you are going to work with:
"ALLOC FI($VS) DA("ocompds") SHR REU" rxv_rc = RXVSAM("OPENINPUT","$VS","KSDS")
A word of warning: RXVSAM is very fussy about its parameters. They must be exactly the right length. Quoted literals are best whenever possible. With the dataset allocated and open, VSAM I/O operations may commence:
rxv_rc = RXVSAM('READ','$VS',component,'AD0104') if rxv_rc > 0 then do /* ...oops */ sw.0error_found = 1 end else do parse var ad0104 appl 9 component 19 currver 29 bits 30 ... end
Here, a READ command is issued against a KSDS dataset previously opened as INPUT ($VS) using key 'component'. The result of the READ is returned in variable AD0104. Note carefully what is quoted and what is not quoted.
When the VSAM dataset is no longer needed, it must be closed by RXVSAM and FREEd:
rxv_rc = RXVSAM("CLOSE","$VS") "FREE FI($VS)"
and, of course, you must (eventually) release the LIBDEF for the RXVSAM library:
Virtually anything you can do to or with a VSAM dataset in COBOL or PL/I you can now do in REXX. If, for instance, an ISPF table has grown beyond the limits of practicality for tables, the data can be configured as a VSAM KSDS. To service an inquiry, read-with-key in the VSAM KSDS, and load a selection of the dataset's records to a temporary ISPF table. All the facilities for handling ISPF tables will then be available for use on that subset of the VSAM file — the best of both worlds.
I have a large number of examples of operations using RXVSAM. If you have questions, feel free to drop me a line.