OUTPUT_QUEUE_ENTRIES view

The OUTPUT_QUEUE_ENTRIES view returns one row for each spooled file in every output queue. This view uses the QSYS2.OUTPUT_QUEUE_ENTRIES table function with DETAILED_INFO => 'YES'.

Authorization: The caller must have:
  • *EXECUTE authority to the output queue library and
    • *READ authority to the output queue object, or
    • *SPLCTL special authority, or
    • *JOBCTL special authority and the output queue is defined with OPRCTL(*YES).

To achieve the best performance when querying the OUTPUT_QUEUE_ENTRIES view, the use of a WHERE clause is recommended if you are interested in examining specific output queue libraries or output queues. OUTPUT_QUEUE_ENTRIES_BASIC typically performs much better than OUTPUT_QUEUE_ENTRIES. OUTPUT_QUEUE_ENTRIES should only be used when OUTPUT_QUEUE_ENTRIES_BASIC does not include the columns needed by the query.

The following table describes the columns in the view. The system name is OUTQ_INFO. The schema is QSYS2.

Table 1. OUTPUT_QUEUE_ENTRIES view
Column Name System Column Name Data Type Description
OUTPUT_QUEUE_NAME OUTQ VARCHAR(10) Name of the output queue containing the spooled file.
OUTPUT_QUEUE_LIBRARY_NAME OUTQLIB VARCHAR(10) The name of the library that contains the output queue.
CREATE_TIMESTAMP CREATED TIMESTAMP The timestamp when the file was created.
SPOOLED_FILE_NAME SPOOLNAME VARCHAR(10) The file name that was specified by the user program when the file was created, or the name of the device file used to create this file.
USER_NAME USER_NAME VARCHAR(10) The name of the user profile that produced the file.
USER_DATA USER_DATA VARCHAR(10)
Nullable
The user-specified data that describes this file. Contains null if there is no user-specified data.
STATUS STATUS VARCHAR(15) Status of the spooled file.
CLOSED
The file has been completely processed by a program but SCHEDULE(*JOBEND) was specified and the job that produced the file has not yet finished.
DEFERRED
Printing of the file has been deferred.
DELETED
The file has been deleted.
HELD
The file has been held.
MESSAGE WAITING
This file has a message which needs a reply or an action to be taken.
OPEN
The file has not been completely processed and is not ready to be selected by a writer.
PENDING
The file is pending to be printed.
PRINTING
The file has been completely sent to the printer but print complete status has not been sent back.
READY
The file is available to be written.
SAVED
The file has been printed and then saved. This file remains saved until it is released.
SENDING
The file is being sent or has been sent to a remote system.
WRITING
This file is currently being produced by the writer.
SIZE SIZE INTEGER The size of the spooled file, in kilobytes.
TOTAL_PAGES PAGES INTEGER The total number of pages in the file.
COPIES COPIES SMALLINT The number of copies remaining to print.
FORM_TYPE FORM_TYPE VARCHAR(10) The type of form that should be loaded in the printer to print this file.
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name that produced the file.
DEVICE_TYPE DEVTYPE VARCHAR(10) The type of data stream used to represent the file.
*AFPDS
Advanced Function Presentation data stream
*AFPDSLINE
AFPDS data mixed with 1403 line data
*IPDS
Intelligent printer data stream
*LINE
1403 line data
*SCS
Systems Network Architecture (SNA) character stream
*USERASCII
ASCII data
OUTPUT_PRIORITY OUTPTY SMALLINT The priority of the spooled file.
FILE_NUMBER FILENUM INTEGER The spooled file number of the specified file.
SYSTEM SYSTEM VARCHAR(8) The name of the system where the job that created the spooled file ran.
ACCOUNTING_CODE ACGCDE VARCHAR(15) An identifier assigned by the system to record the resources used to write this file.
EXPIRATION_DATE EXPDATE DATE
Nullable
The date the file will be eligible for removal from the system by the Delete Expired Spooled Files (DLTEXPSPLF) command. Contains the null value if the file will not expire.
SAVE_AFTER_WRITE SAVEAFTER VARCHAR(4) Indicates whether this file is to be saved after it is written.
*NO
The file is deleted after it has been written.
*YES
The file is set to save status after it has been written.
Start of changeTOTAL_RECORDSEnd of change Start of changeTOTALRCDSEnd of change Start of changeINTEGEREnd of change Start of changeThe total number of records in the printer file. It is possible for TOTAL_RECORDS to be larger than MAXIMUM_RECORDS due to a reply to inquiry message CPA4072.

Contains null if the spooled file data stream is not *AFPDS, *AFPDSLINE, or *LINE, or if the file is open.

