已请求执行程序,但PROCEDURE / ENTRY具有USING子句 [英] Executable program requested but PROCEDURE/ENTRY has USING clause

查看:150
本文介绍了已请求执行程序,但PROCEDURE / ENTRY具有USING子句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道导致此编译错误的原因吗?我正在尝试使用OpenCOBOL编译旧版COBOL程序。这是我得到的错误:

Does anyone one know what is causing this compilation error? I'm trying to compile a legacy COBOL program using OpenCOBOL. This is the error that I'm getting :

Error: Executable program requested but PROCEDURE/ENTRY has USING clause

这是我的过程部门的外观:

This is how my procedure division looks:

procedure division using array-area, m, err, sum1.

这是我工作站的链接部分:

And this is the linkage section from my working station:

working-storage section.
77  i    picture s99 usage is computational.
77  prev picture s9(8) usage is computational.
77  d    picture s9(4) usage is computational.
01 error-mess.
    02 filler picture x(22) value ' illegal roman numeral'.
linkage section.
77  m    picture s99 usage is computational.
77  err  picture s9 usage is computational-3.
77  sum1 picture s9(8) usage is computational.
01  array-area.
    02 s picture x(1) occurs 30 times.


推荐答案

working-storage section.
77  i    picture s99 usage is computational.
77  prev picture s9(8) usage is computational.
77  d    picture s9(4) usage is computational.
01 error-mess.
    02 filler picture x(22) value ' illegal roman numeral'.
linkage section.
77  m    picture s99 usage is computational.
77  err  picture s9 usage is computational-3.
77  sum1 picture s9(8) usage is computational.
01  array-area.
    02 s picture x(1) occurs 30 times.

首先,不需要使用用法。我将USAGE用于INDEX和POINTER。 计算性不需要完全拼写, COMP 就足够了,其中包括 COMP -3

Firstly, there is no need for the words usage and is. I use USAGE for INDEX and POINTER. computational does not need to be spelled in full, COMP is sufficient, and that include COMP-3.

77级已经远远超过其卖出日期,很难在<$ c中看到它们$ c>链接部分。如果将它们全部更改为01级,则不会影响程序的运行。

Level-77's are well past their sell-by date, and it would be rare to see them in the LINKAGE SECTION. It will not affect the operation of the program if you change them all to 01-levels.

数据名称很糟糕,几乎没有意义。我们有30个角色可玩,因此使它们有意义。我是什么,D和M?您只能通过仔细查看代码来分辨。

The data-names are terrible, almost without meaning. We have 30 character to play with, so make them meaningful. What are I, D and M? You can only tell by looking, in detail, at the code.

这似乎是整个工作存储部分链接部分不属于其中,它们都属于 DATA DIVISION 的一部分)。这将表明该程序在PROCEDURE DIVISION中没有太多内容,但也确实包含很多文字。不好使程序更难以维护。

That seems to be the entire WORKING-STORAGE SECTION (which the LINKAGE SECTION is not part of, they are both instead part of the DATA DIVISION). This would indicate that the program does not have much in the PROCEDURE DIVISION, but also that what does have involves a lot of literals. Which is bad. Makes the program more difficult to maintain.

该程序似乎与罗马数字有关。为了突出数据名称可能引起的混乱,数字D,I和M分别与数据名称D,I和M无关,但是如果您不走运,则可以使用一个或多个数据名称。将与一个具有单个字符名称的数据名称相关联,但名称不同。

The program seems to be something to do with Roman numerals. To highlight the confusion that the data-names can cause, the numerals D, I and M are nothing to do with the data-names D, I and M respectively, but if you are more unlucky, one or more of the data-names will be associated with a data-name with a single-character name, but a different one.

没有更多的代码就不能说更多。如果您需要对其进行审查,则Stack Exchange可以提供专门用于此目的的代码审查方面。工作代码,如何做得更好...

Can't say more without more code. If you want a review of it, Stack Exchange has a side, Code Review, exactly for that purpose. Working code, how to do it better...

从现在显示的代码中,您需要编译该代码作为可加载模块,因此请使用-m开关而不是-x:

From the code you have now shown, you need to compile that as a loadable module, so use the -m switch instead of -x:

cobx -m ..otherswitches.. yourprogramname

被z / OS调用的程序在程序分区的使用上只有一个项目,这将是一个由两个字节的二进制文件(可能是COMP,也许是COMP-4,COMP-5或BINARY,这无关紧要)和一个最多100字节的PIC X组成的组项目使用OCCURS,但极有可能没有。

A program which has been called by z/OS would only have one item on the USING of the PROCEDURE DIVISION, and it would be a group-item which would consist of a two-byte binary (likely COMP, perhaps COMP-4, COMP-5 or BINARY, it would not matter) and a PIC X of up to 100 bytes, perhaps defined with an OCCURS but most likely not. Possibly it would have the word PARM in the name.

您显示的代码看起来不太像传统的z / OS COBOL程序:-)

The code you have shown does not look much like a legacy z/OS COBOL program :-)

首先,您可能要考虑升级到GnuCOBOL,这是OpenCOBOL的新名称。这里有一个讨论区, https://sourceforge.net/p/open -cobol / discussion /?source = navbar ,以解决任何大大小小的问题。

First, you may want to consider upgrading to GnuCOBOL, the new name for OpenCOBOL. There is a discussion area here, https://sourceforge.net/p/open-cobol/discussion/?source=navbar, for any problem, large or small.

GnuCOBOL知道,如果在程序部分中使用或ENTRY语句,如果使用-x开关将其编译为可执行文件,则不能期望该程序正常运行。

GnuCOBOL knows that if you have a USING on the PROCEDURE DIVISION or an ENTRY statement, you cannot expect the program to work if it is compiled as an executable, with the -x switch. It would have to be compiled as a loadable module, with -m.

但是,正如cschneid指出的那样,在IBM Mainframe COBOL中通常有一个有效的在执行的第一个程序中使用,因为这是从运行程序的JCL中获取参数值的方法。

However, as cschneid has pointed out, in IBM Mainframe COBOLs it is common and valid to have a USING in the first program executed, as this is the way to take a parameter value from the JCL which is running the program.

如果是这种情况,则需要更改代码,以允许从命令行输入参数。

If this is the case, you will need to change the code, to allow for a parameter from the command-line.

那么,您有哪个?应该使用-m编译的Called程序,还是需要操作系统提供参数的程序?

So, which do you have? A CALLed program that should be compiled with -m, or a program which expects a parameter from the operating system?

无论是否升级,都应该获得一份副本Gary Cutler的《 OpenCOBOL / GnuCOBOL编程指南》中的内容。使用 gary cutler cobol编程指南进行的搜索将使您能够找到正确的。

Whether you upgrade or not, you should get yourself a copy of Gary Cutler's Programming Guide for the OpenCOBOL/GnuCOBOL that you will be using. A search with gary cutler cobol programming guide will allow you to locate the correct one.

这篇关于已请求执行程序,但PROCEDURE / ENTRY具有USING子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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