Hitachi

OpenTP1 Version 7 分散トランザクション処理機能 OpenTP1 プログラム作成リファレンス C言語編


7.3.1 MHPの例(メイン関数)

MHPのメイン関数のコーディング例を次に示します。

  10  /*
  20   * MHP メイン関数
  30   */
  40  #include <stdio.h>
  45  #include <stdlib.h>
  50  #include <dcrpc.h>
  60  #include <dcmcf.h>
  70  
  80  main()
  90  {
 100     int rtn_cod ;
 110  
 120     printf("******  RPC OPEN   *****\n") ;
 130  /*
 140   * RPC-OPEN (UAPの開始)
 150   */
 160     rtn_cod = dc_rpc_open(DCNOFLAGS) ;
 170     if(rtn_cod != DC_OK) {
 180       printf("dc_rpc_open 失敗 !! CODE = %d \n", rtn_cod) ;
 190       goto PROG_END ;
 200     }
 210  
 220     printf("******  MCF OPEN   *****\n") ;
 230  /*
 240   * MCF-OPEN (MCF環境のオープン)
 250   */
 260     rtn_cod = dc_mcf_open(DCNOFLAGS) ;
 270     if(rtn_cod != DC_OK) {
 280       printf("dc_mcf_open 失敗 !! CODE = %d \n", rtn_cod) ;
 290       goto PROG_END ;
 300     }
 310  
 320     printf("******  MCF MAINLOOP   *****\n") ;
 330  /*
 340   * MCF-MAINLOOP (MHPサービスの開始)
 350   */
 360     rtn_cod = dc_mcf_mainloop(DCNOFLAGS) ;
 370     if(rtn_cod != DC_OK) {
 380       printf("dc_mcf_mainloop 失敗 !! CODE = %d \n", rtn_cod) ;
 390     }
 400  
 410     printf("******  MCF CLOSE   *****\n") ;
 420  /*
 430   * MCF-CLOSE (MCF環境のクローズ)
 440   */
 450     dc_mcf_close(DCNOFLAGS) ;
 460  
 470  PROG_END :
 480     printf("******  RPC CLOSE   *****\n") ;
 490  /*
 500   * RPC-CLOSE (UAPの終了) 
 510   */
 520     dc_rpc_close(DCNOFLAGS) ;
 530     exit(0) ;
 540  }