End of change
Start of changeMAXIMUM_RECORDSEnd of change Start of changeMAXRCDSEnd of change Start of changeINTEGEREnd of change Start of changeThe maximum number of records allowed in the file at the time the file was opened.

Contains null if there is no maximum.

End of change
PAGE_LENGTH PAGELEN INTEGER The page length, in lines per page, used by the spooled file.
LINES_PER_INCH LPI DECIMAL(5,1) The number of lines per vertical inch defined in the printer file.
PAGE_WIDTH WIDTH INTEGER The page width, in characters per printed line, used by the spooled file.
CHARACTERS_PER_INCH CPI DECIMAL(5,1) The number of characters per horizontal inch, defined in the printer file.
PRINT_FIDELITY FIDELITY VARCHAR(8) The kind of error handling that is performed when printing.
*ABSOLUTE
The file is printed only if it can be printed exactly as specified in the data stream.
*CONTENT
The printing overrides errors in the data stream and continues printing with the printers best quality based on the content fidelity.
PAGE_ROTATION ROTATION VARCHAR(5) The degree of rotation of the text on the page, with respect to the way the form is loaded into the printer.
*AUTO
Computer output reduction is done automatically if the output is too large to fit on the form, regardless of the print quality.
*DEVD
The operating system sends a device default rotation value to the printer. Page rotation is dependent on the printer's specifications.
*COR
Output created for a form 13.2 inches wide by 11.0 inches long is adjusted to print on a form 11.0 inches wide by 8.5 inches long.
PRINT_BOTH_SIDES BOTHSIDES VARCHAR(7) How the information prints.
*FORMDF
The file uses a user-specified form definition. This value is used only for *LINE, *AFPDS, and *AFPDSLINE printer device type files.
*NO
The printing on the page is on one side only.
*YES
The printing is on both sides of the page with the top of each page the same for both sides.
*TUMBLE
The printing is on both sides with the top of one printed page at the opposite end from the top of the other printed page.
FILE_AVAILABLE FILEAVAIL VARCHAR(8) The time when this file becomes available to an output device for processing.
*IMMED
The file is available as soon as the file is opened.
*FILEEND
The file is available as soon as the file is closed.
*JOBEND
The file is available when the job that owns the file is completed.
STARTING_PAGE STARTPAGE VARCHAR(10) The page at which printing is to start for the file. Can contain the following special value:
*ENDPAGE
Printing starts with the last page.
ENDING_PAGE ENDPAGE VARCHAR(10) The page at which printing is to end for the file. Can contain the following special value:
*END
Printing ends with the last page.
DEVICE_FILE_LIBRARY DEVLIB VARCHAR(10) The name of the library that contains the device file.
DEVICE_FILE_NAME DEVFILE VARCHAR(10) The name of the device file used to create the spooled file.
Start of changeUSER_DEFINED_DATAEnd of change Start of changeUSRDFNDTAEnd of change Start of changeBINARY(255)End of change Start of changeData defined by the user to be used by user applications or user-specified programs that process spooled files.

Contains null when there is no user-defined data.

