What HPT does is convert the spooled file into the language of the printer. How easy/hard that is to read from your RPG program will depend on which WSCST definition you are using. Some are very simple and produce a plain text file, others do not.

But, yes, assuming you have the right WSCST setup, the output of the HPT API can be plain text, just load it into a variable and then do your %SCAN.

You'll either need to scan for an ASCII string, or translate the spooled file to EBCDIC, of course.

On 4/21/2014 8:57 AM, Jack Tucky wrote:
What I am trying to do is just look at the data instead of writing it to the

All of the examples I've found take the pointer and give it to another
function like write to the IFS, create a duplicate spool file.

I want to get the spool file data into memory, look for a keyword, then do
some stuff based on whether the keyword exists.

How can I change this line so that I can have the data in the program to do
a %SCAN?

EVAL bytesw = write(fd : xbufspc_p : hptxbuflena)

Thanks, Jack

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Sunday, April 20, 2014 10:05 PM
To: Midrange Systems Technical Discussion
Subject: Re: Spl2stmf and HPT

The output of HPT is usually some flavor of ASCII. Maybe that's why it
looks like "gibberish" to you?

Possibly you just need to mark the IFS file with a proper CCSID after it's
done, and tools like DSPF or EDTF will view it properly?

Regarding your change... are you certain that the data is null-terminated?
In my experience with the HPT API, it normally is not, it's just raw binary
data. You should not be using %STR here... unless I'm misunderstanding.

On 4/20/2014 6:00 PM, Jack Tucky wrote:
I downloaded a program called Spl2Stmf that uses the spool file API's
to read a spool file and write an IFS file.

I'm trying to modify so I can just read the spool file in RPG to look
for some keywords.

I changed this line which wrote the STMF:

EVAL bytesw = write(fd : xbufspc_p : hptxbuflena)
To this:
String = %str(xbufspc_p : hptxbuflena);

But I only see gibberish in the String. I'm guessing that the write
command in the original example did some conversion when it wrote to the

Any ideas what I'm doing wrong? Maybe I need to strip out the HPT
completely as I'm just reading the spool file in the program? The
original download save file link is broken however.


Now that I think more this is overkill and I just need something to
open and read the spool file.

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page