IBM Support

Dumping an IBM i Spooled File

Troubleshooting


Problem

Instructions on how to dump an IBM i spooled file.

Resolving The Problem

Every spooled file is stored in a database file member in QSPL library.  The spooled file you see on an output queue or when working with spooled files is a pointer to the database file and member in QSPL library that contains the data for the spooled file.
This document provides step-by-step instructions for identifying which database file and member contains the data for a specific spooled file and instructions for dumping the spooled file in hexadecimal format. The dump of the spooled file can be used to help diagnose a problem.

This document was last updated on 19 August 2022.

To dump a spooled file in HEX, use the CPYF or DMPSYSOBJ command, where QxxxxxNxxx is the database file name and Qnnnnnnnnn is the member name in QSPL library that contains the spooled file data:
CPYF FROMFILE(QSPL/QxxxxxNxxx) TOFILE(*PRINT) FROMMBR(Qnnnnnnnnn) OUTFMT(*HEX)
This creates a spooled file named QSYSPRT.
-or-
DMPSYSOBJ OBJ(QxxxxxNxxxQnnnnnnnnn) CONTEXT(QSPL)
This creates a spooled file named QPSRVDMP.
To locate the the database file and member names for a specific spooled file to use for the CPYF or DMPSYSOBJ commands:
For an *SCS spooled file, or a spooled file that can be displayed:
1. Locate the spooled file in question
2. Select option 5=Display next to the spooled file and press <ENTER>
3.
Log in to a second display session with the same user profile as the first session.
Issue WRKUSRJOB and press <ENTER>
Locate the job that is displaying the spooled file
NOTE:  The job will have the Status of ACTIVE and the Function will be the command used to locate the spooled file.  For example, CMD-WRKOUTQ
Select option 5=Work with next to the job
If unable to sign on to another session, from IBM i Access Client Solutions (ACS) display session, right click in the session to show the pop-up pad
Select PAD 1, then click the SysReq button and press <ENTER>
Select option 3=Display current job and press <ENTER>
4. From the Work with Job menu, select option 12. Work with locks, if active
5.
Page down until you see an object with the name that resembles Q04079Nxxx or Q00512Nxxx
For example, Q04079N082 or Q00512N005. 
Note the name of the database file.
This is the name of the database file in QSPL library that houses the member that contains the spooled file data.
6.
Select option 5=Work with job member locks next to the database file and press <ENTER>.
The member name will be shown in the form of Qnnnnnnnnn, where nnnnnnnnn is a numeric value, such as Q186874558.
Note the name of the member.
7.
From either session, dump the spooled file using one or both of these commands, where QxxxxxNxxx is the database file name and Qnnnnnnnnn is the member name obtained in the previous steps.
CPYF FROMFILE(QSPL/QxxxxxNxxx) TOFILE(*PRINT) FROMMBR(Qnnnnnnnnn) OUTFMT(*HEX)
This creates a spooled file named QSYSPRT.
-or-
DMPSYSOBJ OBJ(QxxxxxNxxxQnnnnnnnnn) CONTEXT(QSPL)
This creates a spooled file named QPSRVDMP.
For an *AFPDS, *IPDS, or *USERASCII spooled file, or a spooled file that cannot be displayed:
1. Enable spooled file auditing per Using Auditing to Track Spooling Activity.
2. Locate the spooled file in question and select option 3=Hold and press <ENTER> to hold the spooled file
3.

CPYAUDJRNE ENTTYP(SF) and press <ENTER>

4.
Using SQL, locate the audit entry for the Hold operation:
STRSQL and press <ENTER>
From the Enter SQL Statements screen, enter: 

SELECT SFETYP,SFFNAM,SFDNAM,SFSNAM,SFONAM,SFOLIB,SFLNBR,SFSJOB,
SFSUSR,SFSNBR FROM QTEMP/QAUDITSF WHERE SFETYP = 'H' 
and press <ENTER>

In the results, the File name is the name of the database file and the Member name is the name of the member.  Note these two names to use the CPYF and DMPSYSOBJ commands.

 ....+....1....+....2....+....3....+....4....+....5....+....6....+....7... ...
 Entry  File        Member      Spool       Output      Output      Spool  ...
 type   name        name        file        queue       library     number ...
                                                                           ...
   H    Q04079N007  Q995402249  QPRTLIBL    PRT01       QUSRSYS     000001 ...

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CPJAA2","label":"Print-\u003ESpooled Files QSPL Library"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

7464303

Document Information

Modified date:
19 August 2022

UID

nas8N1010298