× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




I have an RPG program that creates postscript. I need to send it unchanged to a printer. I can't use a print file because that will then send an SCS print job and that won't work. Any ideas on how to do this?

When you create a print file, it has a device type parameter. For example CRTPRTF FILE(MYPRTF) DEVTYPE(*SCS).


You're correct that if you specify DEVTYPE(*SCS) the system will send an SCS print job to the printer. But if you specify DEVTYPE(*USERASCII) the data will be sent to the printer without any changes.

The way I like to do it is generate the PostScript file as a stream file in the IFS. The IFS APIs will automagically do the ASCII to EBCDIC translatation for me. Then, if I want to debug things, I can easily NFS/SMB mount my IFS and open the stream file with my favorite text editor, or even use ghostview to see what it looks like.

When I'm ready to print it, I re-open the stream file in my RPG program, this time in binary mode (so no translation takes place) and read fixed-length chunks of data (the length matches that of my print file) and write the results to the *USERASCII print file.

On the final record that I write to the print file, the data size will be smaller than the record size (most of the time). I wasn't exactly sure what to do with this -- I ended up padding the data with ASCII blanks at the end and that seems to work okay. I think the blanks are considered whitespace in PostScript and are therefore ignored.

Make sense?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.