다양화: 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

@ -1,9 +1,11 @@
/* @tier easy @module mg @transform msg-gateway-online */
/*
* mg_ol_0027.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0027) [tier=easy]
* mg_ol_0027.pgc - 전문게이트웨이 전문 길이 검증 서비스 (MG_OL_0027) [tier=easy]
*
* TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를
* 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응)
* LLLL(선두 4자리 길이 prefix) 프레이밍 규약에 따라, 전문 앞 4바이트에
* 선언된 길이와 실제 본문 길이가 일치하는지 검증한다. 길이 prefix가
* 숫자가 아니거나 선언길이 != 실제길이면 반려한다.
* (순수 검증 로직 - DB 접근 없음)
*/
#include <stdio.h>
#include <string.h>
@ -14,34 +16,64 @@
EXEC SQL INCLUDE sqlca;
#define MG_LEN_PREFIX 4
TX_SERVICE(MG_OL_0027, ctx)
{
mg_rec_t rec;
char key[16];
int rc;
char raw[512];
int rawlen, declared, actual, i;
tx_log(TX_LOG_INFO, "[MG_OL_0027] 전문게이트웨이 단건조회 서비스 진입");
tx_log(TX_LOG_INFO, "[MG_OL_0027] 전문 길이 검증 서비스 진입");
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
tx_log(TX_LOG_ERROR, "[MG_OL_0027] KEY 누락");
/* 1) 원시전문 수신 (LLLL + 본문) */
rawlen = tx_buf_get(ctx->in, "RAWMSG", raw, sizeof(raw));
if (rawlen <= 0) {
tx_log(TX_LOG_ERROR, "[MG_OL_0027] 원시전문(RAWMSG) 누락");
tx_return(ctx, TX_EINVAL, ctx->out);
return;
}
memset(&rec, 0, sizeof(rec));
rc = mg_rec_select(key, &rec);
if (rc != TX_OK) {
tx_log(TX_LOG_WARN, "[MG_OL_0027] 조회 실패 key=%s rc=%d(%s)",
key, rc, tx_strerror(rc));
tx_return(ctx, rc, ctx->out);
/* 2) 최소 길이(프레임 헤더) 확인 */
actual = (int)strlen(raw);
if (actual < MG_LEN_PREFIX) {
tx_log(TX_LOG_WARN, "[MG_OL_0027] 프레임 헤더 부족 len=%d", actual);
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESP", RESP_INVALID);
tx_return(ctx, TX_EINVAL, ctx->out);
return;
}
/* 3) 길이 prefix 숫자 검증 */
for (i = 0; i < MG_LEN_PREFIX; i++) {
if (raw[i] < '0' || raw[i] > '9') {
tx_log(TX_LOG_WARN, "[MG_OL_0027] 길이 prefix 비숫자 pos=%d", i);
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESP", RESP_INVALID);
tx_return(ctx, TX_FAIL, ctx->out);
return;
}
}
/* 4) 선언길이 vs 실제 본문길이 비교 */
declared = (raw[0] - '0') * 1000 + (raw[1] - '0') * 100 +
(raw[2] - '0') * 10 + (raw[3] - '0');
actual -= MG_LEN_PREFIX; /* 본문 실제 길이 */
tx_buf_reset(ctx->out);
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_0027] 조회완료 key=%s amount=%ld", key, rec.amount);
tx_buf_setlong(ctx->out, "DECLARED", (long)declared);
tx_buf_setlong(ctx->out, "ACTUAL", (long)actual);
if (declared != actual) {
tx_log(TX_LOG_WARN, "[MG_OL_0027] 길이 불일치 선언=%d 실제=%d",
declared, actual);
tx_buf_sets(ctx->out, "RESP", RESP_INVALID);
tx_buf_sets(ctx->out, "MATCH", "N");
tx_return(ctx, TX_FAIL, ctx->out);
return;
}
tx_buf_sets(ctx->out, "RESP", RESP_OK);
tx_buf_sets(ctx->out, "MATCH", "Y");
tx_log(TX_LOG_INFO, "[MG_OL_0027] 길이 일치 len=%d", declared);
tx_return(ctx, TX_OK, ctx->out);
}