Appendix A. Catalog Management API

Table of Contents

A.1. Overview
A.2. Initialization & Finalization
A.2.1. amsu_initialize()
A.2.2. amsu_finalize()
A.3. Volume Information
A.3.1. amsu_volume_list()
A.3.2. amsu_default_volume()
A.3.3. amsu_volume_path()
A.4. Catalog Search
A.4.1. amsu_use_catalogs()
A.4.2. amsu_search_entries()
A.4.3. amsu_master_catalog()
A.4.4. amsu_candidate_catalog()
A.5. File Path Resolution
A.5.1. amsu_filepath2()
A.5.2. amsu_filename2()
A.6. Entry Management
A.6.1. amsu_delete()
A.6.2. amsu_info()
A.6.3. amsu_assoc()

This appendix describes how to manage catalog items and data sets using the Catalog Management API.

Catalogs and data sets can be managed by using the OpenFrame Catalog Management API.

To write a program using the Catalog Management API, you must include the ams_user.h header file that is distributed with the OpenFrame binary and link the libams.so library when compiling the program.

The Catalog Management API can be categorized as follows:

Searches for a specific entry in a catalog. Catalogs are prioritized as follows:

  1. Catalog specified by amsu_use_catalogs()

  2. Alias catalog specified by filter_key

  3. Master catalog if the previous searches return no result

    • Prototype

      int amsu_search_entries(char *filter_key, char *entry_types, int *count,
                              amsu_result_t *result, int flags);
    • Parameters

      ParameterDescription

      filter_key

      Catalog entry expression to search for. (IN: including wild card characters, such as '*', '%')

      entry_types (IN)

      Catalog entry type to search for. (NULL means all)

      count (OUT)

      Result buffer size (IN), search result entry count.

      result (OUT)

      Buffer to store the search result.

      flags (IN)

      Catalog search option.

    • Return Value

      If successful, 0 is returned. If an error occurs, a negative error code is returned.

    • Note

      The following are catalog entry types and search option macros. Refer to the macros defined in the ams_user.h header file for catalog entry types and catalog search options.

      MacroEntry typeDescription

      AMSU_ENTRY_TYPE_NONVSAM

      'A'

      Non-VSAM

      AMSU_ENTRY_TYPE_GDG

      'B'

      Generation data group

      AMSU_ENTRY_TYPE_CLUSTER

      'C'

      VSAM cluster

      AMSU_ENTRY_TYPE_DATA

      'D'

      Data component

      AMSU_ENTRY_TYPE_AIX

      'G'

      Alternate index

      AMSU_ENTRY_TYPE_GDS

      'H'

      Generation data set

      AMSU_ENTRY_TYPE_INDEX

      'I'

      Index component

      AMSU_ENTRY_TYPE_PATH

      'R'

      Access path

      AMSU_ENTRY_TYPE_UCAT

      'U'

      User catalog

      AMSU_ENTRY_TYPE_ALIAS

      'X'

      Alias

      Catalog Search Option Macros:

      MacroSearch optionDescription

      AMSU_SEARCH_DEFAULT

      0x00

      Searches for the default value

      AMSU_SEARCH_CLS_COMPS

      0x01

      Returns the component if the cluster name matches the filter key

      AMSU_SEARCH_1_CATALOG

      0x02

      Searches only a single catalog

      A catalog search result is stored in the following structure:

      /* -------------------------- catalog search result -------------------- */
      typedef struct _amsu_result_t {
          char        catname[AMSU_ENTRY_NAME_LENGTH+1];
          char        entname[AMSU_ENTRY_NAME_LENGTH+1];
          char        enttype;
      } amsu_result_t;