Home > AS/400 Tips > iSeries programmer tips > Distribute spool files to printers easily
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Distribute spool files to printers easily


Kenneth Graap
11.05.2003
Rating: -4.42- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


You Can View User Feedback To This Tip

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:


Kenneth Graap

  1. 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.
  2. User profiles to identify each printer you want to distribute to.
  3. 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:

  1. 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)      
    

  2. 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.

==================================
MORE INFORMATION
==================================

  • 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.
  • 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.

USER FEEDBACK TO THIS TIP

  • 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


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
Groovy programming on IBM i

iSeries Networking
CA Express utility helps you manage SSL certificates
20 FTP tips in 20 minutes
The Lazy Coder: Find your iSeries using a DNS or name server
The Lazy Coder: Fun with TCP/IP
Automatically check FTP process for errors
Fast guide to Redbooks and guides on printing/output
Printing tips and tricks
Improve old iSeries communication methods
'Twas the Night Before Christmas in IT
How to FTP a physical file via iSeries modem

Application Development
iSeries calling an .exe
Top 10 programmer tips
Formatted work job scheduler
Convert system date and time
Mixing free format code with embedded SQL
SQL update a field in one file from a field in another file
Webcasts for iSeries programmers
Programming advice from the pros
Easy code copying via the drag and drop method
Setting FTP time-outs

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts