LoveUnix » 中间件技术 » CICS编程的约束?
让LU留住您的每

一天 让LU博客留住您的每一天
2004-5-10 13:01 herfool
最近在写cics下pd程序的过程中,发现有些变量的声明放在main里面的话,在调用的时候cicstail就输出错误;把这些声明放到main外面错误消失。<br />哪位大大帮忙分析一下这是为什么?好像跟内存操作有关。

2004-5-10 17:38 sosowang
虽然我们有看过你程序,但是我敢肯定,你的程序有问题。

2004-5-11 00:20 vanda_chensh
什么错误?信息太少了

2004-5-11 13:46 herfool
错误是这样的:<br />Run-time exception error; current exception: CicsException<br />        During stack unwinding, a destructor must handle its own exception.<br />ERZ014016E/0036 05/11/04 13:41:24 CICSTEST     : Transaction &#39;CPMI&#39;, Abend &#39;ASRA&#39;, at &#39;????&#39;.<br />ERZ015028W/0154 05/11/04 13:41:24 CICSTEST     : Exception in user application code - exception string is: &#39;exc_e_SIGIOT&#39;<br />ERZ015018W/0010 05/11/04 13:41:24 CICSTEST     : Abnormal Termination &#39;ASRA&#39;, Transaction &#39;CPMI&#39;, Program &#39;&#39;<br />ERZ016050W/0234 05/11/04 13:41:24 CICSTEST     : Logical unit of work for transaction &#39;CPMI&#39; has been backed out; Distributed Transaction Service (TRAN) reason &#39;ENC-tra-1025: A client (not the transaction service) aborted&#39;<br /><br />奇怪的是在main内部不能声明class对象实例,比如:<br />    CFoo foo;<br />    string szTest;<br />运行的时候就出现上面的错误;但是声明其他类型的变量就没问题。

2004-5-12 13:59 hugh_jf_chen
<!--QuoteBegin-herfool+2004-05-11 13:46:03--><div class='quotetop'>QUOTE(herfool @ 2004-05-11 13:46:03)</div><div class='quotemain'><!--QuoteEBegin--> 错误是这样的:<br />Run-time exception error; current exception: CicsException<br />&nbsp; &nbsp; &nbsp; &nbsp; During stack unwinding, a destructor must handle its own exception.<br />ERZ014016E/0036 05/11/04 13:41:24 CICSTEST&nbsp; &nbsp;  : Transaction &#39;CPMI&#39;, Abend &#39;ASRA&#39;, at &#39;????&#39;.<br />ERZ015028W/0154 05/11/04 13:41:24 CICSTEST&nbsp; &nbsp;  : Exception in user application code - exception string is: &#39;exc_e_SIGIOT&#39;<br />ERZ015018W/0010 05/11/04 13:41:24 CICSTEST&nbsp; &nbsp;  : Abnormal Termination &#39;ASRA&#39;, Transaction &#39;CPMI&#39;, Program &#39;&#39;<br />ERZ016050W/0234 05/11/04 13:41:24 CICSTEST&nbsp; &nbsp;  : Logical unit of work for transaction &#39;CPMI&#39; has been backed out; Distributed Transaction Service (TRAN) reason &#39;ENC-tra-1025: A client (not the transaction service) aborted&#39;<br /><br />奇怪的是在main内部不能声明class对象实例,比如:<br />&nbsp; &nbsp; CFoo foo;<br />&nbsp; &nbsp; string szTest;<br />运行的时候就出现上面的错误;但是声明其他类型的变量就没问题。 <!--QuoteEnd--></div><!--QuoteEEnd--><br />所有的类实例变量都不行,还是只是某些不行?如果某些不行,检查那些类的构造函数。

2004-5-12 23:54 herfool
所有的类实例都不能在main中声明,原因怀疑是EXEC CICS RETURN;并不是像return那样,在退出函数的时候自动进行析构释放程序中声明的变量,而是采用了类似long jump机制,所以这些类实例的内存不能释放,从而出错。<br />解决的办法是间接的函数busi(),调用过程如下:<br />bool busi(char *pCommArea)<br />{<br />    Class CFoo;    // 声明类实例<br />    ...    //业务流程<br /><br />    return true;<br />}<br /><br />main()<br />{<br />    ...    //CICS代码,获得pCommArea指针<br /><br />    //调用业务函数<br />    busi(pCommArea);<br /><br />    EXEC CICS RETURN;<br />}<br /><br />通过这种办法,错误消失。

页: [1]
查看完整版本: CICS编程的约束?


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.