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

/* 8. CM_AMT_ROUND - 금액 반올림 (순수 계산): 단위(T_ARG1)로 반올림. */
void CM_AMT_ROUND(TPSVCINFO *p)
{
    UBFH *b = (UBFH *)p->data;
    long amt = getl(b, T_AMOUNT), unit = getl(b, T_ARG1), r;
    if (unit <= 0) unit = 1;
    r = ((amt + unit / 2) / unit) * unit;
    setl(b, T_AMT1, r);
    OK(b);
}
