/*
 * LIMIT_INQ.pgc - au 모듈 서비스 LIMIT_INQ (one service = one file).
 * 한도 조회 (가용한도 계산).
 * Moved verbatim from the former inline au_svr.pgc; runs on the caller's XA
 * branch (no EXEC SQL CONNECT). Advertised by au_svr at tpsvrinit.
 */
#include "LIMIT_INQ.h"

void LIMIT_INQ(TPSVCINFO *p)
{
    UBFH *b = (UBFH *)p->data;
    char card[24];
    long lim = 0, used = 0;
    gets_(b, T_KEY1, card, sizeof(card));
    if (audb_limit_get(card, &lim, &used) < 0) FAIL(b);
    setl(b, T_AMT1, lim);
    setl(b, T_AMT2, used);
    setl(b, T_AMT3, lim - used);       /* 가용한도 */
    OK(b);
}
