× 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 application that creates spoolfiles that contains logical
pages of our bills.   I'm looking for a utility or slick way of
"reversing" the logical bill pages so they print out in reverse order.
Anyone got any ideas?

I know of a way that should theoretically work -- and I'm pretty confident that I could make it work if I wanted to -- but it'll be really complicated, especially if you're not extremely familiar with APIs in general, the spooled file APIs in particular.

Here's what I'd do:

a) Dump the spooled file to a user space.
b) Create a new (empty) user space.
c) Find the spooled data for the header, and copy it across.
d) Find the spooled data for the last page, and copy it to the first page of the new user space.
e) Keep doing that for the rest of the pages.
f) Copy any footer information
g) Create a new spooled file from the new user space data.

QUSRTOOL has a utility for forcing only certain page ranges to be sent to printers. It uses a similar technique of finding where the pages start/end in the spooled file and only sending the ones that match the page range. Of course, it doesn't reverse them, you'd have to write your own code to do this, but the QUSRTOOL example might help you get started.

Alternately, if this is an SCS spooled file you could try this instead:

a) Dump the spooled file to a PF with CPYSPLF, use *FCFC control chars.

b) write an HLL program to scan the FCFC chars to determine where pages start/stop and use those indications to write out a new PF with the pages reversed.

c) Copy the PF back to a spooled file using CPYF and an override to specify *FCFC.

That would be much simpler than the API/USRSPC approach, but wouldn't work with AFP or IPDS files, they'd have to be plain SCS.

If the spooled file is *USERASCII, I think you're out of luck :)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.