다양화: 530개 online/batch 프로그램을 모듈별 고유 실업무 로직으로 재작성

- 템플릿 클론(정규화 후 0줄 상이) → 전 코퍼스 530/530 고유 바디
- 11개 모듈(mg/au/ac/rc/vl/st/py/lg/mm/cm/cl) 각 파일이 distinct한
  매입·대사·정산·수수료·지급·원장·마감·마스터·정합성·전문게이트웨이·공통 업무
- TxCore(ATMI 유사) + ECPG(EXEC SQL) 관용구, 프레임워크/헤더/DBIO API/파일ID·경로 유지
- 전체 docker make -j4 = EXIT 0, 958 오브젝트, 데모 바이너리 링크
- inventory.json loc 실측 갱신

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
forge-bot 2026-07-19 01:37:54 +00:00
parent b96cf702ee
commit c3a0259e95
1027 changed files with 68915 additions and 40962 deletions

View file

@ -8,10 +8,11 @@
#line 1 "app/online/mg_ol_0001.pgc"
/* @tier easy @module mg @transform msg-gateway-online */
/*
* mg_ol_0001.pgc - (MG_OL_0001) [tier=easy]
* mg_ol_0001.pgc - (MG_OL_0001) [tier=easy]
*
* TxCore TX_SERVICE . TXBUF mg DBIO
* TXBUF . (ATMI void SVC(TPSVCINFO*) )
* (0200) acq_msg_t /
* , (mg_ledger) ('R') .
* (ATMI void SVC(TPSVCINFO*) )
*/
#include <stdio.h>
#include <string.h>
@ -89,37 +90,74 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
#line 15 "app/online/mg_ol_0001.pgc"
#line 16 "app/online/mg_ol_0001.pgc"
TX_SERVICE(MG_OL_0001, ctx)
{
mg_rec_t rec;
char key[16];
int rc;
char raw[256];
int rawlen;
acq_msg_t msg;
mg_rec_t rec;
long amount;
int rc;
tx_log(TX_LOG_INFO, "[MG_OL_0001] 전문게이트웨이 단건조회 서비스 진입");
tx_log(TX_LOG_INFO, "[MG_OL_0001] 전문 수신 서비스 진입");
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
tx_log(TX_LOG_ERROR, "[MG_OL_0001] KEY 누락");
/* 1) 원시전문 수신 (고정길이 프레임) */
rawlen = tx_buf_get(ctx->in, "RAWMSG", raw, sizeof(raw));
if (rawlen <= 0) {
tx_log(TX_LOG_ERROR, "[MG_OL_0001] 원시전문(RAWMSG) 누락");
tx_return(ctx, TX_EINVAL, ctx->out);
return;
}
/* 2) 고정길이 언팩 */
memset(&msg, 0, sizeof(msg));
if (msg_unpack(&msg, raw, (int)strlen(raw)) != 0) {
tx_log(TX_LOG_ERROR, "[MG_OL_0001] 전문 언팩 실패 len=%d", (int)strlen(raw));
tx_return(ctx, TX_EINVAL, ctx->out);
return;
}
/* 3) 전문 검증 (전문종별/필수필드) */
if (msg_validate(&msg) != 0 ||
strncmp(msg.msg_type, MSG_TYPE_RECV, FLD_MSG_TYPE_LEN) != 0) {
tx_log(TX_LOG_WARN, "[MG_OL_0001] 전문 검증 실패 type=%.4s", msg.msg_type);
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESP", RESP_INVALID);
tx_return(ctx, TX_FAIL, ctx->out);
return;
}
/* 4) 구조체 -> 원장 레코드 매핑 */
amount = amount_parse(msg.amount, FLD_AMOUNT_LEN);
memset(&rec, 0, sizeof(rec));
rc = mg_rec_select(key, &rec);
msg_field_copy(rec.key, msg.approval_no, FLD_APPROVAL_LEN);
msg_field_copy(rec.merch_id, msg.merch_id, FLD_MERCH_ID_LEN);
msg_field_copy(rec.card_no, msg.card_no, FLD_CARD_NO_LEN);
msg_field_copy(rec.biz_date, msg.txn_date, FLD_TXN_DATE_LEN);
rec.amount = amount;
rec.fee = 0;
strncpy(rec.status, MG_ST_RECV, sizeof(rec.status) - 1);
/* 5) 원장 적재 */
rc = mg_rec_insert(&rec);
if (rc != TX_OK) {
tx_log(TX_LOG_WARN, "[MG_OL_0001] 조회 실패 key=%s rc=%d(%s)",
key, rc, tx_strerror(rc));
tx_log(TX_LOG_ERROR, "[MG_OL_0001] 원장 적재 실패 key=%s rc=%d(%s)",
rec.key, rc, tx_strerror(rc));
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESP", RESP_SYSERR);
tx_return(ctx, rc, ctx->out);
return;
}
/* 6) 수신확인 응답 구성 */
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESP", RESP_OK);
tx_buf_sets(ctx->out, "KEY", rec.key);
tx_buf_sets(ctx->out, "MERCHID", rec.merch_id);
tx_buf_setlong(ctx->out, "AMOUNT", rec.amount);
tx_buf_sets(ctx->out, "STATUS", rec.status);
tx_log(TX_LOG_INFO, "[MG_OL_0001] 조회완료 key=%s amount=%ld", key, rec.amount);
tx_log(TX_LOG_INFO, "[MG_OL_0001] 전문 수신완료 key=%s amount=%ld", rec.key, rec.amount);
tx_return(ctx, TX_OK, ctx->out);
}