Eject and Newpage in work file

Hi,

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

EJECT

WRITE #PROG-TEMP

.
.
.

END-WORK

can you post the complete program as a text file?

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.

My jcl is like this

//CMWKF01 DD DSN=&LDINDEX…LDDLY070.OUTPUT.SRT,DISP=SHR
//CMSYNIN DD DSN=SYS1.&CNTLIB(
program.doc (89 KB)

Your FORMAT and WRITE statements seem OK. Change your EJECT statement to EJECT (1) to match them.

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?

Do you actually have data in your input workfile?

If so, how many records?

Are you getting your Title?

steve

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?

steve

When I said new page I meant that I’m not getting a new physical page.
The #prog-temp is an A8 variable

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?