c#无法在Unisys大型机Windows共享上创建EBCDIC文件 [英] c# Cannot create EBCDIC file on Unisys Mainframe Windows Share

查看:137
本文介绍了c#无法在Unisys大型机Windows共享上创建EBCDIC文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将用户在asp.net站点上生成的数据上传到Unisys大型机.我的客户决定他们要我直接将数据加载到Unisys Mainframe Windows共享上,而不是使用FTP上传文件. FTP通常会在ASCII和EBCDIC之间进行转换.

I am attempting to upload data generated by users on asp.net site to a Unisys mainframe. My client decided that they want me to load the data directly onto a Unisys Mainframe windows share instead of using FTP to upload the file. FTP typically does the conversion between ASCII and EBCDIC.

问题在于,无论我是否已将文件内容编码为EBCDIC,大型机都将文件视为ASCII.

The problem is that the mainframe sees the file as ASCII regardless of whether I've encoded the file contents as EBCDIC.

测试代码在这里:

        string dataToWrite = "ACHR0000000000575TEST EBCDICPAYEE             8899007500038159 0000001000160330 ".ToUpper();
        Encoding ebcdic = Encoding.GetEncoding("IBM037");

        List<byte> bytes = new List<byte>();
        bytes.AddRange(Encoding.Convert(Encoding.ASCII, ebcdic, Encoding.ASCII.GetBytes(dataToWrite)));


        using (var unc = new UNCAccessWithCredentials())
        {
            // get access to the reconciliation file share using credentials in the config
            string path = @"\\xxx\RECONDEV";
            unc.NetUseWithCredentials(path, "XXX","", "XXX");
            string fileName = Path.Combine(path, "ACH");
            using (var binWriter = new BinaryWriter(File.OpenWrite(fileName)))
            {
                binWriter.Write(bytes.ToArray());
                binWriter.Flush();
                binWriter.Close();
            }
        }

问题
1)我是否应该将文件创建为ASCII,然后让大型机作业调用实用程序来转换文件EBCDIC?如果是这样,该实用程序的名称是什么?大型机操作员一无所知.

Questions
1) Should I create the file as ASCII and then have the mainframe job call a utility to convert the file EBCDIC? If so, what is the name of the utility? The mainframe ops don't know of one.

2)有什么方法可以在.net内实际创建EBCDIC文件? EBCDIC编码可以正常工作,但是我认为文件类型不同,因此无法找到任何内容.

2) Is there some way to actually create an EBCDIC file within .net? The EBCDIC encoding is working but I believe the file types are different and I have not been able to find out anything.

从字面上看,二十年来我没有对大型机做任何事情,所以我不敢相信.

I literally haven't done anything with a mainframe in 2 decades so I am out of my depth.

先谢谢了. 克里斯

推荐答案

仅供参考,一位顾问建议我们在将文件复制到大型机共享时使用名为MCPCopy的实用程序将文件从ASCII流复制并转换为EBCDIC. .该实用程序可以作为NXExtend的一部分安装. ASP.Net站点使用的命令行是:

Just FYI, a consultant suggested we use a utility called MCPCopy to copy and convert the files from an ASCII stream to EBCDIC as we copied the file to the mainframe share. The utility can be installed as part of the NXExtend. The command line used by the ASP.Net site is:

c:\ Windows \ MCPCopy.exe {SourceFile} {DestinationFile}/Y/Z:SR/D:80

c:\Windows\MCPCopy.exe {SourceFile} {DestinationFile} /Y /Z:SR /D:80

希望这会有所帮助

这篇关于c#无法在Unisys大型机Windows共享上创建EBCDIC文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