This post combines information from earlier posts including,
- Writing a Rexx Function in C
- Updated RxRandom External Rexx Function (in C)
- RxRandom Revisited — Metal C
- Catalog Search (IGGCSI00) From COBOL
- Processing a GDG in Any Order Using IGGCSI00 in COBOL
Now we will build a Rexx function in C (Metal C) that uses the Catalog Search Interface (CSI), IGGCSI00, to access catalog information and return the results as a set of Rexx (stem) variables. Most all of the tools required to do this are demonstrated in the earlier posts, this post ties them all together.
The Rexx function is invoked from a Rexx program with
Call RXCSI filter, stemvar [, types]
or
Parse Value rxcsi(filter, stemvar [, types] ) With returncode reasoncode
where filter
represents a dataset name selection filter, stemva
r is the name of a stem variable prefix and types
, which is optional, represents a list of specific dataset types to be searched for. These a documented in DFSMS/MVS Managing Catalogs. Example types are
- A non-VSAM data set
- B Generation data group
- C Cluster
- G Alternate index
- H Generation data set
- X Alias
- L Tape volume catalog library entry
- W Tape volume catalog volume entry
An example call returns the non-VSAM and Cluster dataset names matching the filter and prints their storage class and volsers:
Call RXCSI 'SOME.HLQ.**', 'dsn.', 'AC' If result <> '0' Then Say 'rxcsi return/reason =' result Do d = 1 To dsn.0 Say dsn.d.type dsn.d Say ' ' dsn.d.storclas Do v = 1 To dsn.d.volser.0 Say ' ' dsn.d.volser.v End End
Source Notes
I don’t build Rexx variables for all of the possible fields that could be returned from IGGCSI00. There are comments in the source to help you to add or remove fields. For example, if you don’t have a tape library, the library and volume fields are unnecessary.
The source program uses the rexx.h
header built in an earlier post as well as one called iggcsina.h
which is built from SYS1.MACLIB(IGGCSINA) also with EDCDSECT.
I had written an earlier version of this program using System Programmer C (SPC) and recently updated it to use Metal C. In the earlier version I has used the Language Environment function EDCXABND to cause abends in certain error conditions. In the Metal C version, I replaced these calls with the Assembler ABEND macro using a C macro:
#define ABEND(abendcode, reasoncode) \ __asm (" ABEND (%0),REASON=(%1)\n" : : "XL:NR:r0"(abendcode), "XL:NR:r15"(reasoncode)); #define EDCXABND(abendcode, reasoncode) ABEND(abendcode, reasoncode)
There is also an example of issuing MVS LOAD and DELETE using inline assembler.
The SPC version also had the benefit of decimal support which Metal C does not provide, so I replaced it with some inline assembler UNPK
code. I was also able to add some binary flag decoding which I didn’t have in the SPC version.
I build my version as RENT which requires a little extra in the binding to include modules from CBC.SCCNOBJ.
Here is a load module in TRANSMIT format, compile for ARCH(5): RXCSI.ARCH5.LOAD