Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating and writing to a spool file in RPG

1,220 views
Skip to first unread message

Barry

unread,
Jan 8, 2015, 8:37:51 AM1/8/15
to
Anyone got any pointers on doing this?

Couldn't find anything in the documentation or via the API finder so I might be out of luck.

Thanks in advanced.

Dr.UgoGagliardelli

unread,
Jan 8, 2015, 9:11:15 AM1/8/15
to
Well, in my opinion you lack much more than writing into a spooled file!
:-))
On as400 (aka iSeries or system i) for any language, writing into a
spooled file is matter to write a device file of type printer, in other
words an object of type *FILE with PRTF object attribute, called
printer-file.
As any other file, in RPG language you have to declare the file
specifying printer instead of disk (that's foer db tables) or display
(that's for io on screen) or special (tha's for anyinput/output device
of your choice).

A printer-file can be described by DDS (with records and fields) or not
described at all. Anyway, a printerfile hosts all attributes that make
what in other terms are called printer-capabilities (font, lines per
inch, characters per inch, and so on.

When in an RPG program you declare a file thats dds described, you can
use write operation code speciying also the record you want to use for
output, then compiling the program, the compiler will add add fields and
record definitions to the program, you can use them such as any other
variable explicitly defined.
If the printer-file is not dds described, you can still use write
operation code speciying ony the file name, as this kind of printer-file
has no records. Or you can use O specification using EXCPT operation code.

When the program close the printer-file, explicitly with close operation
code, or implicitly returning with LR indicator on, the generated spool
change its status from OPN to RDY or HLD (if the printer-file has
HOLD(*YES) attribute set) or FIN (that means that the program didn't
made any output operation). The satust of FIN is set also when the
spooled file has been printed and no SAVE(*YES) attribute was not set in
the printer-file.

Further more, printing on as400 is a new world, that must be explored
step by step.

Barry

unread,
Jan 8, 2015, 10:00:52 AM1/8/15
to

> Well, in my opinion you lack much more than writing into a spooled file!
> :-))
>
> -SNIP-
>
> Further more, printing on as400 is a new world, that must be explored
> step by step.

Huh, well thanks for the in-depth reply.

This is defiantly a place for me to start, thank you.

Dr.UgoGagliardelli

unread,
Jan 8, 2015, 10:03:51 AM1/8/15
to
Il 08.01.2015 16.00, Barry ha scritto:
>
>> Well, in my opinion you lack much more than writing into a spooled file!
>> :-))
>>
>> -SNIP-
>>
>> Further more, printing on as400 is a new world, that must be explored
>> step by step.
>
> Huh, well thanks for the in-depth reply.
Well, that wasn't in-depth at all! I'm pretty sure I touched only the
surface!
:-))

Barry

unread,
Jan 8, 2015, 10:07:43 AM1/8/15
to

> > Huh, well thanks for the in-depth reply.
> Well, that wasn't in-depth at all! I'm pretty sure I touched only the
> surface!
> :-))

It defiantly helped me understand what I'm trying to archive a little bit more.

I'm writing a program which compiles multiple members and wanted to create a spool file to place the compile errors in instead of using the Dsply OP code.

CRPence

unread,
Jan 8, 2015, 10:37:04 AM1/8/15
to
On 08-Jan-2015 07:37 -0600, Barry wrote:
> Anyone got any pointers on doing this?
>
> Couldn't find anything in the documentation or via the API finder so
> I might be out of luck.
>

If how to write to an output-only non-described [aka program
described] database file of a specified record length is already known,
then code to do that, and then at run-time just override the named file
to a non-described device *FILE with attribute PRTF; i.e. for the output
that was coded-as being directed to a database *FILE member, before
running the program issue Override With Printer File (OVRPRTF) to
request a redirect of that output to a printer file that was previously
created using the Create Printer File (CRTPRTF) command with
SRCFILE(*NONE) specified. The system-supplied program-described printer
files named QSYSPRT and QPRINT often are used in place of having
creating a customized file; the override can specify many
environment-specific attributes that should be used at run-time, instead
of what the defaults are defined with those system-supplied files.

--
Regards, Chuck
0 new messages