Excel 电子表格到 COBOL 程序

Excel spreadsheet to COBOL program

我有一个任务要将 Excel 宏(基本上是屏幕抓取)迁移到 COBOL 程序。

问题是用户想要以 excel 格式输入,我很困惑如何将 excel 文件转换为 TN3270 大型机系统的可读输入。

有些人建议做一些称为平面文件转换的事情,我不确定该怎么做。

是否有更简单的方法可以将 Excel 电子表格的输入提取到 TN3270 大型机上的 运行 COBOL 程序。

下面是要转换的工具截图。

据我所知,我们可以将其转换为平面文件并使用分隔符(|) 读取字符串,但我想知道是否有更好的方法。

您不能 运行 Excel 在大型机上编写代码,每次用户需要更多类似 Excel 的功能时,都会增加复杂性。这将是重新发明轮子的一种变体,这是要避免的事情。

您有一个用户使用 Excel,大型机上的 IMS 数据库中需要该信息。到目前为止,最明智的做法是为 link 两者一起提供一些东西,允许用户继续使用 Excel 但需要自定义(针对特定的 Excel 应用程序)以连接到 IMS 数据库并使用它,甚至用于更新。

你如何去做这取决于你在你的网站上已经拥有的可以用来做这件事的东西。这是一篇来自 IBMSystems 杂志大型机版的文章:http://www.ibmsystemsmag.com/mainframe/administrator/ims/imstm_integration/

这是文章的摘录,向您展示了执行此操作的一些选项组。在这些组中,将有具体的方法来应用每个选项。当然,在 RYO 下,还有大量高度定制的可能性:

  1. Java EE Connector Architecture (JCA)

A Java-based technology solution for connecting application servers and enterprise information systems (EIS), with a standard set of system-level contracts between the Java EE application server and a resource adapter that manage the connection, transactions, security, work, life cycle, transaction inflow and message inflow.

You have an existing Java EE server or one of the IBM servers that needs access to IMS.

Primary use is direct synchronous IMS access.

  1. Simple Object Access Protocol (SOAP)

A protocol that allows heterogeneous applications to discover and communicate with each other in a platform- and language-independent way.

You need to interact with partners or applications that require the SOAP protocol.

Primary use is synchronous IMS access.

  1. Representational State Transfer (REST)

A protocol for simple Web services and efficient exchanges of data through stateless applications, used in conjunction with JavaScript Object Notation (JSON), a lightweight data-interchange format. JSON and REST are often used in mobile applications, mashup tools or automated business processes.

You need mobile solutions.

  1. Java Message Services (JMS)

An asynchronous-based messaging interface for exchanging of data between computers using messaging services in support of Java programs.

You have existing Java applications.

You are using a Java EE/JMS-based application server.

Primary use is asynchronous IMS access.

  1. Roll-your-own (RYO)

An approach often used when the organization already has its own implementations of solutions that handle the transactions, security and message flow.

You have an existing in-house server that needs a simple API to connect to IMS.

您需要返回给设计人员,他们需要联系您的技术支持,以了解此类连接已经可用的内容。如果什么都没有,那么就必须有人对不同供应商提供的内容进行技术审查。最喜欢的搜索引擎会给出这些提供者是谁的命中率。

您可能希望将任务分成几个步骤

  1. 从 Excel sheet
  2. 中提取数据
  3. 使数据对 COBOL 程序可用
  4. 使用 COBOL 中的数据

不知道你的问题的细节我只能在这一点上提出解决方案:

  1. 使用 Visual Basic for applications 创建文件(您可能需要寻找 CSV 解决方案并考虑到可能需要更改文件编码)
  2. 使用传输实用程序 - 例如ftp 或其他一些大型机连接,让您可以将文件从 Excel-运行 计算机传输到大型机。一些3270终端软件也为此提供了API。
  3. 将 Excel 逻辑转换为 COBOL(如果有)

其实很简单。只需将 Excel 文件保存为 CSV 文件(以逗号分隔)。列中的每个字段的大小都可以不同。然后使用相同的保存名称将其读入 COBOL 程序。然后只需在 COBOL 中使用 UNSTRING 来用 ',' 分隔字段。

在一个程序中,我将 Excel 文件中的 50,000 条记录读入 COBOL,有时多 10,000 条,有时少。在 COBOL 中使用动态语句,它会自动将 Excel 文件中的每一列分隔到 COBOL 中。我正好用表来存储记录。