NOT SURE IF THIS IS WHAT YOU NEED BUT IT’S A SUGGESTION
CREATE A FILE RECORD LENGTH 198, I NAMED IT PRTFILE.
OVRPRTF FILE(QSYSPRT) HOLD(*YES) USRDTA(QSYSPRT) +
CPYSPLF FILE(QSYSPRT) TOFILE(PRTFILE) SPLNBR(*LAST)
” PUT PROGRAM HERE TO READ THE FILE AND DO WHAT YOU NEED BASED ON RECORD CONTENT”
Your question doesn’t make much sense. First, if you have a link to a streamfile, then you already have a “file” — a “stream” file. Your question seems to imply that you want the spooled file that is created from printing a streamfile to be put into some other kind of file. What kind of file are you trying to populate? Not a spooled file nor a display file, and apparently not another streamfile. So… a physical file?
But why would you want the physical file to contain the output from DSPLNK *PRINT? What can you use the printed output for?
Okay, you probably don’t really want that. My guess for what you want is the CPYFRMSTMF command. You want to copy a streamfile into a physical file for some strange reason. So, just use CPYFRMSTMF (Copy From Streamfile).
I can’t think of any good reason for doing so, but you must have one. Why not just process the file where it is? RPG, COBOL, C — they’re all perfectly capable of reading and writing streamfiles.
But maybe someone is sending you a streamfile and it belongs in a physical file…? Perhaps it’s in .CSV or tab-delimited format and you need a quick way to break it out into its rows and columns. If so, then you probably should investigate the CPYFRMIMPF (Copy From Import File) command. It might be all you need.