📄 spisi.cpre
字号:
/* * This is a part of the Application Preconsole * - Service Provide - ISI. * Copyright (C) 2000-2000 ABC.SDC. * All rights reserved. * * This source code is only intended as a supplement to the * Application Preconsole Reference and related * electronic documentation provided with the library. * See these sources for detailed information regarding the * Application Preconsole product. * * Update record: * 2002-2-4 HLW - Communication of ISI * cics program */ #include <sybtesql.h> #include "ap.h"EXEC SQL INCLUDE sqlca;EXEC SQL INCLUDE "isi.h";/* * Constant macros defined in this file *//* * Message constant macros */#define MSG_INIT "MSG_INIT"RESULT CallIsi(PISO8583STRU piso8583stru){ char cMsg[SIZE_MSG_ISO8583 + 2]; UINT nSize; char szDelayId[8 + 1], szTsqName[8 + 1]; char szSeqNo[AP_LEN_SEQNO + 1]; char szMsgId[SIZE_MSGID + 1]; short sSize; long lRespCode; bufclr(szSeqNo); bufclr(szDelayId); bufclr(szTsqName); bufclr(szMsgId); nSize = SIZE_MSGID; ASSERT_NORMAL(GetBitInIso8583(piso8583stru, BIT_MSGID, szMsgId, &nSize)); if (strcmp(szMsgId, "0820") == 0 || strcmp(szMsgId, "0800") == 0 || strcmp(szMsgId, "0500") == 0) { nSize = SIZE_TRACENO; ASSERT_NORMAL(GetBitInIso8583(piso8583stru, BIT_TRACENO, szSeqNo, &nSize)); strcpy(szDelayId, "DM"); strcat(szDelayId, szSeqNo); strcpy(szTsqName, "QM"); strcat(szTsqName, szSeqNo); } else { nSize = SIZE_RETRIEVALREFNO; ASSERT_NORMAL(GetBitInIso8583(piso8583stru, BIT_RETRIEVALREFNO, szSeqNo, &nSize)); strcpy(szDelayId, "DI"); strcat(szDelayId, szSeqNo + 6); strcpy(szTsqName, "QI"); strcat(szTsqName, szSeqNo + 6); } bufclr(cMsg); cMsg[0] = 0xF9; cMsg[1] = 0xF7; nSize = SIZE_MSG_ISO8583; ASSERT_NORMAL(ExportIso8583(piso8583stru, &cMsg[2], &nSize)); ASSERT_NORMAL(SendAppc("CD01", "MODELU62", "RECV", cMsg, nSize + 2));#ifdef DEBUGIsiPrintIso8583(piso8583stru, "SPISI REQUEST ISO8583");#endif bufclr(cMsg); strcpy(cMsg, MSG_INIT); EXEC CICS ADDRESS EIB(dfheiptr); EXEC CICS WRITEQ TS QUEUE(szTsqName) FROM(cMsg) LENGTH(strlen(cMsg)) RESP(lRespCode); if (!VERIFY(lRespCode == DFHRESP(NORMAL))) return UNKNOWN; /* * 等待接收应答报文。 */ EXEC CICS DELAY FOR SECONDS(45) REQID(szDelayId) RESP(lRespCode); if (!VERIFY(lRespCode == DFHRESP(NORMAL)) && lRespCode != DFHRESP(EXPIRED)) { EXEC CICS DELETEQ TS QUEUE(szTsqName); return UNKNOWN; } /* * 读TSQ中的响应报文。 */ sSize = sizeof(cMsg); bufclr(cMsg); EXEC CICS READQ TS QUEUE(szTsqName) INTO(cMsg) ITEM(1) LENGTH(sSize) RESP(lRespCode); if (!VERIFY(lRespCode == DFHRESP(NORMAL))) { EXEC CICS DELETEQ TS QUEUE(szTsqName); return UNKNOWN; } EXEC CICS DELETEQ TS QUEUE(szTsqName); if (strcmp(cMsg, MSG_INIT) == 0) return UNKNOWN; /* * 应答报文返回SP。 */ if (!VERIFY_NORMAL(ImportIso8583(piso8583stru, cMsg + 2, sSize - 2))) return UNKNOWN;#ifdef DEBUGIsiPrintIso8583(piso8583stru, "SPISI RESPONSE ISO8583");#endif return NORMAL;}/* * main function */ void main(){ char *pcCommArea; UINT nSize; RESULT rTemp; ISO8583STRU iso8583stru; EXEC CICS ADDRESS EIB(dfheiptr); EXEC CICS ADDRESS COMMAREA(pcCommArea); if (!VERIFY_NULL(pcCommArea) || !VERIFY((nSize = dfheiptr->eibcalen) == SIZE_MSG_ISO8583)) EXEC CICS RETURN; memset(&iso8583stru, 0, sizeof(ISO8583STRU)); if (!VERIFY_NORMAL(CreateIso8583(&iso8583stru, ifistruIsi)) || !VERIFY_NORMAL(ImportIso8583(&iso8583stru, pcCommArea, nSize))) { strcpy(pcCommArea, "EC0996"); DeleteIso8583(&iso8583stru); EXEC CICS RETURN; } if (!VERIFY((rTemp = CallIsi(&iso8583stru)) != UNKNOWN)) strcpy(pcCommArea, "EC0999"); else if (!VERIFY_NORMAL(rTemp)) strcpy(pcCommArea, "EC0996"); else ExportIso8583(&iso8583stru, pcCommArea, &nSize); DeleteIso8583(&iso8583stru); EXEC CICS RETURN; } /* End of this file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -