Tips and Techniques: Sending Output via Remote OUTQs

CL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Each year, I learn two or three things about the iSeries or AS/400 that have often been around for years, but I never ran across them. About 10 years ago, my good friend Greg Veal (author of CL Programming for the IBM AS/400) told me that second-level prompting was available on the IF statement in CL. If you prompt the IF command, you can then prompt the command you want to run on the THEN parameter by positioning the cursor in the THEN parameter on the prompter and then pressing the F4 key.

I've used this technique on the SBMJOB command interactively for years, and that was why I was complaining about it to him with regard to the IF statement. It never occurred to me to press F4 in the THEN parameter.

Recently, I learned about remote output queues. I needed to be able to send the output from one AS/400 to another over the Internet. The only true connection was TCP/IP over the Internet and not much else.

So I started to write a tool that would copy a spool file to a database file and then evoke FTP to send the file to the other system. At the other end, I would use a never-ending batch program to periodically test a file for the new member and then print it to the local printer. Imagine how dumb I felt after asking a few questions of some colleagues on the RPG newsgroups and email lists.

Remote OUTQs

You can actually do what I wanted to do by simply creating an output that points to an IP address and an existing output queue on an AS/400 somewhere on the Internet.

Yes, that's right: Using your IP address and the name of an output queue, anyone can send you a spool file that will sit in that output queue until you print it or delete it.

To create a remote output queue, all you have to do is enter the IP address of the remote system, identify the output queue name on that remote system, and--optionally but highly recommended--specify very clear text as to where the output is located. Here's an example command to create a remote output queue:

CRTOUTQ OUTQ(LUNA7) RMTSYS('198.222.333.0')  + 
          RMTPRTQ('*LIBL/QPRINT') CNNTYPE(*IP) TRANSFORM(*NO)  +
                   TEXT('RPG xTools i5 520 output queue') 

In this example, the output queue LUNA7 is created on the local system, and it points to the remote system at the dummy IP address specified. (You would specify a real IP address of one of your own systems.) The output queue on the remote system is QPRINT. Note that the connection type is set to *IP and that I've chosen to not transform the output.

Use the remote output queue just like any local output queue; simply write to the output queue or use option 2 on WRKSPLF or similar commands to move existing spool files to the remote printer. The system takes care of sending the spool file to the remote system and spooling it up there.

If you have a firewall, you may need to open the port for this capability to function. If your first attempt at sending a spool file to the remote output fails, look at the second-level text of the low-level joblog messages for the port number.

Bob Cozzi is a programmer/consultant, writer/author, and software developer. His popular RPG xTools add-on subprocedure library for RPG IV is fast becoming a standard with RPG developers. His book The Modern RPG Language has been the most widely used RPG programming book for more than a decade. He, along with others, speaks at and produces the highly popular RPG World conference for RPG programmers.

BOB COZZI

Bob Cozzi is a programmer/consultant, writer/author, and software developer. His popular RPG xTools add-on subprocedure library for RPG IV is fast becoming a standard with RPG developers. His book The Modern RPG Language has been the most widely used RPG programming book for more than a decade. He, along with others, speaks at and produces the highly popular RPG World conference for RPG programmers.


MC Press books written by Robert Cozzi available now on the MC Press Bookstore.

RPG TnT RPG TnT
Get this jam-packed resource of quick, easy-to-implement RPG tips!
List Price $65.00

Now On Sale

The Modern RPG IV Language The Modern RPG IV Language
Cozzi on everything RPG! What more could you want?
List Price $99.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: