标准输入流&QUOT在设置外壳的控制break语句;排爆"退出COBOL程序 [英] Setting shell's control break statement in the standard input stream "EOD" to exit the COBOL program

查看:285
本文介绍了标准输入流&QUOT在设置外壳的控制break语句;排爆"退出COBOL程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过在EOD指定命令行提示值如下调用直通shell脚本COBOL程序。

I would like to invoke a cobol program thru shell script by assigning command line prompt values in the "EOD" as below.

#!/bin/bash
run pub/coblprog<<:EOD:
1
2
3
:EOD:

考虑一下,如果COBOL程序coblprog有4个命令行提示,并在运行时预计4输入命令行参数。我在EOD指定3提示值。由于COBOL有四个提示,但不EOD经过3个值,COBOL程序进入无限循环,预计第四提示值。

Consider if COBOL program "coblprog" has 4 command line prompts and expects 4 input command line arguments at runtime. I have specified 3 prompt values in the EOD. Since COBOL has four prompts but at EOD does passing 3 values , COBOL program is going into infinity loop to expecting the fourth prompt value.

我的要求是,我想之前所有的第二次提示值后设置一个shell的控制break语句(如下面):EOD :.通过观察shell的控制语句的shell脚本应该异常终止。

My requirement is, I would like to set an shell's control break statement (like below) after all prompt values before second :EOD:. By seeing that shell's control statement the the shell script should terminate abnormally.

#!/bin/bash
run pub/coblprog<<:EOD:
1
2
3
exit 1
:EOD:

我已经有声明退出的脚本并运行,但没有运气..!请建议我很好的解决方案。

I have have exit statement in the script and run, but no luck..! Please suggest me good solution.

我执行在Linux上的脚本,COBOL程序是Micro Focus公司COBOL。

I am executing the script in LINUX, COBOL program is Micro Focus COBOL.

推荐答案

这行后&LT的数据;&LT;:EOD:到该行之前的1开始:EOD:输入到COBOL程序和的外壳控制语句,因此在退出1 会的数据的,这可能不是你想要的。

The data from the line after <<:EOD: until the line just before the one beginning :EOD: is input to the COBOL program, and not shell control statements, therefore the exit 1 will be data, which is probably not what you want.

如果你想运行coblprog后shell脚本退出,然后将它放在开头的行之后:EOD:

If you want the shell script to exit after running coblprog, then place it after the line beginning :EOD:.

#!/bin/bash
run pub/coblprog<<:EOD:
1
2
3
4
:EOD:
exit 1

这篇关于标准输入流&QUOT在设置外壳的控制break语句;排爆&QUOT;退出COBOL程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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