格式在 4gl 中不起作用 [ USING 子句 ]

发布于 11-16 23:05 字数 480 浏览 17 评论 0原文

我试图按如下方式格式化输出变量:

场景 1:

LET msg = "Roopesh Majeti here "
           Empno Using "&&&&&"
Call Logmsg(msg)

在这种情况下,empno 被格式化为 5 位数字 [ 我应该说空格 ] 并显示。

场景 2:

Let c_check = "&&"
Let msg ="Roopesh Majeti here"
          Empno using c_check
Call Logmsg(msg)

在这里,我的期望是,无论 c_check 的值是多少(例如 10 &'s ),那么 empno 都应该格式化为 10 个位置/空格。

但它没有按预期工作。

我在这里错过了什么吗?

I was trying to format the output variable as follows:

Scenario 1:

LET msg = "Roopesh Majeti here "
           Empno Using "&&&&&"
Call Logmsg(msg)

In this scenario, the empno get formatted to 5 digits [ I should say spaces ] and gets displayed.

Scenario 2:

Let c_check = "&&"
Let msg ="Roopesh Majeti here"
          Empno using c_check
Call Logmsg(msg)

Here, my expectation is that, whatever is the value of c_check [ say 10 &'s ] then the empno should be formatted to 10 positions/spaces.

But it's not working as expected.

Am I missing anything here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

虚拟世界2024-11-23 23:05:55

你没有说出你得到了什么,这使得你很难知道它是如何不起作用的。

您有一些轻微的语法错误,常量字符串后面缺少逗号。

您没有显示 msgc_check 的声明;问题可能是消息被截断了吗?

使用时你会得到什么:

DISPLAY "<<", msg CLIPPED, ">>"
DISPLAY "<<", msg,         ">>"

你应该能够向我们展示一个像这样的完整程序及其输出:

MAIN

    DEFINE msg      CHAR(64)
    DEFINE c_check  CHAR(20)
    DEFINE empno    INTEGER

    LET empno = 12345
    LET msg = "Roopesh Majeti here ", empno Using "&&&&&"
    DISPLAY "<<", msg CLIPPED, ">>"
    DISPLAY "<<", msg,         ">>"

    LET empno = 987654321
    LET c_check = "&&"
    LET msg ="Roopesh Majeti here", empno USING c_check
    DISPLAY "<<", msg CLIPPED, ">>"
    DISPLAY "<<", msg,         ">>"

END MAIN

You don't say what you do get, which makes it hard to know how it is not working.

You have some minor syntax errors, missing the commas after the constant strings.

You don't show the declaration of msg or c_check; could the problem be that the message is being truncated?

What do you get when you use:

DISPLAY "<<", msg CLIPPED, ">>"
DISPLAY "<<", msg,         ">>"

You should be able to show us a complete program like this, and its output:

MAIN

    DEFINE msg      CHAR(64)
    DEFINE c_check  CHAR(20)
    DEFINE empno    INTEGER

    LET empno = 12345
    LET msg = "Roopesh Majeti here ", empno Using "&&&&&"
    DISPLAY "<<", msg CLIPPED, ">>"
    DISPLAY "<<", msg,         ">>"

    LET empno = 987654321
    LET c_check = "&&"
    LET msg ="Roopesh Majeti here", empno USING c_check
    DISPLAY "<<", msg CLIPPED, ">>"
    DISPLAY "<<", msg,         ">>"

END MAIN
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文