Copying spool file into the from the output queue into a physical file in AS400

Hi All,
The below is the requirement.
I have multiple queues  as below and i want to retrieve only specific output queues . These specific queue represent each day e.g
MON1,TUE1,WED1,THU1,FRI1 .These output queues are placed in random order and are in 'RDY' status in the queue.
Every day when the spool file comes into a specific queue , it should be copied into a physical file.
For Eg. On Monday, once the spool file SPOOLF1 is present in the output queue MON1, it should be immediately written to the physical file even if it is empty.There are many  other spool files present in MON1, however, the copy should be performed only to the specific file SPOOLF1 for MON1.

On similar lines, once the spool file SPOOLF1 comes to TUE1 queue , it should immediately be copied to another physical file and so on and so forth for queues WED1,THU1 and FRI1.

Work with all output queues:

Queue          Library
A                    XYZ
MON1           XYZ
C                    XYZ
D                   XYZ
TUE1             XYZ
F                    XYZ
WED1          XYZ
THU1           XYZ
FRI1                XYZ

After selecting output queue TUE1, i am in the below screen:
Work with output queue:
File                 User                    User Data       Sts
SPOOLX        user1                    ud1                 RDY
SPOOLY        user1                     ud2                RDY
SPOOLZ        user1                     ud3                RDY
SPOOLF1      user1                     ud4                RDY                -->    This file needs to be copied to a physical file
SPOOLQ       user1                     ud5                RDY
SPOOLR        user1                     ud6                RDY
SPOOLS        user1                     ud7                 RDY

Would really appreciate if someone can help me out with this, Thanks in advance for the help !
Sambasivam SubramanianAsked:
Who is Participating?
Gary PattersonVP Technology / Senior Consultant Commented:
This would require a change to the program that creates the spooled file.  The program would use OVRDBF to override the print file to a specific database file, based on the day of the week.

OVRDBF FILE(SPLF1) TOFILE(mylib/mydbf) ...
then create the spooled file


OVRPRTF TOSTMF() to override to a stream file (automatic naming is a nice feature of  using stream files).
Then create the spooled file

There are third party software tools that can help with what you want to do, but I have no idea what you might own.


- Gary
MurpheyApplication ConsultantCommented:
The possibility of saving spool-files depends strongly on the content of the spool-file and the purpose of the saved data.

If it's only for logging, you can use CPYSPLF, but some info will be lost (as graphics , lines, barcodes). and *IPDS or *AFPDS can give problems.
If you need the saved spool-files to reprint? you better print them as PDF and store it on e.g. the IFS.
I would also go with PDFs rather than with physical files. But a few other questions should be answered first.

If SPOOLF1 is copied to a PF from MON1, will SPOOLF1 from TUE1 be copied into the same PF? Or is a new PF created for every SPOOLF1? If it's the same PF, will it be the same meber or is a new member created? If it's the same member, is it replace or add?

There are plenty of other questions such as "What's the point?", but those above would be better.

Personally, I'd prefer basic spooled file backup rather than copying to a PF. Store the backups somewhere off-line. And in fact, I generally don't believe in "spooled file backup" much at all. Whenever possible, the data that generates a spooled file should be what gets stored. With the data, spooled files can be generated over and over whenever needed. In addition, storing the data as database files gives far easier opportunities for future queries against it, something that can be very messy for "spooled file backups".

Also, if data for spooled files is generated into intermediate database files and spooled files are created from that data, alternative output methods can be applied. A spooled file might be created or a PDF or a spreadsheet or a display file or...? The spooling programs will also be simpler since their only purpose will be to format output. Logic for generating the data will be separated from the printing function.
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.

All Courses

From novice to tech pro — start learning today.