Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

"Estimated" pages on a spooled file

Hi,

I am creating an iSeries spooled file (SPLF) by copying a stream file into a *USERASCII print file. I can override several details on the print file so that we can find the relevant spooled file when needed (thanks to some of Scott Klement's code from years back.)

The options requested by most users relating to these spooled files are a way to see the spooled file text from the iSeries and a way to see a good estimate for the SPLF's number of pages on the WRKOUTQ and/or WRKSPLF screens.

I don't think I can do anything about viewing the file (because the stream file is ASCII postscript containing mostly binary images) but I can calculate the number of pages when I create the stream file, so I might be able to change the number of pages on the spooled file. How can I put the estimated number of pages onto the spooled file when I create it? (OVRPRTF does not help here, as far as I can see.)

Can anyone help? I am using an iSeries v6r1 machine with RPGLE and CLLE, although I also have access to Java if required.


-Paul.
0
Paul-Bailey
Asked:
Paul-Bailey
  • 2
1 Solution
 
Gary PattersonVP Technology / Senior Consultant Commented:
You can put a page count for a ASCII spooled file in USRDTA (shows on WRKSPLF), USRDFNOPT, or USRDFNDTA.  USRDTA shows on WRKSPLF.  The last two need to be displayed from WRKSPLF option 8 or using WRKSPLFA.

I don't know of any way to directly view a rendered postscript in a green-screen session, but you could certainly write a program that would convert it to PDF and push it to an IFS share where the users PC can open it with Adobe Reader:

Basic process:

1) Dump the ASCII spooled file to a stream file (CPYSPLF to db file, then CPYTOSTMF to an IFS file.)

2) Convert PS to PDF using your favorit tool.  I've successfully used Ghostscript in PASE in the past.  Output the PDF to an IFS file share that is accessible to the user from their PC.   See links for more info.

3) Use STRPCCMD CL command to start adobe reader and open the PC file:

STRPCO
STRPCCMD PCCMD('start q:\pdfs\pdf_file_name.PDF')

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Q_25273828.html

http://www.hewhocutsdown.net/blog/2012/04/25/how-to-compile-ghostscript-for-pase

http://www.mcpressonline.com/forum/showthread.php?17923-Printing-PDF-documents-from-the-IFS

http://www.scottklement.com/archives/ftpapi/200903/msg00083.html

Post back of you need more details.

- Gary Patterson
0
 
Paul-BaileyAuthor Commented:
Thanks Gary. Most of that is a bit esoteric, but hopefully someone is now going to get a lot of help having those links all in the same place. Unfortunately, the CPYSPLF option doesn't work. I'm afraid I forget the exact error message (I am not at work atm) but the meaning of the message is about the same as the error for trying to display the spooled file.

We are already using the USRDTA and USRDFNDTA for other data fields, but I hadn't thought of USRDFNOPT (or, actually, I hadn't noticed it.)

I'll check that as soon as I can, but does this mean that I can't change the "estimated" total pages for one of these spooled files? The iSeries claims it is estimated, but it always estimates one page which is really pointless. I can't find the option on the OVRPRTF command, so is there some other command or API that might be able to change that value?



-Paul
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
Native spool management doesn't "speak" postscript, so it has no idea by looking at content if a given spooled file represents one page or a thousand, based solely on content.  So for *USRASCII spooled files, it "Estimates" one page.

I don't know of a way (command or API) to change the "Number of Pages" attribute.  

I know that there is a "Total Number of Pages" attribute when using the QSPCRTSP api to create a spooled file.  Maybe you could alter the program that creates the file to use QSPCRTSP , QSPPUTSP, and QSPCLOSP (Create, Put, Close Spooled File) APIs to create the postscript file instead of whatever method you are currently using.  Then you could specify the correct page count yourself.
 
*USRASCII ASCII spooled files are a little tricky to work with.  The trick is getting the raw ASCII postscript dumped out.  Since CPYSPLF apparently doesn't like *USRASCII files (seems a silly limitation), you'd have to use the QSPGETSP API to grab and dump the raw ASCII Postscript instead.  

Once you have that, it is all downhill from there.  

Like I said, there are a lot of ways to do this, but all have similar complexities.

- Gary Patterson
0
 
daveslaterCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now