为什么需要数字常量?

问题描述 投票:0回答:1

我对 RPGLE 非常陌生,我遇到了一些错误,例如:

The length parameter must be a numeric constant between 1 and the maximum for the type. (20).

关于我所有的分区变量。我越来越

The Factor 2 operand is not valid for the specified operation. (30).

在我的

Write ClassAverage;
因子 2 操作数是什么?

**FREE

dcl-f wuexampl1 Disk Usage(*Input) ;
dcl-f ch6print printer Usage(*output);

dcl-s Totalscore zoned(3,0);
dcl-s FIN char(1);
dcl-s RecordCount zoned(2,0);
dcl-s AverageScore zoned(3,0);
dcl-s ClassAverage zoned(3,0);



Write HEADER;
Read EXAMREC;
DOW Not %eof(wuexampl1);
    AverageScore = (Exam1 + Exam2 + Exam3 + Exam4 + Exam5) / 5;
    Totalscore += AverageScore;
    FIN = SFNAME;
    RecordCount += 1;
    Write DETAIL;
    Read EXAMREC;
enddo;
    ClassAverage = Totalscore / RecordCount;
    Write ClassAverage;

*inlr = *on;
return;
rpgle
1个回答
0
投票

长度参数必须是 1 到 该类型的最大值。 (20).

RPG 使用

:
而不是
,
作为参数分隔符,尝试

dcl-s RecordCount zoned(2:0);
dcl-s AverageScore zoned(3:0);
dcl-s ClassAverage zoned(3:0);

因子 2 操作数对于指定的运算无效。 (30).

在 RPG 中,您编写记录格式或文件,而不是单个字段。

而不是

Write ClassAverage;

您需要在

ch6print
文件中写入适当的记录。

© www.soinside.com 2019 - 2024. All rights reserved.