/*
 * RC_EXCEPTION.pgc - rc 모듈 서비스 RC_EXCEPTION (one service = one file).
 * Moved verbatim from the former inline rc_svr.pgc; runs on the caller's XA
 * branch (no EXEC SQL CONNECT). Advertised by rc_svr at tpsvrinit.
 */
#include "RC_EXCEPTION.h"

/* 13. RC_EXCEPTION - 대사 예외 등록. */
void RC_EXCEPTION(TPSVCINFO *p)
{
    UBFH *b = (UBFH *)p->data;
    char bizdate[16], reason[128];
    long pid = getl(b, T_PURCHASE_ID), eid;
    gets_(b, T_BIZDATE, bizdate, sizeof(bizdate));
    gets_(b, T_REASON, reason, sizeof(reason)); if (reason[0] == 0) strcpy(reason, "AMT_MISMATCH");
    eid = rcdb_insert_exception(pid, reason, bizdate);
    if (eid < 0) FAIL(b);
    setl(b, T_ID1, eid);
    OK(b);
}

/* vim: set ts=4 sw=4 et smartindent: */
