题
我想利用WTO指令从与金属C到打印出的“Hello World”我的工作日志。这是基于例如在z / OS V1R10.0金属C语言编程指南第1.2.3.5和参考,当我使用WTO我有含0或ASCII到EBCDIC转换我的缓冲或者问题时出现。我在下面贴上我的工作日志,其次是我的代码,然后从IBM的例子,我无法得到编译代码的相关部分。 作业日志
09.01.56 J0686275 IEF403I IMIJWS0G - STARTED - TIME=09.01.56 09.01.56 J0686275 +...0....... 09.01.56 J0686275 - --TIMINGS (MINS.)-- ----PAGING COUNTS--- 09.01.56 J0686275 -IMIJWS0G GO 00 6 .00 .00 .00 1292 0 0 0 0 0 1 09.01.56 J0686275 IEF404I IMIJWS0G - ENDED - TIME=09.01.56
我的代码
#include #include #include int main() { struct WTO_PARM { unsigned short len; unsigned short code; char* text; } wto_buff = { 4+11, 0, "hello world" }; __asm( " WTO MF=(E,(%0)) " : : "r"(&wto_buff)); }
IBM代码
int main() { struct WTO_PARM { unsigned short len; unsigned short code; char text[80]; } wto_buff = { 4+11, 0, "hello world" }; __asm( " WTO MF=(E,(%0)) " : : "r"(&wto_buff)); return 0; }
解决方案
在IBM例子为我工作(z / OS下1.9),但我不得不添加 一个编译设置代码页: 在示例的顶: 的#pragma filetag( “IBM-500”) 编译器不接受的字符文本的[和] [80]; 我试图改变字符文本[80]成char *文字很好,但我得到了同样的 奇怪的结果作为你。
其他提示
也许在该结构的两个版本的存储器的布局是不一样的?我想这在GCC:
#include <stdio.h>
struct WTO_PARM {
unsigned short len;
unsigned short code;
char *text;
};
int main()
{
struct WTO_PARM moo = { 4+11,0,"hello" };
printf("size %zu struct %p string %p\n", sizeof(struct WTO_PARM),&moo,moo.text);
return 0;
}
下面是结果:
size 8 struct 0x22cce0 string 0x402000
但是,如果我更改文本参数的类型到char [80],结果更改为:
size 84 struct 0x22cc80 string 0x22cc84
在WTO指令可能期望的字符串被包装右成结构体。
你为什么不能编译IBM样?它工作正常,我 - 也许你能告诉我们你的编译器PARMS和错误消息
你编辑通过TN3270客户端代码?这很可能是问题出在你的模拟器相关的代码页。例如我需要在ISPF以下变化:C x'4A“x'AD”的所有(对于[)和c x'5A“x'BD”(用于]),以编译源...
不隶属于 StackOverflow