/*
 * CM_CODE.pgc - cm 모듈 서비스 CM_CODE (one service = one file).
 * Split out of the former inline cm_svr.pgc; runs on the caller's XA
 * branch (no EXEC SQL CONNECT). Advertised by cm_svr at tpsvrinit.
 */
#include "CM_CODE.h"

/* ========================================================================= */
void CM_CODE(TPSVCINFO *p)
{
    UBFH *b = (UBFH *)p->data;
    char grp[32], code[32];
    int ex;
    gets_(b, T_STR1, grp, sizeof(grp));  if (grp[0] == 0) strcpy(grp, "CCY");
    gets_(b, T_STR2, code, sizeof(code));
    ex = cmdb_code_exists(grp, code);
    if (ex < 0) FAIL(b);
    setl(b, T_RC, ex);
    OK(b);
}
