still I do not see any need to clobber the script with the LM**** stuff!
the simple flow should be ...
allocate and read the input file
process each record stacking something
when some flag tells
allocate write close free the output dataset
after loop termination
if a dataset write is pending just
allocate write close free the output dataset for the last unprocessed chunk
no need to bother ISPF.
nor to change the DDNAME for the output.
If I use the code to populate the PDS with members and write just a blank line in each member my routine runs fine.
This way I created 57 members in the PDS.
I got the messgae "Unrecognised I/O error during Write" when trying to write data into each member.
LMPUT error statement was also provided
(I will try to type the detailed error statement tomorrow from Office - can't copy paste)
When I tried with an Input dataset with records meant for 4 members (approximately 100 records) this code worked fine as well.
For this reason I am more inclined to believe that I faced some kind of space abend.
Another information is I am trying to execute this code from ISPF by typing "EX" against the REXX member within the PDS where the REXX routine is stored. Is it possible that I am running out of virtual memory while executing in this way?