Steps in a simple program

A simple program involves the following steps:

  1. Set up the programming environment:

    cs_ctx_alloc – allocate a context structure. ct_init – initialize the programming interface.

  2. Establish a connection with a server or CICS or IMS region:

    ct_con_alloc – allocate a connection structure. ct_con_props – set or retrieve connection structure properties. ct_connect – connect to a server.

  3. Send a command to the server or to a CICS or IMS region.

    (For three-tier processing, send a command to Mainframe ClientConnect which forwards the request to the target server, and routes the results back to the client program.)

    ct_cmd_alloc – allocate a command structure. ct_command – initiate a language request or remote procedure call. ct_send – send a request to the server.

  4. Process the results of the command:

    ct_results – set up result data to be processed. ct_res_info – return result set information. ct_bind – bind a returned column or parameter to a program variable. ct_fetch – fetch result data.

  5. Finish up:

    ct_cmd_drop – deallocate a command structure. ct_close – close a server connection. ct_con_drop – deallocate a connection structure. ct_exit – exit the programming interface. cs_ctx_drop – deallocate a context structure.