End of change
PROGRAM_THAT_OPENED_
FILE_LIBRARY
LIBOPEN VARCHAR(10)
Nullable
The name of the library that contains the program that opened the file. Contains null when the program is not known.
PROGRAM_THAT_OPENED_
FILE_NAME
PGMOPEN VARCHAR(10)
Nullable
The name of the program that opened the spooled file. Contains null when the program is not known.
FORM_DEFINITION_LIBRARY FORMLIB VARCHAR(10)
Nullable
The name of the library that contains the form definition. Contains null if FORM_DEFINITION_NAME is a special value or if no form definition is specified for this spooled file.
FORM_DEFINITION_NAME FORMNAME VARCHAR(10)
Nullable
The name of the form definition to use for this print request. Can contain one of the following special values:
*DEVD
The form definition in the printer device description will be used.
*INLINE
The form definition defined in the spooled file data stream will be used.
*INLINED
The form definition defined in the spooled file data stream will be used. If a form definition is not found, the form definition in the printer device description will be used.
F1DFLT
The form definition defined in the spooled file data stream will be used.
Contains null when no form definition is specified for this spooled file.
PAGE_DEFINITION_LIBRARY PAGELIB VARCHAR(10)
Nullable
The name of the library containing the page definition. Contains the null value for *LINE or *AFPDSLINE printer device type files.
PAGE_DEFINITION_NAME PAGENAME VARCHAR(10)
Nullable
The name of the page definition to use for the file. Contains the null value for *LINE or *AFPDSLINE printer device type files.
FRONT_OVERLAY_LIBRARY FRONTLIB VARCHAR(10)
Nullable
The name of the library containing the front overlay. Can contain one of these special values:
*CURLIB
The current ibrary is searched the front overlay.
*LIBL
The library list is used to locate the front overlay.
Contains null when FRONT_OVERLAY_NAME is *NONE.
FRONT_OVERLAY_NAME FRONTNAME VARCHAR(10) The name of the front overlay. Can contain the following special value:
*NONE
The file does not use the front overlay.
BACK_OVERLAY_LIBRARY BACKLIB VARCHAR(10)
Nullable
The name of the library containing the back overlay. Contains null when BACK_OVERLAY_NAME is a special value.
BACK_OVERLAY_NAME BACKNAME VARCHAR(10) The name of the back overlay. Can contain the following special values:
*FRONTOVL
The back overlay is the same as the front overlay.
*NONE
The file does not use the front overlay.
CHARACTER_SET_LIBRARY CHRSETLIB VARCHAR(10)
Nullable
The name of the library containing the font character set object. Can contain one of these special values:
*CURLIB
The current library is searched for the font character set object.
*LIBL
The library list is used to locate the font character set object.
Contains null when CHARACTER_SET_NAME is *FONT.
CHARACTER_SET_NAME CHRSETNAME VARCHAR(10) The name of the font character set object used to print this file. Can contain the following special value:
*FONT
The information specified on the font parameter is used instead of the character set and code page.
CODE_PAGE_LIBRARY CODELIB VARCHAR(10)
Nullable
The name of the library containing the code page used to print this spooled file. Can contain one of these special values:
*CURLIB
The current library is searched for the code page name.
*LIBL
The library list is used to locate the code page name.
Contains null when no code page is specified for this spooled file.
CODE_PAGE_NAME CODENAME VARCHAR(10)
Nullable
The name of the code page used to print this spooled file. Contains null when no code page is specified for this spooled file.
CHARACTER_SET_POINTSIZE CHARSIZE DECIMAL(5,1)
Nullable
The point size in which this file's characters (defined by CHARACTER_SET) should be printed. Contains null if the character set does not have a point size.
CODED_FONT_LIBRARY FONTLIB VARCHAR(10)
Nullable
The name of the library containing the coded font used to print this spooled file. Can contain one of these special values:
*CURLIB
The current library is searched for the coded font.
*LIBL
The library list is used to locate the coded font.
Contains null when CODED_FONT_NAME is *FNTCHRSET.
CODED_FONT_NAME FONTNAME VARCHAR(10) The name of the coded font used to print this spooled file. Can contain the following special value:
*FNTCHRSET
The values used are the values specified on the character set name and library name and code page name and library name fields.
CODED_FONT_POINTSIZE FONTSIZE DECIMAL(5,1)
Nullable
The point size in which this file's characters (defined by CODED_FONT) should be printed. Contains null if the coded font does not have a point size.
MULTIBYTE_DATA MULTIBYTE VARCHAR(10) Whether the file can contain double-byte character set (DBCS) data, Unicode data, or both. Values are *YES and *NO.
DBCS_CODED_FONT_LIBRARY DBCSLIB VARCHAR(10)
Nullable
The name of the library containing the DBCS-coded font. Can contain one of these special values:
*CURLIB
The current library is searched for the DBCS-coded font.
*LIBL
The library list is used to locate the DBCS-coded font.
Contains null when DBCS_CODED_FONT_NAME is *SYSVAL.
DBCS_CODED_FONT_NAME DBCSNAME VARCHAR(10) The name of the DBCS-coded font used to print DBCS-coded data on printers configured as AFP(*YES). Can contain the following special value:
*SYSVAL
The DBCS-coded font specified in the system value is used.
DBCS_CODED_FONT_POINTSIZE DBCSSIZE DECIMAL(5,1)
Nullable
The point size in which this file's DCBS characters (defined by DBCS_CODED_FONT) should be printed. Contains null if the DBCS-coded font does not have a point size.

Example

For the output queue with the largest number of files, determine how many kilobytes of data would be deleted by running the Delete Expired Spooled Files (DLTEXPSPLF) CL command.
WITH MOSTFILES(OUTQ_LIB, OUTQ_NAME) AS (
  SELECT OUTPUT_QUEUE_LIBRARY_NAME, OUTPUT_QUEUE_NAME
    FROM QSYS2.OUTPUT_QUEUE_INFO
      ORDER BY NUMBER_OF_FILES DESC
        LIMIT 1
)
SELECT SUM(SIZE) AS KB_TO_CLEAR
  FROM MOSTFILES, QSYS2.OUTPUT_QUEUE_ENTRIES
    WHERE OUTPUT_QUEUE_LIBRARY_NAME = OUTQ_LIB  AND
          OUTPUT_QUEUE_NAME         = OUTQ_NAME AND
          EXPIRATION_DATE IS NOT NULL           AND
          EXPIRATION_DATE < CURRENT DATE;