I'm extremely new to RPGLE and I'm getting some errors like:
The length parameter must be a numeric constant between 1 and the maximum for the type. (20).
on all of my zoned variables. And I'm getting
The Factor 2 operand is not valid for the specified operation. (30).
On my Write ClassAverage; What is factor 2 operand?
**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;
RPG uses
:not,as parameter separators, tryIn RPG, you write Record Formats (if multiple formats in a file, ie. Printer files) or Files (if a single format DB file), not individual fields.
Instead of
You need to write the appropriate record in the
ch6printfile. You're successfully writingHEADER,DETAIL, there's probably aTOTALSorAVERAGErecord.