Im having problems with using NEWPAGE or EJECT stmts within the READ WORKFILE LOOP.I’m reading data from the workfile.When the name of the program( a field in the workfile) changes then I’ll have to create a new page.None of the report formatting statements are working inside the read work file loop.
Is there any other way of accomplishing this(using WRITE or something)?
#WK-PROG (FIELD IN THE WORK FILE) #PROG-TEMP (LOCAL VARIABLE)
READ WORK FILE 1 RECORD #WORK-FILE-IN
IF #PROG-TEMP NE #WK-PROG
RESET #UTIL-CNT
MOVE #WK-PROG TO #PROG-TEMP
You are probably encountering something other than an issue with READ WORK FILE - for example, EJECT only works if something is written to the page already.
Also, take a look at the IF BREAK and AT BREAK statements to see if they will do what you need. See comments elsewhere in the forum on report program standards.
One thing which I did not mention i that I’m running this program on batch.
These write statements are printed in the CMPRT01 step of the jcl. In this CMPRT01 step I’ve used a dataset.
None of the report formatting statements are working for me in the read work file loop.
I’ve changed it. But not getting any new pages in the report.
As am running this as a batch job , is there anything specific?
Or is that all empty lines will be suppressed in the dataset?
Apologies for late reply.
My input work file has close to 500 records.
I’m getting title for every 55 records(PS parameter is 55 in my program)
But not getting a new page!
When you say you are “not getting a new page”, what do you mean?
EJECT goes to a new physical page, but not a new logical page. There would be no TITLE on such new pages (but the WRITE after the EJECT should be there).
In the code you sent, #PROG-TEMP does not appear. Is it indeed A8? Are the values for the program names correct on the workfile records?
I have been following this thread, but there is something that is not clear to me. In your post regarding the JCL you mention that CMPRT01 is being written to a dataset. How does that dataset get printed to paper?