Midrange News for the IBM i Community


Copy SPOOL Files from one OutQ to Another Published by: Bob Cozzi on 29 Apr 2012 view comments

CPYOUTQ - Copy SPOOL Files to Another OUTQ

The CPYOUTQ command copies all the SPOOL files in one or more output queues to a target output queue. The target OUTQ can be on another IBM i system or on the local system. To use CPYOUTQ, type the command on the Command line, then press F4 to prompt it. The prompter will appear similar to the following:

SENDOBJ Prompter 1 or 2

The FROMOUTQ parameter accepts 1 or more (up to 300) output names whose content will be copied to a target output queue. 

The TOOUTQ parameter is the target for the copied SPOOL files. If this output queue is on another IBM i system, specify the remote location on the RMTSYS parameter.

The RMTSYS parameter identifies the system where the TOOUTQ is located. The default of *LOCAL means the TOOUTQ is on the local (same) system. For remote systems, use an IP, a HOST table name, or a DNS name. This parameter supports up to 255 characters. To increase the length of the prompted input parameter, type an & in the first position followed by one or more banks and press Enter; the field size will be increased.

If *LOCAL is specfiied for RMTSYS, then the CPYOUTQ command uses the COZTOOLS CPYPRTF command to copy each SPOOL file from the OUTQ specified on the FROMOUTQ parameter. If a remote system or IP is specified, then the IBM-supplied SNDTCPSPLF command is used to perform the copy. Note when SNDTCPSPLF is used, the new SPOOL file attributes for job and user will be: QPRTJOB and  QTMPLPD respectively.

The USER parameter accepts 1 or more user profile names. This is a filter for the SPOOL files being copied. Only SPOOL files created/owned by the users specified on this parameter are copied to the target output queue. The special name *CURRENT may be used to indicate that the user running the CPYOUTQ command be used for the USRPRF parameter.

The JOB parameter allows you to filter the copied SPOOL files, selecting only those created by the specified JOB. The default *ALL allows you to copy all the SPOOL files in the specified OUTQ's regardless of the job that created them. This parameter allows you to filter that copy to a specific user job. The special values are *ALL, * or *CURRENT. The values * and *CURRENT have identical meanings.

Security/Authorization

Do not assume that the CPYOUTQ command successfully copies all the SPOOL files from one output queue to another. The internal APIs used by CPYOUTQ do NOT return SPOOL file entries for SPOOL files to which the runtime User has no authority. Always verify that all SPOOL files have been successfully copied before doing anything permanent with the original or "FROMOUTQ" output queue SPOOL file entries.

When a user issues the CPYOUTQ command, normal system security measures are respected. This means that simply because a user can see a SPOOL file on an OUTQ does mean they have authority to copy/duplicate that SPOOL file. For example, if an output queue named REPORTS contains 650 SPOOL files and it needs to have all the SPOOL files copied to another output queue named MONTHLY in QUSRSYS, the following CPYOUTQ command could be used:

CPYOUTQ FROMOUTQ(REPORTS) TOOUTQ(QUSRSYS/MONTHLY)

After the CPYOUTQ command completes, the MONTHLY output queue may have fewer SPOOL files in it than the REPORTS output queue. When this occurs it often means that to the user profile who is copying the SPOOL file does not have sufficient authority to copy certain SPOOL files in the specified FROMOUTQ. To resolve this issue, obviously you need to use a USRPRF with sufficient authority to copy all the SPOOL file entries.

 

The CPYOUTQ command is part of the COZTOOLS library at cozTools.com

Requirements:

  • IBM i v5r4 or later.
  • SNDTCPSPLF CL Command (included in IBM i)
  • Active *LPD server for remote output queues.
  • CPYPRTF COZTOOLS command for local output queues.

Components Included:

  1. CPYOUTQ - Command Definition Object
  2. CPYOUTQ - RPG IV Command Processing Program

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS