1.2.4.2 API Definition for IMS/DB Plug-in

You must do the following steps to define an API for IMS/DB plug-in:

  1. Initialization
    extern "C" int db_init(int argc, char * argv[])

    Functionality: Initialization for configuration or others required by an implementation

    Arguments: parameter list passed from CLOPT of the servers

    Return Value: 0 - success, -1 -- failure

    Where to use: This API is called while an Tuxedo ART for IMS server starts. If a specific implementation of IMS/DB doesn't need any initialization work, just provide an empty function and make it return 0.

  2. Cleanup
    extern "C" int db_destroy()

    Functionality: Cleanup for configuration or others required by an implementation

    Arguments: None, because the servers can't provide input for Plug-in

    Return Value: 0 - success, -1 -- failure

    Where to use: This API is called while an Tuxedo ART for IMS server shuts down. If a specific implementation of IMS/DB doesn't need any initialization work, just provide an empty function and make it return 0.

  3. Action Prior to Invoking a COBOL program
    extern "C" int db_pre() 

    Functionality: Pre-Action required by an implementation before invoking a COBOL program which may access IMS/DB implementation

    Arguments: None, because the servers can't provide input for Plug-in

    Return Value: 0 - success, -1 -- failure

    Where to use: This API is called before Tuxedo ART for IMS servers invokes a COBOL program that may access IMS/DB implementation. If a specific implementation of IMS/DB doesn't need any initialization work, just provide an empty function and make it return 0.

  4. Action After Invoking a COBOL program
    extern "C" int db_post()

    Functionality: Post-Action required by an implementation after invoking a COBOL program which may access IMS/DB implementation

    Arguments: None, because the servers can't provide input for Plug-in

    Return Value: 0 - success, -1 -- failure

    Where to use: This API is called after Tuxedo ART for IMS servers invokes a COBOL program that may access IMS/DB implementation. If a specific implementation of IMS/DB doesn't need any initialization work, just provide an empty function and make it return 0.

  5. Database Access Entry
    extern "C"
    int db_entry(const char * op,__DB_PCB * pcb, void * io, char * 
    ssa_list[], int ssa_cnt);

    Functionality: The entry point of accessing the IMS/DB implementation. Each DL/I call for database access issued from a COBOL program is finally handled by it.

    Argument:
    • op: function call name, e.g. "GU "
    • pcb: pointer to a __DB PCB, which is a superclass of user provided DB PCB.
    • io: pointer to a buffer, DB_IO_AREA is defined by the external implementer
    • ssa_list: an array of strings, each containing a SSA, the format is up to the external implementer
    • ssa_cnt: number of elements in ssa_list, the value range is [0..15]

    Return Value: 0 - success; -1 - failure

    Where to use: DL/I DB call issued by COBOL program

  6. Get db pcb attributes
    extern "C"
    const __DB_PCB_ATTR * get_dbpcbattr (struct __DB_PCB * pcbm)
    Functionality: Used to get additional attributes of db pcb. These attributes are configured in PSB file.
    Argument:
    • pcbm: PCB Mask pointer

    Return Value: PCB Attribute pointer, the user can't modify anything contained in the PCB attribute structure returned by this API; If the input is not DB PCB or GSAM PCB, null is returned; If any optional attribute is not configured, default value is returned;No need to free the pointer;

    Where to use: 3rd party DB plugin when called with db pcb.

  7. Fill db pcb segment name
    extern "C"
    int fill_dbpcb_segname (struct __DB_PCB * pcb)

    Functionality: Used to get segment name of db pcb. This interface should be provided by DB plugin.

    Argument:
    • pcb: PCB Mask pointer(DB PCB or GSAM PCB), segname in the pcb mask should be filled with correct value;

    Return Value: 0 : success, other: failed.