how to write to new line in printer file?

48 views Asked by At
     A          R DETAIL
     A            STUNO          9S 0   5  3
     A            FIN            1A     5 19
     A                                  5 20'.'
     A            SLNAME        15A     5 22
     A            EXAM1          3S 0   5 42
     A            EXAM2          3S 0   5 48
     A            EXAM3          3S 0   5 54
     A            EXAM4          3S 0   5 61
     A            EXAM5          3S 0   5 66
     A            AVGSCORE       3S 0   5 72 SKIPB(1)
     A          R FOOTER
     A                                  6 56'Class Average'
     A            CLASSAVG       3S 0   6 72

This is my current printer file (header excluded) and my loop..

Write HEADER;
Read EXAMREC;
DOW Not %eof(wuexamp);
    EVAL(H) AVGSCORE = (EXAM1 + EXAM2 + EXAM3 + EXAM4 + EXAM5) / 5;
    Totalscore = Totalscore + AVGSCORE;
    FIN = SFNAME;
    RecordCount = RecordCount + 1;
    Write DETAIL;
    Read EXAMREC;
enddo;
    CLASSAVG = Totalscore / RecordCount;
    Write FOOTER;

I'm just learning RPG, what am I missing in my printer file to get it to print new details to a new line? The information I'm getting value wise while debugging seems to be correct through the loop but the only detail I have printed in my output is the last record that is read in.

1

There are 1 answers

0
Victor Pomortseff On
 A          R DETAIL                    SPACEA(1)
 A            STUNO          9S 0      3
 A            FIN            1A       19
 A                                    20'.'
 A            SLNAME        15A       22
 A            EXAM1          3S 0     42
 A            EXAM2          3S 0     48
 A            EXAM3          3S 0     54
 A            EXAM4          3S 0     61
 A            EXAM5          3S 0     66
 A            AVGSCORE       3S 0     72 
 A          R FOOTER                    SPACEA(1)
 A                                    56'Class Average'
 A            CLASSAVG       3S 0     72

Unlike a display file, the printer records are relative - they do not need to indicate the line number, only the position number in the line.