/*
 * CM_CODENAME.pgc - cm 모듈 서비스 CM_CODENAME (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_CODENAME.h"

/* 2. CM_CODENAME - 공통코드 명 조회 (EXEC SQL). */
void CM_CODENAME(TPSVCINFO *p)
{
    UBFH *b = (UBFH *)p->data;
    char grp[32], code[32], name[128];
    gets_(b, T_STR1, grp, sizeof(grp));  if (grp[0] == 0) strcpy(grp, "CCY");
    gets_(b, T_STR2, code, sizeof(code));
    if (cmdb_get_code_name(grp, code, name) < 0) {
        userlog("CM_CODENAME 미존재 grp=%s code=%s", grp, code);
        FAIL(b);
    }
    sets_(b, T_STR3, name);
    OK(b);
}
