다양화: 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:
parent
b96cf702ee
commit
c3a0259e95
1027 changed files with 68915 additions and 40962 deletions
|
|
@ -1,9 +1,10 @@
|
|||
/* @tier easy @module mg @transform msg-gateway-online */
|
||||
/*
|
||||
* mg_ol_0007.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0007) [tier=easy]
|
||||
* mg_ol_0007.pgc - 오류전문 생성 서비스 (MG_OL_0007) [tier=easy]
|
||||
*
|
||||
* TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를
|
||||
* 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응)
|
||||
* 원전문(RAWMSG)과 오류코드(ERRCODE)를 받아 응답전문(0210)의 오류회신을
|
||||
* 구성한다. 원전문 식별필드는 그대로 보존하고 전문종별을 0210 으로 바꾼 뒤
|
||||
* resp_code 에 오류코드를 세팅하여 msg_pack 후 RAWMSG 로 반환한다.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -16,32 +17,63 @@ EXEC SQL INCLUDE sqlca;
|
|||
|
||||
TX_SERVICE(MG_OL_0007, ctx)
|
||||
{
|
||||
mg_rec_t rec;
|
||||
char key[16];
|
||||
int rc;
|
||||
char raw[MSG_ACQ_LEN + 8];
|
||||
char out[MSG_ACQ_LEN + 8];
|
||||
char errcode[8];
|
||||
int rawlen;
|
||||
acq_msg_t msg;
|
||||
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0007] 전문게이트웨이 단건조회 서비스 진입");
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0007] 오류전문 생성 서비스 진입");
|
||||
|
||||
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0007] KEY 누락");
|
||||
/* 1) 원전문 + 오류코드 수신 */
|
||||
rawlen = tx_buf_get(ctx->in, "RAWMSG", raw, sizeof(raw));
|
||||
if (rawlen != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0007] 원전문(RAWMSG) 누락 rc=%d", rawlen);
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
if (tx_buf_get(ctx->in, "ERRCODE", errcode, sizeof(errcode)) != TX_OK ||
|
||||
errcode[0] == '\0') {
|
||||
/* 오류코드 미지정 시 시스템오류로 간주 */
|
||||
strncpy(errcode, RESP_SYSERR, sizeof(errcode) - 1);
|
||||
errcode[sizeof(errcode) - 1] = '\0';
|
||||
}
|
||||
|
||||
/* 2) 오류코드 4자리 정규화 (부족분 zero-fill, 초과분 절단) */
|
||||
if ((int)strlen(errcode) != FLD_RESP_LEN) {
|
||||
char norm[FLD_RESP_LEN + 1];
|
||||
msg_field_set_num(norm, errcode, FLD_RESP_LEN);
|
||||
norm[FLD_RESP_LEN] = '\0';
|
||||
strncpy(errcode, norm, sizeof(errcode) - 1);
|
||||
errcode[sizeof(errcode) - 1] = '\0';
|
||||
}
|
||||
|
||||
/* 3) 원전문 언팩 (식별필드 보존 목적) */
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
if (msg_unpack(&msg, raw, MSG_ACQ_LEN) != 0) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0007] 원전문 언팩 실패");
|
||||
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_0007] 조회 실패 key=%s rc=%d(%s)",
|
||||
key, rc, tx_strerror(rc));
|
||||
tx_return(ctx, rc, ctx->out);
|
||||
/* 4) 오류응답으로 변환: 종별 0210, 응답코드 세팅, 금액 영처리 */
|
||||
msg_field_set(msg.msg_type, MSG_TYPE_RESP, FLD_MSG_TYPE_LEN);
|
||||
memcpy(msg.resp_code, errcode, FLD_RESP_LEN);
|
||||
msg_field_set_num(msg.amount, "0", FLD_AMOUNT_LEN);
|
||||
msg_field_set(msg.filler, "ERR", sizeof(msg.filler));
|
||||
|
||||
/* 5) 팩 후 오류 RAWMSG 반환 */
|
||||
if (msg_pack(&msg, out, MSG_ACQ_LEN) != 0) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0007] 오류전문 팩 실패");
|
||||
tx_return(ctx, TX_FAIL, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
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_0007] 조회완료 key=%s amount=%ld", key, rec.amount);
|
||||
tx_buf_set(ctx->out, "RAWMSG", out, MSG_ACQ_LEN);
|
||||
tx_buf_setlong(ctx->out, "RAWLEN", (long)MSG_ACQ_LEN);
|
||||
tx_buf_sets(ctx->out, "MSGTYPE", MSG_TYPE_RESP);
|
||||
tx_buf_set(ctx->out, "RESPCODE", errcode, FLD_RESP_LEN);
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0007] 오류전문 생성완료 respcode=%.4s", errcode);
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue