I am writing a report using REPORT writing functionality of easytrieve.
1) One output file, multiple REPORT paragraphs
REPORT REPORT1 PRINTER OUTPUTF1 <other parameters>
LINE 01 <VARIABLES>
REPORT REPORT2 PRINTER OUTPUTF1 <other parameters>
LINE 01 <OTHER VARIABLES>
REPORT REPORT3 PRINTER OUTPUTF1 <other parameters>
LINE 01 <SOME OTHER VARIABLES>
Above REPORT paragraphs are printed on different conditions to a same output file.
The problem is, OUTPUTF1 has records from only first REPORT paragraph. In above case records from only REPORT1 are printed to OUTPUTF1. If REPORT2 paragraph is moved above REPORT1 then records from only REPORT2 are printed to OUTPUTF1.
From the manual - ...if another report is already using the associated
print file, the PRINT statement outputs data to a work file that is spooled
until the associated JOB activity processing is complete
Therefore, the data from second REPORT paragraphs and further was spooled to a work file since multiple REPORT paragraphs were writing to same output file. Only first REPORT paragraph was directly writing to output file. This paragraph was holding the output file. Once JOB activity was completed, spooled data from work files should supposedly write to output file. This was not happening.
Spooled data from work files in my case was not writing to output file! The reason - I was using STOP EXECUTE! STOP EXECUTE immediately terminates all easytrieve function. This implies that writing spooled data from work files is yet another JOB activity, an internal one. Only writing STOP worked - it terminates only the current activity.