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

/* 20. CM_CACHE_LOAD - 코드 그룹 캐시 로드 (건수 조회로 로딩 시뮬레이션). */
void CM_CACHE_LOAD(TPSVCINFO *p)
{
    UBFH *b = (UBFH *)p->data;
    char grp[32];
    long cnt;
    gets_(b, T_STR1, grp, sizeof(grp)); if (grp[0] == 0) strcpy(grp, "CCY");
    cnt = cmdb_count_codes(grp);
    if (cnt < 0) FAIL(b);
    setl(b, T_COUNT, cnt);
    userlog("CM_CACHE_LOAD grp=%s codes=%ld", grp, cnt);
    OK(b);
}
