Wouldn't it be nice to have a "simple" process for distributing copies of spool files to different printers? Or one that just uses basic OS/400 commands and definitions?
Well, you can, with just a few simple user profiles, distribution entries and the SNDNETSPLF command.
Here are the pieces:
- The SNDNETSPLF command, which is designed to send copies of spool files to System Distribution Entries.
OS/400 HELP defines the System Distribution Directory as: A directory containing information about a user, such as the user ID and address, system name, user profile name, mailing address, telephone, number, and other user information.
- User profiles to identify each printer you want to distribute to.
- Local directory entries associated with specific user profiles.
Say we have 20 printers spread around the company, and we want to be able to route copies of spool files to anyone of them.
In this example, each print writer has an output queue associated with it that has same name as the print writer.
Here is what you can do:
- Create a user profile for each printer. This user profile has no special authority, and you can't us it to initiate an interactive session. It is just created so the SNDNETSPLF can identify where to deposit the spool file copy:
CRTUSRPRF USRPRF(PRT01) PASSWORD(*NONE) INLMNU(*SIGNOFF) TEXT('Route print to PRT01') OUTQ(QUSRSYS/PRT01)
- Add a System Distribution Entry for each one of these profiles:
ADDDIRE USRID(PRT01 PRINTER) USRD('Route print to PRT01') USER(PRT01)
That's all there is to setting it up. When the SNDNETSPLF command is used, it will package up an exact copy of a spool file and send it to the output queue defined for the user profile associated with the System Distribution Entry you specify.
To send a copy of a spool file to a printer you could do any of the following.
Use Option 1 (Send) from the WRKOUTQ or WRKSPLF display and hit F4 to prompt.
Work with Output Queue Queue: KENNETH Library: KENNETH Status: RLS Type options, press Enter. 1=Send 2=Change 3=Hold 4=Delete 5=Display 6=Release 7=Messages 8=Attributes 9=Work with printing status Opt File User User Data Sts Pages Copies Form Type Pty QPRINT KEG PRTDBFANL RDY 259 1 *STD 4 QPSAVOBJ KEG RDY 1 1 *STD 5 QPSRLDSP KEG RDY 1 1 *STD 5 Work with All Spooled Files Type options, press Enter. 1=Send 2=Change 3=Hold 4=Delete 5=Display 6=Release 7=Messages 8=Attributes 9=Work with printing status Device or Total Cur Opt File User Queue User Data Sts Pages Page Copy QPJOBLOG KEG QEZJOBLOG QZDASOINIT RDY 5 1 QHSTANL KEG QHSTANL 083103 RDY 8 1 QHSTANL KEG QHSTANL 090103 RDY 8 1
Specify the System Distribution List entry for one of the printers as TOUSRID (PRT01 PRINTER) ....
Hit enter, and away it goes.
You can also put a " + for more values " and enter a list of printers to send copies to.
Send Network Spooled File (SNDNETSPLF) Type choices, press Enter. Spooled file . . . . . . . . . . FILE > QPJOBLOG User ID: TOUSRID PRT01 User ID . . . . . . . . . . . PRINTER Address . . . . . . . . . . . + for more values Job name . . . . . . . . . . . . JOB > QPRTJOB User . . . . . . . . . . . . . > KEG Number . . . . . . . . . . . . > 899613 Spooled file number . . . . . . SPLNBR > 6204 Job system name . . . . . . . . JOBSYSNAME > S02 Spooled file created: CRTDATE Creation date . . . . . . . . > '10/20/03' Creation time . . . . . . . . > '09:18:16' Data format . . . . . . . . . . DTAFMT *RCDDATA
In a CLP you would just use the SNDNETSPLF command with a single user ID or list of User IDs:
SNDNETSPLF FILE(&FILENAME) TOUSRID((&USER &ADDRESS)) JOB(*)
Don't limit yourself to sending just to printer IDs either. You can specify any System Distribution Entry, so you can send spool file copies to output queues associated with any user profile on the system or to users on remote iSeries systems if you have a SNADS network set up.
Example: To send a copy of a spool file to writers PRT01, PRT02 and to myself
SNDNETSPLF FILE(myfile) TOUSRID((prt01 printer)(prt02 printer)(keg s02)) JOB(*)
There ya go. See how simple this is. AND there is no need to copy spool file data into a database file and then turn around and recreate the file. OS/400 takes care of everything.
I hope you find this to be as useful in your everyday working environment as I do in mine.
About the author: Kenneth is a senior AS/400e system administrator at Northwest Natural Gas in Portland, Ore. He has extensive experience in all aspects of iSeries systems management. That includes proactive performance tuning, system software upgrades and maintenance, hardware upgrade planning, backup/recovery procedures and security.
- Another way to output a spool file to multiple printers
Search400.com member Gail Lorzing has written code for the CL that she uses to send duplicate spool files to different printers.
- Retain user data on spoolfile transfer
Search400.com member Vijayakumar Kannan provides a way to identify what each spoolfile or report is all about. The user can eliminate the display of every QSYSPRT spooolfile under hisuser ID and see what information is displayed to determine if it's the correct report.
.uLO1aZ2dGUZ.1@.ee84636/1664>Error when trying to send a spoolfile
What do you do when you get the message "User not enrolled in system distribution directory" when trying to use the SNDNETSPLF command? Several Search400.com members in the discussion forum had suggestions.
- I've used SNDNETSPLF for years to good effect. But for simplicity, SNDTCPSPLF can often be better as long as you only need what it supplies. Thomas Liotta